Re: [GSoC][PATCH v2 3/3] t3600: use helpers to replace test -d/f/e/s <path>

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

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> On Fri, Mar 8, 2019 at 12:38 AM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> An unrelated tangent, but what do you think of this patch?  In the
>> context of testing "git rm", if foo is a dangling symbolic link,
>> "git rm foo && test_path_is_missing foo" would need something like
>> this to work correctly, I would think.
>>
>>  test_path_is_missing () {
>> -       if test -e "$1"
>> +       if test -e "$1" || test -L "$1"
>>         then
>>                 echo "Path exists:"
>>                 ls -ld "$1"
>
> Makes sense. Won't we also want:
>
>     test_path_exists () {
>     -    if ! test -e "$1"
>     +   if ! test -e "$1" && ! test -L "$1"
>        then
>             echo "Path $1 doesn't exist. $2"
>
> or something like that?

That would make them symmetric, but what I was driving at with "In
the context of testing git rm" was that I highly suspect that among
other existing users of test_path_is_missing there are some that
want to consider a dangling symbolic link as if it is not there (and
vice versa for test_path_exists), and it may not be a good idea to
unconditionally declare that, unlike the underlying "test" command
that dereferences symlinks for most operations, our wrapper does not
dereference symbolic links, which is what the "what do you think?"
patch and your addtion do.





[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