diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-17 14:52:12 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-17 14:52:12 -0400 |
commit | 7d5c56d93296976fbcd8d51726f786fefc72defa (patch) | |
tree | 915e9d2a5a928d3c4d8f1b93692eef6b95c2f424 /Command/PreCommit.hs | |
parent | 48e68fdac3fb1198d29af7404ffadbae46b79994 (diff) |
update for DiffTree change
This actually fixes a bug; if pre-commit was run in a subdir, it would pass
relative files when updating the associated file maps, and so the maps
wouldn't update.
I don't think this bug happened in practice, due to the way pre-commit is
called by the hook. It happened to chdir to the top of the work tree.
Diffstat (limited to 'Command/PreCommit.hs')
-rw-r--r-- | Command/PreCommit.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs index 0943c0da7..f10ac628e 100644 --- a/Command/PreCommit.hs +++ b/Command/PreCommit.hs @@ -16,6 +16,7 @@ import qualified Git.Ref import Annex.CatFile import Annex.Content.Direct import Git.Sha +import Git.FilePath def :: [Command] def = [command "pre-commit" paramPaths seek SectionPlumbing @@ -40,10 +41,11 @@ startIndirect file = next $ do startDirect :: [String] -> CommandStart startDirect _ = next $ do (diffs, clean) <- inRepo $ Git.DiffTree.diffIndex Git.Ref.headRef - forM_ diffs go + makeabs <- flip fromTopFilePath <$> gitRepo + forM_ diffs (go makeabs) next $ liftIO clean where - go diff = do + go makeabs diff = do withkey (Git.DiffTree.srcsha diff) (Git.DiffTree.srcmode diff) removeAssociatedFile withkey (Git.DiffTree.dstsha diff) (Git.DiffTree.dstmode diff) addAssociatedFile where @@ -51,4 +53,5 @@ startDirect _ = next $ do k <- catKey sha mode case k of Nothing -> noop - Just key -> void $ a key (Git.DiffTree.file diff) + Just key -> void $ a key $ + makeabs $ Git.DiffTree.file diff |