dix original branch determation when testing adjusted branches
This commit is contained in:
parent
86968e366c
commit
fde6099c59
2 changed files with 23 additions and 19 deletions
31
Test.hs
31
Test.hs
|
@ -37,7 +37,6 @@ import qualified Git.Types
|
||||||
import qualified Git.Ref
|
import qualified Git.Ref
|
||||||
import qualified Git.LsTree
|
import qualified Git.LsTree
|
||||||
import qualified Git.FilePath
|
import qualified Git.FilePath
|
||||||
import qualified Git.Branch
|
|
||||||
import qualified Annex.Locations
|
import qualified Annex.Locations
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
import qualified Types.GitConfig
|
import qualified Types.GitConfig
|
||||||
|
@ -1503,8 +1502,7 @@ test_adjusted_branch_subtree_regression =
|
||||||
withtmpclonerepo $ \r -> whenM (adjustedbranchsupported r) $ do
|
withtmpclonerepo $ \r -> whenM (adjustedbranchsupported r) $ do
|
||||||
indir r $ do
|
indir r $ do
|
||||||
disconnectOrigin
|
disconnectOrigin
|
||||||
origbranch <- maybe "foo" (Git.Types.fromRef . Git.Ref.base)
|
origbranch <- annexeval origBranch
|
||||||
<$> annexeval (Annex.inRepo Git.Branch.current)
|
|
||||||
git_annex "upgrade" [] @? "upgrade failed"
|
git_annex "upgrade" [] @? "upgrade failed"
|
||||||
git_annex "adjust" ["--unlock", "--force"] @? "adjust failed"
|
git_annex "adjust" ["--unlock", "--force"] @? "adjust failed"
|
||||||
createDirectoryIfMissing True "a/b/c"
|
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
|
-- is in sync with the adjusted branch, which it may not be
|
||||||
-- depending on how the repository was set up.
|
-- depending on how the repository was set up.
|
||||||
commitchanges
|
commitchanges
|
||||||
currbranch <- maybe "foo" (Git.Types.fromRef . Git.Ref.base)
|
origbranch <- annexeval origBranch
|
||||||
<$> annexeval (Annex.inRepo Git.Branch.current)
|
git_annex "export" [origbranch, "--to", "foo"] @? "export to dir failed"
|
||||||
git_annex "export" [currbranch, "--to", "foo"] @? "export to dir failed"
|
|
||||||
dircontains annexedfile (content annexedfile)
|
dircontains annexedfile (content annexedfile)
|
||||||
|
|
||||||
writedir "import" (content "import")
|
writedir "import" (content "import")
|
||||||
git_annex "import" [currbranch, "--from", "foo"] @? "import from dir failed"
|
git_annex "import" [origbranch, "--from", "foo"] @? "import from dir failed"
|
||||||
git_annex "merge" ["foo/" ++ currbranch] @? "git annex merge failed"
|
git_annex "merge" ["foo/" ++ origbranch] @? "git annex merge failed"
|
||||||
annexed_present_imported "import"
|
annexed_present_imported "import"
|
||||||
|
|
||||||
nukeFile "import"
|
nukeFile "import"
|
||||||
writecontent "import" (content "newimport1")
|
writecontent "import" (content "newimport1")
|
||||||
git_annex "add" ["import"] @? "add of import failed"
|
git_annex "add" ["import"] @? "add of import failed"
|
||||||
commitchanges
|
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")
|
dircontains "import" (content "newimport1")
|
||||||
|
|
||||||
-- verify that export refuses to overwrite modified file
|
-- verify that export refuses to overwrite modified file
|
||||||
|
@ -1797,17 +1794,17 @@ test_export_import = intmpclonerepo $ do
|
||||||
writecontent "import" (content "newimport3")
|
writecontent "import" (content "newimport3")
|
||||||
git_annex "add" ["import"] @? "add of import failed"
|
git_annex "add" ["import"] @? "add of import failed"
|
||||||
commitchanges
|
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")
|
dircontains "import" (content "newimport2")
|
||||||
|
|
||||||
-- resolving import conflict
|
-- 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"
|
not <$> boolSystem "git" [Param "merge", Param "foo/master", Param "-mmerge"] @? "git merge of conflict failed to exit nonzero"
|
||||||
nukeFile "import"
|
nukeFile "import"
|
||||||
writecontent "import" (content "newimport3")
|
writecontent "import" (content "newimport3")
|
||||||
git_annex "add" ["import"] @? "add of import failed"
|
git_annex "add" ["import"] @? "add of import failed"
|
||||||
commitchanges
|
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")
|
dircontains "import" (content "newimport3")
|
||||||
where
|
where
|
||||||
dircontains f v =
|
dircontains f v =
|
||||||
|
@ -1855,15 +1852,13 @@ test_export_import_subdir = intmpclonerepo $ do
|
||||||
subannexedfile = "subdir" </> annexedfile
|
subannexedfile = "subdir" </> annexedfile
|
||||||
|
|
||||||
testexport = do
|
testexport = do
|
||||||
currbranch <- maybe "foo" (Git.Types.fromRef . Git.Ref.base)
|
origbranch <- annexeval origBranch
|
||||||
<$> annexeval (Annex.inRepo Git.Branch.current)
|
git_annex "export" [origbranch++":"++subdir, "--to", "foo"] @? "export of subdir failed"
|
||||||
git_annex "export" [currbranch++":"++subdir, "--to", "foo"] @? "export of subdir failed"
|
|
||||||
dircontains annexedfile (content annexedfile)
|
dircontains annexedfile (content annexedfile)
|
||||||
|
|
||||||
testimport = do
|
testimport = do
|
||||||
currbranch <- maybe "foo" (Git.Types.fromRef . Git.Ref.base)
|
origbranch <- annexeval origBranch
|
||||||
<$> annexeval (Annex.inRepo Git.Branch.current)
|
git_annex "import" [origbranch++":"++subdir, "--from", "foo"] @? "import of subdir failed"
|
||||||
git_annex "import" [currbranch++":"++subdir, "--from", "foo"] @? "import of subdir failed"
|
|
||||||
git_annex "merge" ["foo/master"] @? "git annex merge foo/master failed"
|
git_annex "merge" ["foo/master"] @? "git annex merge foo/master failed"
|
||||||
|
|
||||||
-- Make sure that import did not import the file to the top
|
-- Make sure that import did not import the file to the top
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{- git-annex test suite framework
|
{- git-annex test suite framework
|
||||||
-
|
-
|
||||||
- Copyright 2010-2019 Joey Hess <id@joeyh.name>
|
- Copyright 2010-2020 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -24,6 +24,8 @@ import qualified Backend
|
||||||
import qualified Git.CurrentRepo
|
import qualified Git.CurrentRepo
|
||||||
import qualified Git.Construct
|
import qualified Git.Construct
|
||||||
import qualified Git.Types
|
import qualified Git.Types
|
||||||
|
import qualified Git.Branch
|
||||||
|
import qualified Git.Ref
|
||||||
import qualified Types.KeySource
|
import qualified Types.KeySource
|
||||||
import qualified Types.Backend
|
import qualified Types.Backend
|
||||||
import qualified Types
|
import qualified Types
|
||||||
|
@ -591,3 +593,10 @@ getKey b f = case Types.Backend.getKey b of
|
||||||
, Types.KeySource.contentLocation = toRawFilePath f
|
, Types.KeySource.contentLocation = toRawFilePath f
|
||||||
, Types.KeySource.inodeCache = Nothing
|
, Types.KeySource.inodeCache = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{- Get the name of the original branch, eg the current branch, or
|
||||||
|
- if in an adjusted branch, the parent branch. -}
|
||||||
|
origBranch :: Types.Annex String
|
||||||
|
origBranch = maybe "foo"
|
||||||
|
(Git.Types.fromRef . Git.Ref.base . Annex.AdjustedBranch.fromAdjustedBranch)
|
||||||
|
<$> Annex.inRepo Git.Branch.current
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue