Re: [PATCH v2 6/6] t9109-git-svn-props.sh: split up several pipes

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

 



On Mon, Sep 17, 2018 at 6:25 PM Matthew DeVore <matvore@xxxxxxxxxx> wrote:
> t9109-git-svn-props.sh: split up several pipes

Similar to my comment about 5/6, this title talks about the mechanical
changes made by the patch but not the intent. Perhaps reword it like
this:

    t9109: avoid swallowing Git exit code upstream of a pipe

> A test uses several separate pipe sequences in a row which are awkward
> to split up. Wrap the split-up pipe in a function so the awkwardness is
> not repeated.
>
> Signed-off-by: Matthew DeVore <matvore@xxxxxxxxxx>
> ---
> diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
> @@ -190,16 +190,21 @@ EOF
> +# Note we avoid using pipes in order to ensure that git exits with 0.

This new comment doesn't really add value for someone reading the
patch without knowing the history leading up to the point the comment
was added. It should probably be dropped. (The actual text of the
comment is rather confusing anyhow since avoiding pipes has nothing to
do with ensuring that git exits with 0, thus another reason why this
comment ought to be dropped.)

>  test_expect_success 'test propget' "
> -       git svn propget svn:ignore . | cmp - prop.expect &&
> +       test_propget () {
> +               git svn propget $1 $2 >observed

The &&-chain is broken here, which means you're losing the exit status
from the Git command anyhow (despite the point of the patch being to
avoid losing it).

Also, for consistency, how about calling this "actual" rather than "observed"?

> +               cmp - $3

This is just wrong. The "-" argument to 'cmp' says to read from
standard input, but there is nothing being passed to 'cmp' on standard
input anymore now that you're removed the pipe. I'm guessing that you
really meant to use "observed" here (and reverse the order of
arguments to be consistent with the expect-then-actual idiom).
Finally, since these (apparently) might be binary, you can use
test_cmp_bin() instead.

> +       } &&
> +       test_propget svn:ignore . prop.expect &&
>         cd deeply &&
> -       git svn propget svn:ignore . | cmp - ../prop.expect &&
> -       git svn propget svn:entry:committed-rev nested/directory/.keep \
> -         | cmp - ../prop2.expect &&
> -       git svn propget svn:ignore .. | cmp - ../prop.expect &&
> -       git svn propget svn:ignore nested/ | cmp - ../prop.expect &&
> -       git svn propget svn:ignore ./nested | cmp - ../prop.expect &&
> -       git svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect
> +       test_propget svn:ignore . ../prop.expect &&
> +       test_propget svn:entry:committed-rev nested/directory/.keep \
> +               ../prop2.expect &&
> +       test_propget svn:ignore .. ../prop.expect &&
> +       test_propget svn:ignore nested/ ../prop.expect &&
> +       test_propget svn:ignore ./nested ../prop.expect &&
> +       test_propget svn:ignore .././deeply/nested ../prop.expect
>         "

After this patch, the test is even more broken than appears at first
glance since the test body is inside double-quotes. This means that
the $1, $2, $3 inside the test_propget() function are getting expanded
_before_ the function itself is ever defined, to whatever bogus values
$1, $2, $3 hold at that point. I can't see how this could ever have
worked (except only appearing to work by pure accident).



[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