Re: [PATCH 1/7] t7300: skip untracked dirs containing ignored files

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

 



On Wed, May 3, 2017 at 1:19 PM, Stefan Beller <sbeller@xxxxxxxxxx> wrote:
> On Tue, May 2, 2017 at 8:29 PM, Samuel Lijin <sxlijin@xxxxxxxxx> wrote:
>> If git sees a directory which contains only untracked and ignored
>> files, clean -d should not remove that directory.
>
> Yes that states a fact; it is not clear why we want to have this test here
> and now. (Is it testing for a recently fixed regression?)

It was recently discovered that this is not true of clean -d (and I'm
not sure if it ever was, to be honest). See
http://public-inbox.org/git/xmqqshkof6jd.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#mf541c06250724bb000461d210b4ed157e415a596

> Are you just introducing the test to demonstrate it keeps working later on?
> Do you plan on changing this behavior in a later patch?)

The idea was to introduce the broken test and then have the rest of
the patch series fix it; Junio pointed out to me (off-list, since he
was responding from his phone, I think) that I got the convention
backwards, so I'll be changing this in the next version.

>> ---
>>  t/t7300-clean.sh | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
>> index b89fd2a6a..948a455e8 100755
>> --- a/t/t7300-clean.sh
>> +++ b/t/t7300-clean.sh
>> @@ -653,4 +653,14 @@ test_expect_success 'git clean -d respects pathspecs (pathspec is prefix of dir)
>>         test_path_is_dir foobar
>>  '
>>
>> +test_expect_success 'git clean -d skips untracked dirs containing ignored files' '
>> +       echo /foo/bar >.gitignore &&
>> +       rm -rf foo &&
>> +       mkdir -p foo &&
>> +       touch foo/bar &&
>> +       git clean -df &&
>> +       test_path_is_file foo/bar &&
>> +       test_path_is_dir foo
>> +'
>
> The test makes sense, though I am wondering if we can integrate
> this test into another test e.g. "ok 15 - git clean -d".
>
> Is the -f flag needed?

Will look into both.

> Thanks,
> Stefan



[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]