From a5031031f0d596b2381a785925beb574d90a862e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 5 Jan 2013 17:06:24 -0400 Subject: 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. --- Annex/CatFile.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Annex') 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 -- cgit v1.2.3