propigateAdjustedCommits: avoid overwriting diverged original branch
Bug fix: Re-running git-annex adjust or sync when in an adjusted branch would overwrite the original branch, losing any commits that had been made to it since the adjusted branch was created. When git-annex adjust is run in this situation, it will display a warning about the diverged branches. When git-annex sync is run in this situation, mergeToAdjustedBranch will merge the changes from the original branch to the adjusted branch. So it does not need to display the divergence warning. Note that for some reason, I'm needing to run sync twice for that to happen. The first run does not do the merge and the second does. I'm unsure why and so am not fully done with this bug. Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
parent
fc1fcc7491
commit
adb09117f1
5 changed files with 66 additions and 13 deletions
|
@ -0,0 +1,33 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2023-07-05T19:49:19Z"
|
||||
content="""
|
||||
Simplified test case:
|
||||
|
||||
git init tc
|
||||
cd tc
|
||||
git-annex init
|
||||
echo 1 > foo
|
||||
git-annex add
|
||||
git commit -m add
|
||||
git annex adjust --unlock
|
||||
git checkout master
|
||||
rm foo
|
||||
echo 2 > foo
|
||||
git-annex add
|
||||
git commit -m "this commit will be lost"
|
||||
git checkout 'adjusted/master(unlocked)'
|
||||
git annex adjust --unlock # or git-annex sync
|
||||
git log master
|
||||
|
||||
What an unfortunate oversight! And it's not a reversion, it's been there
|
||||
since the beginning of adjusted branches.
|
||||
|
||||
git-annex adjust should display a warning message in that situation,
|
||||
since the original branch has diverged from the adjusted branch.
|
||||
|
||||
And git-annex sync should be able to resolve the divergence by
|
||||
auto-merging the changes from the original branch into the adjusted
|
||||
branch.
|
||||
"""]]
|
|
@ -0,0 +1,11 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 2"""
|
||||
date="2023-07-05T21:01:53Z"
|
||||
content="""
|
||||
I've fixed the data loss part of this bug.
|
||||
|
||||
`git-annex sync` is able to resolve the divergence too. But for some
|
||||
reason, the first time it's run after the divergence, it leaves it
|
||||
diverged, and the second time it resolves it. That needs to be fixed.
|
||||
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue