summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-05 17:06:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-05 17:06:24 -0400
commita5031031f0d596b2381a785925beb574d90a862e (patch)
treeeabdc9295a4b08313421f8eebd2ccce5c16c0e92
parent24d0821f6215fd1e93d97c597f727ab51329f727 (diff)
work around a very strange git-cat-file behavior
Sometimes it seems that git-cat-file --batch stops getting info for files in the current repo, when ":file" is fed to it. I have not reproduced this at the command line, but only when using git annex whereis and git annex move inside a direct mode repo. Those failed, because cat-file returned "file missing". OTOH, git annex find works fine, despite passing the same file to cat-file. It seems that the failing commands first asked cat-file to show a file on the git-annex branch. Perhaps it got "stuck" on that branch? But I cannot repoduce it running cat-file by hand. Most strange. HEAD is a workaround for this extreme weirdness, since I spent a good 2 hours struggling with it already.
-rw-r--r--Annex/CatFile.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Annex/CatFile.hs b/Annex/CatFile.hs
index ab7cb2aef..292d62460 100644
--- a/Annex/CatFile.hs
+++ b/Annex/CatFile.hs
@@ -56,7 +56,7 @@ catKey ref = do
{- From a file in git back to the key.
-
- Prefixing the file with ./ makes this work even if in a subdirectory
- - of a repo.
+ - of a repo. For some reason, HEAD is sometimes needed.
-}
catKeyFile :: FilePath -> Annex (Maybe Key)
-catKeyFile f = catKey $ Ref $ ":./" ++ f
+catKeyFile f = catKey $ Ref $ "HEAD:./" ++ f