diff options
author | 2015-03-27 16:45:50 -0400 | |
---|---|---|
committer | 2015-03-27 16:45:50 -0400 | |
commit | 8383afb1ec6a493fb7d3ca302be356ecc59dbc45 (patch) | |
tree | c4c9037c111f9d3fbd33d25d91270117700e8538 | |
parent | 65d91fe543b6adaa9ba6b6b0f77cf0050864962c (diff) |
Prevent git-ls-files from double-expanding wildcards when an unexpanded wildcard is passed to a git-annex command like add or find.
Note that previously, `git annex find *.jpg` would find eg, foo/bar.jpg.
That was never intended or documented behavior, so I'm going to change it.
But this is potentially a behavior change if someone discovered that
behavior and relied on it despite it being accidental. Oh well.. can't make
an omlette w/o breaking some eggs.
-rw-r--r-- | Git/LsFiles.hs | 2 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/bugs/unexpected_double_wildcard_expansion.mdwn | 15 | ||||
-rw-r--r-- | doc/forum/Adding_files_with_wildcard_on_Mac_Yosemite/comment_5_a02c3cd804c2f6fd80d8839cc5c81af4._comment | 12 |
4 files changed, 30 insertions, 1 deletions
diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs index 1006be808..3f001f513 100644 --- a/Git/LsFiles.hs +++ b/Git/LsFiles.hs @@ -41,7 +41,7 @@ mkFile :: FilePath -> CommandParam mkFile = File . concatMap go where go c - | c == '*' = ['\\', c] + | c `elem` "*?[]" = ['\\', c] | otherwise = [c] {- Scans for files that are checked into git at the specified locations. -} diff --git a/debian/changelog b/debian/changelog index 4577a67dc..e2bfe362c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ git-annex (5.20150328) UNRELEASED; urgency=medium * Better fix for standalone tarball git-annex sync linker shim bug, that works for "git annex sync" as well as "git-annex sync". + * Prevent git-ls-files from double-expanding wildcards when an + unexpanded wildcard is passed to a git-annex command like add or find. -- Joey Hess <id@joeyh.name> Fri, 27 Mar 2015 16:04:43 -0400 diff --git a/doc/bugs/unexpected_double_wildcard_expansion.mdwn b/doc/bugs/unexpected_double_wildcard_expansion.mdwn new file mode 100644 index 000000000..f898a0c84 --- /dev/null +++ b/doc/bugs/unexpected_double_wildcard_expansion.mdwn @@ -0,0 +1,15 @@ +From the forum, it seems that git-ls-files very unexpectedly expands +wildcards in filenames passed to it. (Not a documented or an expected +behavior.) + +This causes problems when eg, the user does `git annex add *.jpeg` and that +matches no files, but there are some jpegs in subdirectories. git-ls-files +re-expands the wildcard and finds those. + +Seems that the best fix is to make Git.LsFiles paper over this git +misfeature, by always escaping wildcards in paths passed +to git-ls-files. AFAIK, no callers of Git.LsFiles expect to provide it +wildcards, because I was completely surprised when I learned they were +expanded.. --[[Joey]] + +> [[fixed|done]] --[[Joey]] diff --git a/doc/forum/Adding_files_with_wildcard_on_Mac_Yosemite/comment_5_a02c3cd804c2f6fd80d8839cc5c81af4._comment b/doc/forum/Adding_files_with_wildcard_on_Mac_Yosemite/comment_5_a02c3cd804c2f6fd80d8839cc5c81af4._comment new file mode 100644 index 000000000..14560b023 --- /dev/null +++ b/doc/forum/Adding_files_with_wildcard_on_Mac_Yosemite/comment_5_a02c3cd804c2f6fd80d8839cc5c81af4._comment @@ -0,0 +1,12 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 5""" + date="2015-03-27T20:42:21Z" + content=""" +I've fixed this; now you'll see: + +<pre> +git annex add *.jpg +git-annex: *.jpg not found +</pre> +"""]] |