From 01111895034873f6b65fcd2ebb86a95de4e6a9e8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 3 Oct 2013 15:06:58 -0400 Subject: rename confusing function The index.lck file is not a lock file. Kept the historical name for now as changing it would be work. --- Annex/Branch.hs | 14 +++++++------- Locations.hs | 12 +++++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Annex/Branch.hs b/Annex/Branch.hs index a3cb8aa72..8c8aef7d6 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -351,18 +351,18 @@ forceUpdateIndex branchref = do {- Checks if the index needs to be updated. -} needUpdateIndex :: Git.Ref -> Annex Bool needUpdateIndex branchref = do - lock <- fromRepo gitAnnexIndexLock - lockref <- Git.Ref . firstLine <$> - liftIO (catchDefaultIO "" $ readFileStrict lock) - return (lockref /= branchref) + f <- fromRepo gitAnnexIndexStatus + committedref <- Git.Ref . firstLine <$> + liftIO (catchDefaultIO "" $ readFileStrict f) + return (committedref /= branchref) {- Record that the branch's index has been updated to correspond to a - given ref of the branch. -} setIndexSha :: Git.Ref -> Annex () setIndexSha ref = do - lock <- fromRepo gitAnnexIndexLock - liftIO $ writeFile lock $ show ref ++ "\n" - setAnnexPerm lock + f <- fromRepo gitAnnexIndexStatus + liftIO $ writeFile f $ show ref ++ "\n" + setAnnexPerm f {- Stages the journal into the index and returns an action that will - clean up the staged journal files, which should only be run once diff --git a/Locations.hs b/Locations.hs index 2e9fd574a..3ef5d7072 100644 --- a/Locations.hs +++ b/Locations.hs @@ -35,7 +35,7 @@ module Locations ( gitAnnexJournalDir, gitAnnexJournalLock, gitAnnexIndex, - gitAnnexIndexLock, + gitAnnexIndexStatus, gitAnnexIgnoredRefs, gitAnnexPidFile, gitAnnexDaemonStatusFile, @@ -223,10 +223,12 @@ gitAnnexJournalLock r = gitAnnexDir r "journal.lck" gitAnnexIndex :: Git.Repo -> FilePath gitAnnexIndex r = gitAnnexDir r "index" -{- Lock file for .git/annex/index. Not to be confused with git's - - index.lock. -} -gitAnnexIndexLock :: Git.Repo -> FilePath -gitAnnexIndexLock r = gitAnnexDir r "index.lck" +{- Holds the ref of the git-annex branch that the index was last updated to. + - + - The .lck in the name is a historical accident; this is not used as a + - lock. -} +gitAnnexIndexStatus :: Git.Repo -> FilePath +gitAnnexIndexStatus r = gitAnnexDir r "index.lck" {- List of refs that should not be merged into the git-annex branch. -} gitAnnexIgnoredRefs :: Git.Repo -> FilePath -- cgit v1.2.3