Web lists-archives.com

Re: [GSoC] microporject test_path_is_*




On Tue, Mar 26 2019, Elijah Newren wrote:

> Hi,
>
> On Tue, Mar 26, 2019 at 2:10 PM Mooga <contact@xxxxxxxxxxx> wrote:
>>
>> Hi,
>> I am still a bit confused about the task itself
>>
>> it’s just text replacing for example:
>> t1400-update-ref.sh , line 194 -> `test_path_is_missing`  has to be ‘test_path_is_file’
>>
>> Thanks
>
> There are several places in the code that use test with -e or -f or -d
> (or -h or...) in order to check for the presence of a
> file/directory/symlink/etc.  For example,
>    test -f path1/file1
> This could be made more clear and produce nicer error messages if it
> were instead
>    test_path_is_file path1/file1

See also the recent thread I started
https://public-inbox.org/git/87sgwav8cp.fsf@xxxxxxxxxxxxxxxxxxx/ asking
if these wrappers were useless now. The consensus was to keep them (a
bunch of use-cases I didn't know about). Useful if you're poking at them
and wondering why we're using this / what it gives us.

> There are likewise several that use one of
>    ! test -e path/to/filename
> or
>    ! test -f path/to/filename
> or
>   test ! -f path/to/filename
> which could be replaced by
>   test_path_is_missing path/to/filename

Interesting that for some we use the 'test_is_there/test_is_not_there'
pattern and for others 'test_is_there [!]'. E.g
test_path_exist/test_path_is_missing v.s. test_i18ngrep.

> This GSoC microproject is just about picking one testfile that has
> some of these constructs, and fixing the cases found within that
> testfile.