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
|
@ -3,6 +3,7 @@ git-annex (7.20191231) UNRELEASED; urgency=medium
|
||||||
* add: --force-annex/--force-git options make it easier to override
|
* add: --force-annex/--force-git options make it easier to override
|
||||||
annex.largefiles configuration (and potentially safer as it avoids
|
annex.largefiles configuration (and potentially safer as it avoids
|
||||||
bugs like the smudge bug fixed in the last release).
|
bugs like the smudge bug fixed in the last release).
|
||||||
|
* reinject --known: Fix bug that prevented it from working in a bare repo.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 01 Jan 2020 12:51:40 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 01 Jan 2020 12:51:40 -0400
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import Annex.Content
|
||||||
import Backend
|
import Backend
|
||||||
import Types.KeySource
|
import Types.KeySource
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
|
import qualified Git
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = command "reinject" SectionUtility
|
cmd = command "reinject" SectionUtility
|
||||||
|
@ -65,8 +66,13 @@ startKnown src = notAnnexed src $
|
||||||
)
|
)
|
||||||
|
|
||||||
notAnnexed :: FilePath -> CommandStart -> CommandStart
|
notAnnexed :: FilePath -> CommandStart -> CommandStart
|
||||||
notAnnexed src = ifAnnexed (toRawFilePath src) $
|
notAnnexed src a =
|
||||||
giveup $ "cannot used annexed file as src: " ++ src
|
ifM (fromRepo Git.repoIsLocalBare)
|
||||||
|
( a
|
||||||
|
, ifAnnexed (toRawFilePath src)
|
||||||
|
(giveup $ "cannot used annexed file as src: " ++ src)
|
||||||
|
a
|
||||||
|
)
|
||||||
|
|
||||||
perform :: FilePath -> Key -> CommandPerform
|
perform :: FilePath -> Key -> CommandPerform
|
||||||
perform src key = ifM move
|
perform src key = ifM move
|
||||||
|
|
|
@ -26,3 +26,5 @@
|
||||||
Obviously this wasn't actually a file known to git-annex. But I get the same error in a non-dummy bare repo I am trying to reinject.
|
Obviously this wasn't actually a file known to git-annex. But I get the same error in a non-dummy bare repo I am trying to reinject.
|
||||||
|
|
||||||
A workaround is to use `git worktree add` and run `git annex reinject` from there.
|
A workaround is to use `git worktree add` and run `git annex reinject` from there.
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Reference in a new issue