git-grep's "-z" option misbehaves in subdirectory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux