[BUG] ** glob pattern in git diff doesn't match root directory

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

 



Hi all,

When I use a `**/` glob pattern with `git diff`, it doesn't seem to
match in the root directory. The documentation for gitgnore says that a
leading `**/` should match in all directories, and I would expect it to
behave the same way for `git diff`. For example:

$ git --version
git version 2.31.1.527.g47e6f16901 # built from the `next` branch
$ mkdir /tmp/globtest && cd /tmp/globtest
$ git init
$ echo foo > foo
$ mkdir sub
$ echo subfoo > sub/foo
$ git add .
$ git commit -m 'Initial commit'
$ echo bar > foo
$ echo subbar > sub/foo
$ git --no-pager diff '**/foo'
diff --git a/sub/foo b/sub/foo
index ef7889f..2b2ab6c 100644
--- a/sub/foo
+++ b/sub/foo
@@ -1 +1 @@
-subfoo
+subbar

Only the diff to `sub/foo` is printed, whereas I'd expect the change to
the top-level `foo` to be printed as well. `git diff '**foo'` does behave
as I would expect. This also happens with a `**` in the middle of a
pattern; e.g., `sub/**/bar` will match `sub/dir/bar` but not `sub/bar`.

Am I misunderstanding how `**` should work, or is this a bug?

Thanks,
Shoaib





[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