-
Notifications
You must be signed in to change notification settings - Fork 274
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 remote & branch being overwritten in .gitrepo without --update
flag set
#545
base: release/0.4.5
Are you sure you want to change the base?
Fix remote & branch being overwritten in .gitrepo without --update
flag set
#545
Conversation
@ingydotnet @admorgan Pinging in case there's a chance you may look at this 🙏 |
I am in the middle of a big release, but looking at this is certainly in on my TODO list. |
There have been a few discussions about changing the branch and remote on a push/pull. My recollection is that @ingydotnet has expressed this is intentional. Let's break this down. git subrepo pull, it seems disingenuous to have a .gitrepo file that says the code is from a remote and branch that distinctly isn't after doing a git pull -b . It is likely that the commit SHA won't even be on the branch the .gitrepo points to and therefore future git subrepo actions will fail for good reason, and be very hard to diagnose. git subrepo push, I personally don't use push because many of the projects I use git subrepo with require the patch to go through change-control, or review that change the patch (sign-off trailers if nothing else) before it is added to the remove repository. Therefore any git push to a project that uses gerrit will never work as expected. I also see an issue because push creates a commit that "finalizes" the syncing process, but again the branch and/or remote will not represent that sync. I like patches 3e17a77 and 6b4a4e4, but not forcing forcing --update when doing a push or pull would require more work in my opinion. |
@admorgan I'm not against trying another way to achieve the above use case, if the current behavior is deemed to be more correct. Instead of mimicking default git behavior with an opt-in |
I agree with your conclusion. a --no-update flag makes more sense in this case. I would accept such a patch. |
The bug was that in this code:
Command
if [[ $update_wanted ]]
will always succeed, even thoughupdate_wanted
isfalse
, because[[
only checks that the string is not empty. Unfortunately, the tests didn't catch the fact that remote/branch were always updated due to this, so I've added some minimal checks that would fail before the fix.cc @admorgan I've set the base to
release/0.4.5
as you asked of the other pending PRs, in case this could help release the fix sooner.