diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-21 00:49:48 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-21 00:49:48 -0400 |
commit | 084aba8aaf43fed5d9c694c19ff1cd53e7b16bc8 (patch) | |
tree | 2f33fea02008cbbe6e63e76a8ff74520bce492bf | |
parent | 240711d1aeada93172f98e1686593e4ac634450a (diff) |
fix breakage caught by test suite
Can't use show-ref --tags --branches, as that omits remote branches.
Instead, filter out the synced refs directly.
-rw-r--r-- | Assistant/Sync.hs | 2 | ||||
-rw-r--r-- | Command/Unused.hs | 7 | ||||
-rw-r--r-- | test.hs | 18 |
3 files changed, 13 insertions, 14 deletions
diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs index 326baff78..91ee1c219 100644 --- a/Assistant/Sync.hs +++ b/Assistant/Sync.hs @@ -138,7 +138,7 @@ pushToRemotes threadname now st mpushmap remotes = do refspec b = concat [ s , ":" - , "refs" </> "synced" </> fromUUID u </> s + , "refs/synced/" ++ fromUUID u ++ "/" ++ s ] where s = show $ Git.Ref.base b diff --git a/Command/Unused.hs b/Command/Unused.hs index f5eb4b7dd..91b21afa5 100644 --- a/Command/Unused.hs +++ b/Command/Unused.hs @@ -251,16 +251,15 @@ withKeysReferencedInGit a = do rs <- relevantrefs <$> showref forM_ rs (withKeysReferencedInGitRef a) where - {- List heads and tags, but not other refs used in syncing. -} - showref = inRepo $ Git.Command.pipeRead - [Param "show-ref", Param "--heads", Param "--tags"] + showref = inRepo $ Git.Command.pipeRead [Param "show-ref"] relevantrefs = map (Git.Ref . snd) . nubBy uniqref . filter ourbranches . map (separate (== ' ')) . lines uniqref (x, _) (y, _) = x == y ourbranchend = '/' : show Annex.Branch.name - ourbranches (_, b) = not $ ourbranchend `isSuffixOf` b + ourbranches (_, b) = not (ourbranchend `isSuffixOf` b) + && not ("refs/synced/" `isPrefixOf` b) withKeysReferencedInGitRef :: (Key -> Annex ()) -> Git.Ref -> Annex () withKeysReferencedInGitRef a ref = do @@ -475,33 +475,33 @@ test_unused = "git-annex unused/dropunused" ~: intmpclonerepo $ do sha1annexedfilekey <- annexeval $ findkey sha1annexedfile git_annex "get" [annexedfile] @? "get of file failed" git_annex "get" [sha1annexedfile] @? "get of file failed" - checkunused [] + checkunused [] "after get" boolSystem "git" [Params "rm -q", File annexedfile] @? "git rm failed" - checkunused [] + checkunused [] "after rm" boolSystem "git" [Params "commit -q -m foo"] @? "git commit failed" - checkunused [] + checkunused [] "after commit" -- unused checks origin/master; once it's gone it is really unused boolSystem "git" [Params "remote rm origin"] @? "git remote rm origin failed" - checkunused [annexedfilekey] + checkunused [annexedfilekey] "after origin branches are gone" boolSystem "git" [Params "rm -q", File sha1annexedfile] @? "git rm failed" boolSystem "git" [Params "commit -q -m foo"] @? "git commit failed" - checkunused [annexedfilekey, sha1annexedfilekey] + checkunused [annexedfilekey, sha1annexedfilekey] "after rm sha1annexedfile" -- good opportunity to test dropkey also git_annex "dropkey" ["--force", Types.Key.key2file annexedfilekey] @? "dropkey failed" - checkunused [sha1annexedfilekey] + checkunused [sha1annexedfilekey] ("after dropkey --force " ++ Types.Key.key2file annexedfilekey) git_annex "dropunused" ["1", "2"] @? "dropunused failed" - checkunused [] + checkunused [] "after dropunused" git_annex "dropunused" ["10", "501"] @? "dropunused failed on bogus numbers" where - checkunused expectedkeys = do + checkunused expectedkeys desc = do git_annex "unused" [] @? "unused failed" unusedmap <- annexeval $ Logs.Unused.readUnusedLog "" let unusedkeys = M.elems unusedmap - assertEqual "unused keys differ" + assertEqual ("unused keys differ " ++ desc) (sort expectedkeys) (sort unusedkeys) findkey f = do r <- Backend.lookupFile f |