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

Fix git getBranch [v1.65.0] #144449

Closed
wants to merge 1 commit into from
Closed

Conversation

cdce8p
Copy link

@cdce8p cdce8p commented Mar 5, 2022

Introduced with 6011bf7 in v1.65.0

Git getBranch will return an invalid upstreamRef if the local branch name doesn't match the upstream one.

Currently

Field
refname refs/heads/branch
upstream:short remote-name/remote-branch-name
upstream.name h-name
upstream.remote remote-name/remote-bran

New

Field Example
upstream:short remote-name/remote-branch-name
upstream:remotename remote-name
upstream:remoteref refs/heads/remote-branch-name

https://git-scm.com/docs/git-for-each-ref#Documentation/git-for-each-ref.txt-upstream

/CC: @lszomoru

Introduced with 6011bf7
Git getBranch will return an invalid upstreamRef
if local branch name doesn't match upstream branch name.
@lszomoru
Copy link
Member

lszomoru commented Mar 9, 2022

@cdce8p, thank you very much for filing the issue and for submitting a pull request with the fix. I have taken a look at the pull request and while the new fields address the regression, they are only available after in git 2.16 or later. For the time being, in order to provide immediate mitigation, I have reverted the commit that introduced the regression. I will then explore a better fix leveraging some of the fields used in this pull request.

@cdce8p
Copy link
Author

cdce8p commented Mar 9, 2022

@lszomoru Sounds good to me. Thanks for handling it! Would you like to leave this PR open? My particular issue is fixed with the revert, so I don't personally wouldn't need it. Please feel free to close it otherwise.

@lszomoru
Copy link
Member

lszomoru commented Apr 7, 2022

Manually ported these changes in cb1851d factoring in the version of git.

@lszomoru lszomoru added the git GIT issues label Apr 7, 2022
@lszomoru lszomoru added this to the April 2022 milestone Apr 7, 2022
@lszomoru lszomoru added the on-release-notes Issue/pull request mentioned in release notes label Apr 7, 2022
@lszomoru lszomoru closed this Apr 7, 2022
@cdce8p cdce8p deleted the fix-git-getBranch branch April 7, 2022 16:59
@cdce8p
Copy link
Author

cdce8p commented Apr 13, 2022

Thanks @lszomoru! I've tested the last insider version and everything still seems to work as expected.

@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
git GIT issues on-release-notes Issue/pull request mentioned in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants