reinject --known: Fix bug that prevented it from working in a bare repo.
ifAnnexed in a bare repo passes to git cat-file :./filename , which it refuses to do since the repo is bare. Note that, reinject somefile someannexedfile in a bare repo silently does nothing, because someannexedfile is never actually an annexed worktree file, because the repo is bare.
This commit is contained in:
parent
d9ed94f15b
commit
2de3dddfd2
3 changed files with 11 additions and 2 deletions
|
@ -13,6 +13,7 @@ import Annex.Content
|
|||
import Backend
|
||||
import Types.KeySource
|
||||
import Utility.Metered
|
||||
import qualified Git
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "reinject" SectionUtility
|
||||
|
@ -65,8 +66,13 @@ startKnown src = notAnnexed src $
|
|||
)
|
||||
|
||||
notAnnexed :: FilePath -> CommandStart -> CommandStart
|
||||
notAnnexed src = ifAnnexed (toRawFilePath src) $
|
||||
giveup $ "cannot used annexed file as src: " ++ src
|
||||
notAnnexed src a =
|
||||
ifM (fromRepo Git.repoIsLocalBare)
|
||||
( a
|
||||
, ifAnnexed (toRawFilePath src)
|
||||
(giveup $ "cannot used annexed file as src: " ++ src)
|
||||
a
|
||||
)
|
||||
|
||||
perform :: FilePath -> Key -> CommandPerform
|
||||
perform src key = ifM move
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue