diff options
author | Matheus Tavares <matheus.bernardino@usp.br> | 2020-04-19 03:33:24 -0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-20 13:01:43 -0700 |
commit | 45115d84901876b9300c1b6eba333cd8b25b1991 (patch) | |
tree | f3946aadeaed5724cedd550e7b82442d052bed1e /Documentation | |
parent | Git 2.26.1 (diff) | |
download | tgif-45115d84901876b9300c1b6eba333cd8b25b1991.tar.xz |
grep: follow conventions for printing paths w/ unusual chars
grep does not follow the conventions used by other Git commands when
printing paths that contain unusual characters (as double-quotes or
newlines). Commands such as ls-files, commit, status and diff will:
- Quote and escape unusual pathnames, by default.
- Print names verbatim and unquoted when "-z" is used.
But grep *never* quotes/escapes absolute paths with unusual chars and
*always* quotes/escapes relative ones, even with "-z". Besides being
inconsistent in its own output, the deviation from other Git commands
can be confusing. So let's make it follow the two rules above and add
some tests for this new behavior. Note that, making grep quote/escape
all unusual paths by default, also make it fully compliant with the
core.quotePath configuration, which is currently ignored for absolute
paths.
Reported-by: Greg Hurrell <greg@hurrell.net>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-grep.txt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt index ddb6acc025..3109ce8fbe 100644 --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@ -206,8 +206,10 @@ providing this option will cause it to die. -z:: --null:: - Output \0 instead of the character that normally follows a - file name. + Use \0 as the delimiter for pathnames in the output, and print + them verbatim. Without this option, pathnames with "unusual" + characters are quoted as explained for the configuration + variable core.quotePath (see git-config(1)). -o:: --only-matching:: |