revert recent bug fix temporarily for release

Decided this bug is not severe enough to delay the release until
tomorrow, so this will be re-applied after the release.
This commit is contained in:
Joey Hess 2023-02-14 14:06:29 -04:00
parent c1ef4a7481
commit 16f1e24665
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 33 additions and 42 deletions

View file

@ -1,6 +1,6 @@
{- Construction of Git Repo objects
-
- Copyright 2010-2023 Joey Hess <id@joeyh.name>
- Copyright 2010-2021 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -23,7 +23,6 @@ module Git.Construct (
checkForRepo,
newFrom,
adjustGitDirFile,
isBareRepo,
) where
#ifndef mingw32_HOST_OS
@ -217,7 +216,7 @@ checkForRepo :: FilePath -> IO (Maybe RepoLocation)
checkForRepo dir =
check isRepo $
check (checkGitDirFile (toRawFilePath dir)) $
check (checkdir (isBareRepo dir)) $
check isBareRepo $
return Nothing
where
check test cont = maybe cont (return . Just) =<< test
@ -226,17 +225,16 @@ checkForRepo dir =
, return Nothing
)
isRepo = checkdir $
doesFileExist (dir </> ".git" </> "config")
gitSignature (".git" </> "config")
<||>
-- A git-worktree lacks .git/config, but has .git/gitdir.
-- (Normally the .git is a file, not a symlink, but it can
-- be converted to a symlink and git will still work;
-- this handles that case.)
doesFileExist (dir </> ".git" </> "gitdir")
isBareRepo :: FilePath -> IO Bool
isBareRepo dir = doesFileExist (dir </> "config")
<&&> doesDirectoryExist (dir </> "objects")
gitSignature (".git" </> "gitdir")
isBareRepo = checkdir $ gitSignature "config"
<&&> doesDirectoryExist (dir </> "objects")
gitSignature file = doesFileExist $ dir </> file
-- Check for a .git file.
checkGitDirFile :: RawFilePath -> IO (Maybe RepoLocation)