fix test failure with git version 2.34.0

The new "ort" resolver uses different filenames than what the test suite
accepted when resolving a conflict between a directory an an annexed
file. Make the test looser in what it accepts, so it will work with old
and new git.

Other tests still look for "conflictor.variant" as a prefix,
because when eg resolving a conflicted merge of 2 annexed files,
the filename is not changed by the ort resolver, and I didn't want to
unncessarily loosen the test.

Also I'm not entirely happy with the filenames used by the ort resolver,
see comment.

There's still another test failure caused by that resolver that is not
fixed yet.
This commit is contained in:
Joey Hess 2021-11-22 13:28:20 -04:00
parent e2da89ba49
commit c49787824c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 36 additions and 2 deletions

View file

@ -64,6 +64,7 @@ import qualified Annex.Init
import qualified Annex.CatFile
import qualified Annex.Path
import qualified Annex.VectorClock
import qualified Annex.VariantFile
import qualified Annex.AdjustedBranch
import qualified Annex.View
import qualified Annex.View.ViewedFile
@ -1369,12 +1370,11 @@ test_mixed_conflict_resolution = do
checkmerge "r2" r2
conflictor = "conflictor"
subfile = conflictor </> "subfile"
variantprefix = conflictor ++ ".variant"
checkmerge what d = do
doesDirectoryExist (d </> conflictor)
@? (d ++ " conflictor directory missing")
l <- getDirectoryContents d
let v = filter (variantprefix `isPrefixOf`) l
let v = filter (Annex.VariantFile.variantMarker `isInfixOf`) l
not (null v)
@? (what ++ " conflictor variant file missing in: " ++ show l )
length v == 1

View file

@ -0,0 +1,34 @@
[[!comment format=mdwn
username="joey"
subject="""comment 2"""
date="2021-11-22T16:32:10Z"
content="""
The difference in behavior, when there's a conflict between a directory and a
file, is that the recursive strategy leaves the directory in "added by them"
conflict state, as well as adding the file with a different name
(and oddly, not staging it at all), while
the ort strategy leaves does not flag the directory as in conflict,
and makes the file be in "added by them" conflict state.
`git-annex sync` resolves such a conflict adequately, with the new version
of git, but the name of the file turns out different, eg
"foo~refs_remotes_origin_master.variant-b66a"
or "foo~HEAD.variant-b66a" rather than
"foo.variant-b66a". That happens only in such a mixed conflict,
a conflict between two annexed files still gets the shorter name
like "foo.variant-b66a".
There's a small problem with a lack of a stable name being used, as shown
above the name of the branch being merged from or to is used by git as part
of the filename. So two people who resolve a merge this way would end up
with two different names for the file. git-annex's merge conflict
resolution is designed to yield a stable result no matter where it's run,
so this behavior is a bit of a shame, but it's git's decision to behave
that way, and I guess the same thing can happen when not using git-annex,
if you commit what the new resolver stages. So this can be considered not a
git-annex problem.
I've adjusted the mixed conflict resolution test to accept these new names
while also still working with the old names. That fixes that one. The other
test is still failing.
"""]]