fix test failure with git version 2.34.0
authorJoey Hess <joeyh@joeyh.name>
Mon, 22 Nov 2021 17:28:20 +0000 (13:28 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 22 Nov 2021 17:30:03 +0000 (13:30 -0400)
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.

Test.hs
doc/bugs/git_2.34__58___some_conflict_resolution_unit_tests_fail/comment_2_980556f1f7b339519593f9ead85ab854._comment [new file with mode: 0644]

diff --git a/Test.hs b/Test.hs
index 3d0f02ef89b9f2285f8a0c486003c2934e8b6632..6ec56b1b286b379b5983a79d6367a79efc72c88b 100644 (file)
--- a/Test.hs
+++ b/Test.hs
@@ -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
diff --git a/doc/bugs/git_2.34__58___some_conflict_resolution_unit_tests_fail/comment_2_980556f1f7b339519593f9ead85ab854._comment b/doc/bugs/git_2.34__58___some_conflict_resolution_unit_tests_fail/comment_2_980556f1f7b339519593f9ead85ab854._comment
new file mode 100644 (file)
index 0000000..00d768a
--- /dev/null
@@ -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.
+"""]]