Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: lstrip in get_upstream_branch function #848

Closed
rrao24 opened this issue Dec 21, 2020 · 1 comment
Closed

Bug: lstrip in get_upstream_branch function #848

rrao24 opened this issue Dec 21, 2020 · 1 comment

Comments

@rrao24
Copy link
Contributor

rrao24 commented Dec 21, 2020

There is a bug in the get_upstream_branch() function concerning the usage of lstrip() on line 1107

remote_branch = rev_parse_output.strip().lstrip(remote_name + "/")

Say that line 1106

remote_name = output.strip()
evaluates to origin (as it must do so commonly). The subsequent line will attempt to transform the full remote branch name (remote name + branch name) into just the branch name. If you have a branch name which starts with any combination of the characters o,r,i,g,n, then lstrip() can potentially strip those characters away as well.

For example, given remote_name = origin, and rev_parse_output = origin/games, "origin/games".lstrip("origin/") will evaluate to "ames", causing the wrong branch to be pushed. This bug should be fairly easy to reproduce.

EDIT: Opened #849 for fix

@fcollonval
Copy link
Member

Fixed by #849

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants