diff --git a/CHANGELOG b/CHANGELOG index 7a50cf28ce..d94481da36 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ git-annex (7.20191231) UNRELEASED; urgency=medium * add: --force-annex/--force-git options make it easier to override annex.largefiles configuration (and potentially safer as it avoids 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 Wed, 01 Jan 2020 12:51:40 -0400 diff --git a/Command/Reinject.hs b/Command/Reinject.hs index d33817debf..a73253ba12 100644 --- a/Command/Reinject.hs +++ b/Command/Reinject.hs @@ -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 diff --git a/doc/todo/git-annex-reinject_does_not_work_in_a_bare_repo.mdwn b/doc/todo/git-annex-reinject_does_not_work_in_a_bare_repo.mdwn index dc46ac71ee..d4813403fc 100644 --- a/doc/todo/git-annex-reinject_does_not_work_in_a_bare_repo.mdwn +++ b/doc/todo/git-annex-reinject_does_not_work_in_a_bare_repo.mdwn @@ -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. A workaround is to use `git worktree add` and run `git annex reinject` from there. + +> [[fixed|done]] --[[Joey]]