Re: [PATCH] log: diagnose -L used with pathspec as an error

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

 



On Wed, Nov 04, 2020 at 12:35:10PM -0800, Junio C Hamano wrote:

> The new tests say they may fail with "-L and --follow being
> incompatible" instead of "-L and pathspec being imcompatible".
> Currently the expected failure can come only from the latter, but
> this is to futureproof them, in case we decide to add code to
> explicititly die on -L and --follow used together.

This explanation makes sense (though s/imcompat/incompat/).

> +test_expect_success 'basic command line parsing' '
> +	# This may fail due to "no such path a.c in commit", or
> +	# "-L is incompatible with pathspec", depending on the
> +	# order the error is checked.  Either is acceptable.
> +	test_must_fail git log -L1,1:a.c -- a.c &&
> +
> +	# This must fail due to "-L is incompatible with pathspec".
> +	test_must_fail git log -L1,1:b.c -- b.c 2>error &&
> +	test_i18ngrep "cannot be used with pathspec" error &&

The renaming makes sense...

> +
> +	# Note that incompatibility between -L/--follow is not
> +	# explicitly checked to avoid redundant code and the comments
> +	# on the following tests are merely for future-proofing.

...as does this comment to explain the rest of the tests.

> +	# These must fail due to "follow requires one pathspec", or
> +	# "-L is incompatible with --follow", depending on the
> +	# order the error is checked.  Either is acceptable.
> +	test_must_fail git log -L1,1:b.c --follow &&
> +	test_must_fail git log --follow -L1,1:b.c &&
> +
> +	# This may fail due to "-L is incompatible with pathspec", or
> +	# "-L is incompatible with --follow", depending on the
> +	# order the error is checked.  Either is acceptable.
> +	test_must_fail git log --follow -L1,1:b.c -- b.c
> +'

Though "depending on the order" is a bit of a fiction, because those
checks do not exist at all. I'm OK with it because the earlier comment
explains what is going. I guess:

  # This may fail due to "-L is incompatible with pathspec", or
  # "-L is incompatible with --follow". We don't have the latter as of
  # the writing of this test, but either would be acceptable if we added
  # it.

would be an alternative. I doubt it's worth spending too much time
polishing.

-Peff



[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