Skip to content

fix issue with .gitrepo parent field not being updated when using pu… #547

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tsadiko74
Copy link

@tsadiko74 tsadiko74 commented Oct 24, 2021

fix issue with .gitrepo parent field not being updated when using git pull --rebase (or if that option was set in git config) on a diverged parent repo

In case of a git pull using rebase on the parent repository , the field subrepo.parent SHA-1 could be wrong.
That would cause an error on the next git subrepo pull command , the workaround requires manual change of the .subrepo file, This proposed commit fixes that issue

it may also be applicable for this reported issue -- #539 (comment)

@tsadiko74
Copy link
Author

BTW , I ran the test suite , all tests passed

@tsadiko74
Copy link
Author

@admorgan , got a message that there is 1 workflow awaiting approval . could you please approve ?
Also , Hope to get a feedback on this PR

Copy link
Collaborator

@admorgan admorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The big question is what state is the repository in after a rebase. I personally believe this will work out 99.9% of the time. I also don't know how to reliably determine the 0.1% it wouldn't. I feel like this is a positive change, but I am curious what @ingydotnet thinks.

# In case of pull using rebase, the field subrepo.parent SHA-1 could be wrong.
#FAIL=false \
#SAY=false OUT=true RUN git config --file="$gitrepo" subrepo.parent
#subrepo_parent=$output
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to remove commented out old code

# Finding the right parent SHA-1
SAY=false OUT=true RUN git log --oneline --pretty=format:"%h" -- "$gitrepo"
gitrepo_commit_list=$output
found_comm="Empty"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code base likes everything spelled out, I would prefer found_comm be renamed to common_sha or something fully spelled out.

fi
done
if [ "$found_comm" != "Empty" ]; then
SAY=false OUT=true RUN git rev-parse "$comm^"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree that this would be the logical parent. I believe it would be the value + parent found in the grep on line 1365.

@trueqbit
Copy link

trueqbit commented Jun 3, 2022

@ingydotnet How does it go with this proposed PR? Recently I am constantly in the situation where I can't push changes anymore because git-subrepo thinks that there are no commits. I have to pull by force and reapply all the changes that the resulting commit reverted.

@karptonite
Copy link

Just popping in to say that I'd love to see this get merged, if the maintainers think it solved the issue!

@ingydotnet
Copy link
Owner

I'll talk to @admorgan about it soon.

@Amatewasu
Copy link

(Just wanted to drop in and show my interest in this getting merged if the maintainers believe it's resolved the issue. Thank you a lot!)

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

Successfully merging this pull request may close these issues.

6 participants