Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GitCommand errors are stringifying bytes in 3.1.15 #1220

Closed
@jmcgill298

Description

@jmcgill298

The 3.1.15 release changed at least howgit.exc.GitCommandError Errors are being generated. I have tested withstderr, but am guessing the same would be true forstdout. Previouslygit.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 'git@gitservice.com: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 \'git@gitservice.com:project/repo.git\'"\''

Steps to reproduce:

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

Steps to reproduce from code

import gitpath_to_repo = "my_project"repo = git.Repo(path_to_repo)local_branch = "invalid_branch"remote_branch = local_branch# Generate Error for Rebasetry:    repo.git.rebase(refspec=f"{remote_branch})"except Exception as err:    print(err.stderr)# Generate Error for Pushtry:    repo.remotes[0].push(f"{local_branch}:{remote_branch}")except Exception as err:    print(err.stderr)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp