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.
This commit is contained in:
Joey Hess 2013-01-05 17:06:24 -04:00
parent aedfcde969
commit 1c83b6c439

View file

@ -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