dix original branch determation when testing adjusted branches

This commit is contained in:
Joey Hess 2020-06-23 17:41:50 -04:00
parent 86968e366c
commit fde6099c59
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 23 additions and 19 deletions

31
Test.hs
View file

@ -37,7 +37,6 @@ import qualified Git.Types
import qualified Git.Ref
import qualified Git.LsTree
import qualified Git.FilePath
import qualified Git.Branch
import qualified Annex.Locations
#ifndef mingw32_HOST_OS
import qualified Types.GitConfig
@ -1503,8 +1502,7 @@ test_adjusted_branch_subtree_regression =
withtmpclonerepo $ \r -> whenM (adjustedbranchsupported r) $ do
indir r $ do
disconnectOrigin
origbranch <- maybe "foo" (Git.Types.fromRef . Git.Ref.base)
<$> annexeval (Annex.inRepo Git.Branch.current)
origbranch <- annexeval origBranch
git_annex "upgrade" [] @? "upgrade failed"
git_annex "adjust" ["--unlock", "--force"] @? "adjust failed"
createDirectoryIfMissing True "a/b/c"
@ -1774,21 +1772,20 @@ test_export_import = intmpclonerepo $ do
-- is in sync with the adjusted branch, which it may not be
-- depending on how the repository was set up.
commitchanges
currbranch <- maybe "foo" (Git.Types.fromRef . Git.Ref.base)
<$> annexeval (Annex.inRepo Git.Branch.current)
git_annex "export" [currbranch, "--to", "foo"] @? "export to dir failed"
origbranch <- annexeval origBranch
git_annex "export" [origbranch, "--to", "foo"] @? "export to dir failed"
dircontains annexedfile (content annexedfile)
writedir "import" (content "import")
git_annex "import" [currbranch, "--from", "foo"] @? "import from dir failed"
git_annex "merge" ["foo/" ++ currbranch] @? "git annex merge failed"
git_annex "import" [origbranch, "--from", "foo"] @? "import from dir failed"
git_annex "merge" ["foo/" ++ origbranch] @? "git annex merge failed"
annexed_present_imported "import"
nukeFile "import"
writecontent "import" (content "newimport1")
git_annex "add" ["import"] @? "add of import failed"
commitchanges
git_annex "export" [currbranch, "--to", "foo"] @? "export modified file to dir failed"
git_annex "export" [origbranch, "--to", "foo"] @? "export modified file to dir failed"
dircontains "import" (content "newimport1")
-- verify that export refuses to overwrite modified file
@ -1797,17 +1794,17 @@ test_export_import = intmpclonerepo $ do
writecontent "import" (content "newimport3")
git_annex "add" ["import"] @? "add of import failed"
commitchanges
git_annex_shouldfail "export" [currbranch, "--to", "foo"] @? "export failed to fail in conflict"
git_annex_shouldfail "export" [origbranch, "--to", "foo"] @? "export failed to fail in conflict"
dircontains "import" (content "newimport2")
-- resolving import conflict
git_annex "import" [currbranch, "--from", "foo"] @? "import from dir failed"
git_annex "import" [origbranch, "--from", "foo"] @? "import from dir failed"
not <$> boolSystem "git" [Param "merge", Param "foo/master", Param "-mmerge"] @? "git merge of conflict failed to exit nonzero"
nukeFile "import"
writecontent "import" (content "newimport3")
git_annex "add" ["import"] @? "add of import failed"
commitchanges
git_annex "export" [currbranch, "--to", "foo"] @? "export failed after import conflict"
git_annex "export" [origbranch, "--to", "foo"] @? "export failed after import conflict"
dircontains "import" (content "newimport3")
where
dircontains f v =
@ -1855,15 +1852,13 @@ test_export_import_subdir = intmpclonerepo $ do
subannexedfile = "subdir" </> annexedfile
testexport = do
currbranch <- maybe "foo" (Git.Types.fromRef . Git.Ref.base)
<$> annexeval (Annex.inRepo Git.Branch.current)
git_annex "export" [currbranch++":"++subdir, "--to", "foo"] @? "export of subdir failed"
origbranch <- annexeval origBranch
git_annex "export" [origbranch++":"++subdir, "--to", "foo"] @? "export of subdir failed"
dircontains annexedfile (content annexedfile)
testimport = do
currbranch <- maybe "foo" (Git.Types.fromRef . Git.Ref.base)
<$> annexeval (Annex.inRepo Git.Branch.current)
git_annex "import" [currbranch++":"++subdir, "--from", "foo"] @? "import of subdir failed"
origbranch <- annexeval origBranch
git_annex "import" [origbranch++":"++subdir, "--from", "foo"] @? "import of subdir failed"
git_annex "merge" ["foo/master"] @? "git annex merge foo/master failed"
-- Make sure that import did not import the file to the top