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

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

 



Hi!

> +test_expect_success 'setup: create files and initial commit' '
> +    mkdir testdir &&
> +    >testdir/f\* &&
> +    >testdir/f\*\* &&
> +    >testdir/foo &&
> +    git add testdir &&
> +    git commit -m "Initial setup with literal wildcard files"
> +'
> +
> +test_expect_success 'clean slate before testing wildcard behavior' '
> +    git rm -rf testdir &&
> +    git commit -m "Clean state"
> +'
>
> +test_expect_success 'recreate files to test add behavior' '
> +    mkdir testdir &&
> +    >testdir/f\* &&
> +    >testdir/f\*\* &&
> +    >testdir/foo
> +'


Two questions:

1. Does this need to be inside a test_expect_success? It seems to me
   that those two tests cases are actually setup code for the next
   two.

2. If so, does it need to have all that setup? I could reproduce the
   bug by only running:

   ```
   git reset
   touch foo 'f*' 'f**'
   git add 'f*'
   git ls-files 
   ```

   btw, this works with your code, congrats!

Other idea: `?` is another wildcard for matching only one character.
Have you tested if the same bug happens with it?

PS: while I was writing this review I pushed this to my GitHub just
to make the CI run the entire test suite since pathspecs are a
sensible part of Git.

Take look at this, it seems that your tests aren't passing on Windows:
https://github.com/lucasoshiro/git/actions/runs/14450183624/job/40521015897.
Perhaps you'll need to change something there. It seems to be
related to how Windows handle paths (specially the \ character, which
means the same as / in Unix). Personally, I'm not a Windows guy and
can't help you further with this. A quick reference on how paths on
Windows work is this (and yeah, they are far more complex than in
Unix):
https://www.fileside.app/blog/2023-03-17_windows-file-paths/






[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