-
Notifications
You must be signed in to change notification settings - Fork 282
Added support to specify '-b branch@commit' #659
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
base: master
Are you sure you want to change the base?
Conversation
Current implementation already allows for specifying explicit commits like '-b commit' to pin subrepo sources (i.e during subrepo clone/pull). In that case, it also sets the name of the branch in the subrepo merge commit message and inside .gitrepo file to that commit hash. This addition allows for specifying both branch and commit. During the subrepo fetch phase, the commit is checked against the specified branch. If the requested commit can be reached from the head of the requested branch, the subrepo is re-fetched to that commit. Afterwards command processing remains the same, except that given branch name is written to the subrepo clone/pull commit message and into the .gitrepo file. The commit part of the '-b branch@commit' request may be abbreviated to the reasonable extent.
|
Would you be willing to add tests for this? |
|
I could try - it'll take a while. What would be the essential test scenario(s) in your opinion? |
|
Off the top of my head:
I am probably missing some variations, but that is a good start. |
|
Thanks for the suggestion. |
When branch@commit is requested in clone, fetch and pull commands, show that in their output as well.
It does the following: 1. Clone default test repos foo and bar 2. Create a new branch bar1 in bar 3. In bar create three additional commits in bar1 4. Checkout default branch in bar (to allow for later push) 5. In foo subrepo clone of bar1@commit1 from bar 6. Test clone results 7. In foo subrepo pull of bar1@commit2 from bar 8. Test pull results 9. Make additional change in foo/bar 10. In foo subrepo push bar and test result (push fails) 11. In foo force subrepo clone bar@commit3 (last commit in bar1) 12. Re-make additional change in foo/bar 13. In foo subrepo push bar and test result (push success) 13. In foo subrepo pull bar1 from bar and test result (up to date) 14. In foo subrepo pull bar1@commit2 (fails - old commit) 15. In foo subrepo clone bar1@commit2 (fails - subrepo exists)
|
Hi, i prepared initial tests for using branch@commit. I tried to follow your test scenario suggestions:) |
|
@admorgan hi, any comments regarding proposed tests? |
|
I haven't looked really close because they are failing. Look at the output to see suggestions from shellcheck on what I believe will address most of the issues. |
|
@admorgan hi, thanks for the reply. I fixed the pre-commit check, however tests are still failing (encode.t). Not on my behalf, i believe:) |
Current implementation already allows for specifying explicit commits like '-b commit' to pin subrepo sources (i.e during subrepo clone/pull). In that case, it also sets the name of the branch in the subrepo merge commit message and inside .gitrepo file to that commit hash. This addition allows for specifying both branch and commit. During the subrepo fetch phase, the commit is checked against the specified branch. If the requested commit can be reached from the head of the requested branch, the subrepo is re-fetched to that commit.
Afterwards command processing remains the same, except that given branch name is written to the subrepo clone/pull commit message and into the .gitrepo file.
The commit part of the '-b branch@commit' request may be abbreviated to the reasonable extent.