Improve file ordering behavior when one parameter is "." and other parameters are...
authorJoey Hess <joeyh@joeyh.name>
Fri, 20 Dec 2019 22:01:29 +0000 (18:01 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 20 Dec 2019 22:01:29 +0000 (18:01 -0400)
eg, `git-annex get . ..` used to order the files strangly, because it
did not realize that when git ls-files output eg "foo", that should be
grouped with the first set of files and not the second set.

Fixed by making            dirContains "." "./foo" = True
which makes sense, because dirContains ".." "../foo" = True

CHANGELOG
Utility/Path.hs

index 3380003fd9c5d23b8373341d87dd5f16898bc8ef..4cde472e2649194dee777c5d4475f02435c26054 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -17,6 +17,8 @@ git-annex (7.20191219) UNRELEASED; urgency=medium
   * annex.addunlocked can be configured by git-annex config.
   * git-annex-config --set/--unset: No longer change the local git config
     setting, except for in the special case of annex.securehashesonly.
+  * Improve file ordering behavior when one parameter is "." and other
+    parameters are other directories.
 
  -- Joey Hess <id@joeyh.name>  Wed, 18 Dec 2019 15:12:40 -0400
 
index 3f34156e88c1bcbf6ab4a22fa30ac6fbc2857c1b..ecc752c12329801fbb2010d39f2b541c255de227 100644 (file)
@@ -113,7 +113,10 @@ prop_upFrom_basics dir
  - are all equivilant.
  -}
 dirContains :: FilePath -> FilePath -> Bool
-dirContains a b = a == b || a' == b' || (addTrailingPathSeparator a') `isPrefixOf` b'
+dirContains a b = a == b
+       || a' == b'
+       || (addTrailingPathSeparator a') `isPrefixOf` b'
+       || a' == "." && normalise ("." </> b') == b'
   where
        a' = norm a
        b' = norm b