On Fri, Dec 09, 2016 at 04:46:49AM +0300, unixway.dr...@gmail.com wrote: > The problem is that `git-diff-files` does some globbing on the 'path' > arguments on its own and has no option to disable that (and > `git-add--interactive`'s `run_cmd_pipe` already handles all other sorts of > unsafe characters like spaces and backticks well).
I think the option you're looking for is: git --literal-pathspecs diff-files ... -- 'Random *' I don't know if there are other commands run by add--interactive that would want the same treatment. It might actually make sense to set GIT_LITERAL_PATHSPECS=1 in the environment right after it expands the list via ls-files. > diff --git a/git-add--interactive.perl b/git-add--interactive.perl > index ee3d812..358d877 100755 > --- a/git-add--interactive.perl > +++ b/git-add--interactive.perl > @@ -2,3 +2,3 @@ > > -use 5.008; > +use 5.014; > use strict; > @@ -761,3 +761,5 @@ sub parse_diff { > } > - my @diff = run_cmd_pipe("git", @diff_cmd, "--", $path); > + my @diff = run_cmd_pipe("git", @diff_cmd, "--", ( > + $path =~ s#[\[*?]#\\$&#gr > + )); This callsite covers "-p". It looks like list_modified() probably needs similar treatment. Maybe others; I didn't look exhaustively. -Peff