GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitCommand errors are stringifying bytes in 3.1.15 · Issue #1220 · gitpython-developers/GitPython

GitCommand errors are stringifying bytes in 3.1.15 #1220

New issue
Copy link
New issue
Copy link
Closed
#1222
Closed
GitCommand errors are stringifying bytes in 3.1.15#1220
#1222
Copy link
Milestone
v3.1.16 - Bugfixes

Description

@jmcgill298
jmcgill298
opened on Apr 21, 2021
Issue body actions

The 3.1.15 release changed at least how git.exc.GitCommandError Errors are being generated. I have tested with stderr, but am guessing the same would be true for stdout. Previously git.exc.GitCommandError.stderr was a string of the error with bytes decoded, now the error is a string with bytes stringified.

repo.git.rebase Error:

  • 3.1.14-stderr = "\n stderr: 'fatal: invalid upstream 'invalid_branch''"
  • 3.1.15-stderr = '\n stderr: \'b"fatal: invalid upstream \'invalid_branch\'"\''

remote.push Error:

  • 3.1.14-stderr = "\n stderr: 'error: src refspec invalid_branch does not match any\nerror: failed to push some refs to '[email protected]:project/repo.git''"
  • 3.1.15-stderr = '\n stderr: \'b"error: src refspec invalid_branch does not match any\\nerror: failed to push some refs to \'[email protected]:project/repo.git\'"\''

Steps to reproduce:

import git

exception = git.exc.CommandError(command="git rebase invalid_branch".split(), stderr=b"abc")
exception.stderr

Steps to reproduce from code

import git

path_to_repo = "my_project"
repo = git.Repo(path_to_repo)

local_branch = "invalid_branch"
remote_branch = local_branch

# Generate Error for Rebase
try:
    repo.git.rebase(refspec=f"{remote_branch})"
except Exception as err:
    print(err.stderr)

# Generate Error for Push
try:
    repo.remotes[0].push(f"{local_branch}:{remote_branch}")
except Exception as err:
    print(err.stderr)

Activity

  1. jmcgill298 commented on Apr 21, 2021

    @jmcgill298
    jmcgill298
    on Apr 21, 2021
    ContributorAuthor
    More actions

    This was introduced by 5232c89 in #1202

  2. Byron
    added this to the v3.1.16 - Bugfixes milestone on Apr 22, 2021
  3. Byron
    closed this as completedin #1222on Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      • v3.1.16 - Bugfixes

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.