Re: [PATCH] t3706: Add test for wildcard vs literal pathspec

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

 



> Yes ls-files is also a great example, I will add them in the test.


I was going to suggest you to use `git ls-files -o 'f**'` in your test,
 which would eliminate the need of `git add` and `git reset`. However, I
just found that the bug doesn't happen here:

```
git init
touch foo 'f*' 'f**' f bar
git ls-files -o 'f*'
```

Here (I'm using the current `next`, currently at `fd585f7`),
`git ls-files -o 'f*'` list the files correctly:

```
f
f*
f**
foo
```

I also tried with `git grep`:

```
git init
touch foo 'f*' 'f**' f bar
for f in *; do echo 123 > "$f"; done
git add -A
git grep 123 -- 'f*'

and somehow it worked:

```
f:1:123
f*:1:123
f**:1:123
foo:1:123
```

So, if I'm not doing anything wrong, it looks that it is not solely
related to pathspecs, but related to pathspecs when used with some other
commands. hmmm...

> I think for the pathspec and glob specific commands almost all the commands
> share the same code, so it should work the same for all.


I also though the same, but somehow it behaves differently at least with
`ls-files` and `grep`. Perhaps it will need further investigation on how
some commands behave correctly and some don't. I would start by
inspecting other commands that uses pathspecs (some that I remember:
checkout, log, show, stash, status, ls-files, grep) and see if they work
correctly or not, then compare the two groups and see what differs
between them under the hook.




[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