Title: GitCommand errors are stringifying bytes in 3.1.15 · Issue #1220 · gitpython-developers/GitPython · GitHub
Open Graph Title: GitCommand errors are stringifying bytes in 3.1.15 · Issue #1220 · gitpython-developers/GitPython
X Title: GitCommand errors are stringifying bytes in 3.1.15 · Issue #1220 · gitpython-developers/GitPython
Description: 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...
Open Graph Description: 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.GitComma...
X Description: 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.GitComma...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/1220
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"GitCommand errors are stringifying bytes in 3.1.15","articleBody":"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.\r\n\r\nrepo.git.rebase Error:\r\n * 3.1.14-stderr = `\"\\n stderr: 'fatal: invalid upstream 'invalid_branch''\"`\r\n * 3.1.15-stderr = `'\\n stderr: \\'b\"fatal: invalid upstream \\'invalid_branch\\'\"\\''`\r\n\r\nremote.push Error:\r\n * 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''\"`\r\n * 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\\'\"\\''`\r\n\r\nSteps to reproduce:\r\n```\r\nimport git\r\n\r\nexception = git.exc.CommandError(command=\"git rebase invalid_branch\".split(), stderr=b\"abc\")\r\nexception.stderr\r\n```\r\n\r\nSteps to reproduce from code\r\n```\r\nimport git\r\n\r\npath_to_repo = \"my_project\"\r\nrepo = git.Repo(path_to_repo)\r\n\r\nlocal_branch = \"invalid_branch\"\r\nremote_branch = local_branch\r\n\r\n# Generate Error for Rebase\r\ntry:\r\n repo.git.rebase(refspec=f\"{remote_branch})\"\r\nexcept Exception as err:\r\n print(err.stderr)\r\n\r\n# Generate Error for Push\r\ntry:\r\n repo.remotes[0].push(f\"{local_branch}:{remote_branch}\")\r\nexcept Exception as err:\r\n print(err.stderr)\r\n```\r\n","author":{"url":"https://github.com/jmcgill298","@type":"Person","name":"jmcgill298"},"datePublished":"2021-04-21T14:29:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1220/GitPython/issues/1220"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d3d9a651-0e00-248d-75ee-5b6cd9ea3a5c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 91C6:C198F:C0A2EF:10446A8:6969EB09 |
| html-safe-nonce | a2c06173c340a7c274169ddfdf257c53caf2551827e21de38ad2381d3dd6f962 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUM2OkMxOThGOkMwQTJFRjoxMDQ0NkE4OjY5NjlFQjA5IiwidmlzaXRvcl9pZCI6IjU4NTU0NDg1MzEyNDQ1NDI3MjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d576531f905991fae8cd8271f8048e7afdd5c73cb39ff2d4ef14111eb075a4ee |
| hovercard-subject-tag | issue:863954814 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/GitPython/1220/issue_layout |
| twitter:image | https://opengraph.githubassets.com/657e71306ad8deb88ac181369a2912c66a5fcff051d680d94cc36bd60899fcaa/gitpython-developers/GitPython/issues/1220 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/657e71306ad8deb88ac181369a2912c66a5fcff051d680d94cc36bd60899fcaa/gitpython-developers/GitPython/issues/1220 |
| og:image:alt | 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.GitComma... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jmcgill298 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width