From ba744c84a4f683e50bf4c9b8c388e3a611f7fb91 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 16 Sep 2012 23:09:08 -0400 Subject: better name for fallback sync refs Don't expose these as branches in refs/heads/. Instead hide them away in refs/synced/ where only show-ref will find them. Make unused only look at branches and tags, not these other things, so it won't care if some stale sync ref used to use a file. This means they don't need to be deleted, which could have led to an incoming sync being missed. --- Assistant/Sync.hs | 8 ++++---- Assistant/Threads/Merger.hs | 18 ++++++------------ 2 files changed, 10 insertions(+), 16 deletions(-) (limited to 'Assistant') diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs index b78a2a5a4..326baff78 100644 --- a/Assistant/Sync.hs +++ b/Assistant/Sync.hs @@ -90,7 +90,7 @@ pushToRemotes threadname now st mpushmap remotes = do go True branch g u remotes where go _ Nothing _ _ _ = return True -- no branch, so nothing to do - go shouldretry (Just branch) g u rs = do + go shouldretry (Just branch) g u rs = do debug threadname [ "pushing to" , show rs @@ -133,12 +133,12 @@ pushToRemotes threadname now st mpushmap remotes = do , Param $ refspec branch ] g where + {- Push to refs/synced/uuid/branch; this + - avoids cluttering up the branch display. -} refspec b = concat [ s , ":" - , show $ Git.Ref.base $ - Command.Sync.syncBranch $ Git.Ref $ - "fallback" fromUUID u s + , "refs" "synced" fromUUID u s ] where s = show $ Git.Ref.base b diff --git a/Assistant/Threads/Merger.hs b/Assistant/Threads/Merger.hs index 52db625cd..ce1ff1c7b 100644 --- a/Assistant/Threads/Merger.hs +++ b/Assistant/Threads/Merger.hs @@ -15,18 +15,17 @@ import qualified Annex.Branch import qualified Git import qualified Git.Merge import qualified Git.Branch -import qualified Git.Command as Git thisThread :: ThreadName thisThread = "Merger" -{- This thread watches for changes to .git/refs/heads/synced/, - - which indicate incoming pushes. It merges those pushes into the - - currently checked out branch. -} +{- This thread watches for changes to .git/refs/, looking for + - incoming pushes. It merges those pushes into the currently + - checked out branch. -} mergeThread :: ThreadState -> NamedThread mergeThread st = thread $ do g <- runThreadState st $ fromRepo id - let dir = Git.localGitDir g "refs" "heads" "synced" + let dir = Git.localGitDir g "refs" createDirectoryIfMissing True dir let hook a = Just $ runHandler g a let hooks = mkWatchHooks @@ -82,11 +81,6 @@ onAdd g file _ , show current ] void $ Git.Merge.mergeNonInteractive changedbranch g - when ("fallback/" `isInfixOf` (show changedbranch)) $ - void $ Git.runBool "branch" - [ Param "-D" - , Param $ show changedbranch - ] g go _ = noop equivBranches :: Git.Ref -> Git.Ref -> Bool @@ -100,6 +94,6 @@ isAnnexBranch f = n `isSuffixOf` f n = "/" ++ show Annex.Branch.name fileToBranch :: FilePath -> Git.Ref -fileToBranch f = Git.Ref $ "refs" "heads" base +fileToBranch f = Git.Ref $ "refs" base where - base = Prelude.last $ split "/refs/heads/" f + base = Prelude.last $ split "/refs/" f -- cgit v1.2.3