Web lists-archives.com

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




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?