diff --git a/GitRepo.hs b/GitRepo.hs index f489dfe35d..24bc9b5c2b 100644 --- a/GitRepo.hs +++ b/GitRepo.hs @@ -77,7 +77,7 @@ import Data.Char import Data.Word (Word8) import Codec.Binary.UTF8.String (encode) import Text.Printf -import Data.List (isInfixOf, isPrefixOf) +import Data.List (isInfixOf, isPrefixOf, isSuffixOf) import System.Exit import Utility @@ -111,10 +111,24 @@ repoFromAbsPath dir | "/" `isPrefixOf` dir = do -- Git always looks for "dir.git" in preference to -- to "dir", even if dir ends in a "/". - let dir' = (dropTrailingPathSeparator dir) ++ ".git" + let canondir = dropTrailingPathSeparator dir + let dir' = canondir ++ ".git" e <- doesDirectoryExist dir' - return $ newFrom $ Dir $ if e then dir' else dir + if e + then ret dir' + else if "/.git" `isSuffixOf` canondir + then do + -- When dir == "foo/.git", git looks + -- for "foo/.git/.git", and failing + -- that, uses "foo" as the repository. + e' <- doesDirectoryExist $ dir ".git" + if e' + then ret dir + else ret $ takeDirectory canondir + else ret dir | otherwise = error $ "internal error, " ++ dir ++ " is not absolute" + where + ret = return . newFrom . Dir {- Remote Repo constructor. Throws exception on invalid url. -} repoFromUrl :: String -> IO Repo diff --git a/debian/changelog b/debian/changelog index cf1c9baf95..76495c9017 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +git-annex (0.20110522) UNRELEASED; urgency=low + + * Closer emulation of git's behavior when told to use "foo/.git" as a + git repository instead of just "foo". Closes: #627563 + + -- Joey Hess Sun, 22 May 2011 14:03:42 -0400 + git-annex (0.20110521) unstable; urgency=low * status: New subcommand to show info about an annex, including its size. diff --git a/doc/bugs/weird_local_clone_confuses.mdwn b/doc/bugs/weird_local_clone_confuses.mdwn index 371f6d9a5e..aa838f1670 100644 --- a/doc/bugs/weird_local_clone_confuses.mdwn +++ b/doc/bugs/weird_local_clone_confuses.mdwn @@ -16,3 +16,5 @@ Just tested, and the new support for bare repositories didn't solve this. I think this is not something git-annex should go out of its way to support. [[done]] --[[Joey]] + +Later.. Fixed this after all. --[[Joey]]