diff --git a/CHANGELOG b/CHANGELOG index 234e21e738..02051f3c8a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -74,6 +74,7 @@ git-annex (10.20230408) UNRELEASED; urgency=medium * When yt-dlp is available, default to using it in preference to youtube-dl. Using youtube-dl is now deprecated, and git-annex no longer tries to parse its output to display download progress + * repair: Fix handling of git ref names on Windows. -- Joey Hess Sat, 08 Apr 2023 13:57:18 -0400 diff --git a/Git/Repair.hs b/Git/Repair.hs index 9638187a76..cea57df4c1 100644 --- a/Git/Repair.hs +++ b/Git/Repair.hs @@ -30,6 +30,7 @@ import Git.Types import Git.Fsck import Git.Index import Git.Env +import Git.FilePath import qualified Git.Config as Config import qualified Git.Construct as Construct import qualified Git.LsTree as LsTree @@ -252,7 +253,8 @@ getAllRefs r = getAllRefs' (fromRawFilePath (localGitDir r) "refs") getAllRefs' :: FilePath -> IO [Ref] getAllRefs' refdir = do let topsegs = length (splitPath refdir) - 1 - let toref = Ref . encodeBS . joinPath . drop topsegs . splitPath + let toref = Ref . toInternalGitPath . encodeBS + . joinPath . drop topsegs . splitPath map toref <$> dirContentsRecursive refdir explodePackedRefsFile :: Repo -> IO () diff --git a/Test.hs b/Test.hs index f55d9b8dc3..673a9d5ee6 100644 --- a/Test.hs +++ b/Test.hs @@ -354,6 +354,7 @@ repoTests note numparts = map mk $ sep , testCase "required_content" test_required_content , testCase "add subdirs" test_add_subdirs , testCase "addurl" test_addurl + , testCase "repair" test_repair ] where mk l = testGroup groupname (initTests : map adddep l) @@ -2091,3 +2092,8 @@ test_transition_propagation_reversion = emptylog where emptylog = git_annex_expectoutput "log" [wormannexedfile] [] + +test_repair :: Assertion +test_repair = intmpclonerepo $ + -- Simply running repair used to fail on Windows. + git_annex "repair" [] "repair" diff --git a/doc/bugs/repair_on_Windows_reports_ambiguous_argument_error.mdwn b/doc/bugs/repair_on_Windows_reports_ambiguous_argument_error.mdwn index b87cffba54..fb4c594f46 100644 --- a/doc/bugs/repair_on_Windows_reports_ambiguous_argument_error.mdwn +++ b/doc/bugs/repair_on_Windows_reports_ambiguous_argument_error.mdwn @@ -71,3 +71,7 @@ repair: 1 failed ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) Yes. I am developing the easy-git-annex API for git-annex. + +> Should be [[fixed|done]] now... It was reading the contents of the refs/ +> directory recursively, and treating those names as refs, which is wrong +> on Windows due to path separator being different. --[[Joey]]