From: Greg Hurrell <greg@hurrell.net>
To: git@vger.kernel.org
Subject: git-grep's "-z" option misbehaves in subdirectory
Date: Mon, 13 Apr 2020 23:55:48 +0200 [thread overview]
Message-ID: <CAOyLvt9=wRfpvGGJqLMi7=wLWu881pOur8c9qNEg+Xqhf8W2ww@mail.gmail.com> (raw)
Hi,
It seems that `git-grep -lz` behaves differently depending on whether
it is inside a subdirectory:
$ mkdir demo
$ cd demo
$ git init
$ echo content > 'an "example".txt'
$ mkdir nested
$ echo content > 'nested/other "example".txt'
$ git add .
$ git commit -m Initial
$ git grep -lz content
an "example".txt^@nested/other "example".txt^@
Note that, as expected, the files are NUL-terminated and not wrapped
in quotes. ("^@" represents NUL byte.)
$ cd nested
$ git grep -lz content
"other \"example\".txt"^@
As soon as we move into a subdirectory, files are wrapped in quotes
and contain escapes, despite the "-z" switch. git-ls-files doesn't
exhibit this behavior:
$ git ls-files -z
other "example".txt
And git-grep doesn't either, if you pass "--full-name":
$ git grep -lz --full-name content
nested/other "example".txt^@
Seeing this on Git v2.25.0 on macOS (10.13.6).
Does this seem like a bug, or expected behavior?
Cheers,
Greg
next reply other threads:[~2020-04-13 21:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 21:55 Greg Hurrell [this message]
2020-04-13 23:33 ` git-grep's "-z" option misbehaves in subdirectory Junio C Hamano
2020-04-14 7:42 ` Matheus Tavares
2020-04-16 18:59 ` git-grep's "-z" option misbehaves in subdirectory Matheus Tavares Bernardino
2020-04-16 20:07 ` Junio C Hamano
2020-04-17 6:04 ` [PATCH] grep: follow conventions for printing paths w/ unusual chars Matheus Tavares
2020-04-17 6:45 ` Junio C Hamano
2020-04-17 21:19 ` Matheus Tavares Bernardino
2020-04-17 21:35 ` Junio C Hamano
2020-04-18 13:13 ` Johannes Schindelin
2020-04-18 14:56 ` Johannes Schindelin
2020-04-19 6:27 ` Matheus Tavares Bernardino
2020-04-19 6:33 ` [PATCH v2] " Matheus Tavares
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOyLvt9=wRfpvGGJqLMi7=wLWu881pOur8c9qNEg+Xqhf8W2ww@mail.gmail.com' \
--to=greg@hurrell.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).