make .noannex file prevent repo fixups
Avoid performing repository fixups for submodules and git-worktrees when there's a .noannex file that will prevent git-annex from being used in the repository. This change is ok as long as the .noannex file is really going to prevent git-annex from being used. But, init --force could override the file. Which would result in the repo being initialized without the fixups having run. To avoid that situation decided to change init, to not let --force be used to override a .noannex file. Instead the user can just delete the file.
This commit is contained in:
parent
8795fc6ba8
commit
c3f47ba389
11 changed files with 58 additions and 39 deletions
|
@ -1,6 +1,6 @@
|
|||
{- git-annex extra config files
|
||||
-
|
||||
- Copyright 2012 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2012-2019 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
@ -13,6 +13,8 @@ import Common
|
|||
import Utility.Tmp
|
||||
import Utility.FreeDesktop
|
||||
|
||||
import Git
|
||||
|
||||
{- ~/.config/git-annex/file -}
|
||||
userConfigFile :: FilePath -> IO FilePath
|
||||
userConfigFile file = do
|
||||
|
@ -81,3 +83,10 @@ cannotFindProgram :: IO a
|
|||
cannotFindProgram = do
|
||||
f <- programFile
|
||||
giveup $ "cannot find git-annex program in PATH or in the location listed in " ++ f
|
||||
|
||||
{- A .noannex file in a git repository prevents git-annex from
|
||||
- initializing that repository.. The content of the file is returned. -}
|
||||
noAnnexFileContent :: Repo -> IO (Maybe String)
|
||||
noAnnexFileContent r = case Git.repoWorkTree r of
|
||||
Nothing -> return Nothing
|
||||
Just wt -> catchMaybeIO (readFile (wt </> ".noannex"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue