add a guard against using git annex add in direct mode repo
Currently, it deletes files when run in one, so until I get a chance to fix it, block foot shooting.
This commit is contained in:
parent
cc5140d295
commit
c3a35eb857
2 changed files with 8 additions and 1 deletions
|
@ -18,6 +18,7 @@ module Command (
|
||||||
whenAnnexed,
|
whenAnnexed,
|
||||||
ifAnnexed,
|
ifAnnexed,
|
||||||
notBareRepo,
|
notBareRepo,
|
||||||
|
notDirect,
|
||||||
isBareRepo,
|
isBareRepo,
|
||||||
numCopies,
|
numCopies,
|
||||||
numCopiesCheck,
|
numCopiesCheck,
|
||||||
|
@ -103,6 +104,12 @@ notBareRepo a = do
|
||||||
error "You cannot run this subcommand in a bare repository."
|
error "You cannot run this subcommand in a bare repository."
|
||||||
a
|
a
|
||||||
|
|
||||||
|
notDirect :: Annex a -> Annex a
|
||||||
|
notDirect a = ifM isDirect
|
||||||
|
( error "You cannot run this subcommand in a direct mode repository."
|
||||||
|
, a
|
||||||
|
)
|
||||||
|
|
||||||
isBareRepo :: Annex Bool
|
isBareRepo :: Annex Bool
|
||||||
isBareRepo = fromRepo Git.repoIsLocalBare
|
isBareRepo = fromRepo Git.repoIsLocalBare
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ seek = [withFilesNotInGit start, withFilesUnlocked start]
|
||||||
- backend, and then moving it into the annex directory and setting up
|
- backend, and then moving it into the annex directory and setting up
|
||||||
- the symlink pointing to its content. -}
|
- the symlink pointing to its content. -}
|
||||||
start :: FilePath -> CommandStart
|
start :: FilePath -> CommandStart
|
||||||
start file = notBareRepo $ ifAnnexed file fixup add
|
start file = notBareRepo $ notDirect $ ifAnnexed file fixup add
|
||||||
where
|
where
|
||||||
add = do
|
add = do
|
||||||
s <- liftIO $ getSymbolicLinkStatus file
|
s <- liftIO $ getSymbolicLinkStatus file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue