Subject: Re: [PATCH v3 12/15] replay: disallow revision specific options and pathspecs

From: Junio C Hamano <[email-masked]>
Date: Tue, 25 Jul 2023 14:16:43 -0700

Christian Couder <[email-masked]> writes:

> +	/*
> +	 * Reject any pathspec. (They are allowed and eaten by
> +	 * setup_revisions() above.) In the future we might accept
> +	 * them, after adding related tests and doc though.
> +	 */
> +	if (revs.prune_data.nr) {
> +		error(_("invalid pathspec: %s"), revs.prune_data.items[0].match);

This made me waste a few minutes wondering if and how I misspelt my
pathspec elements.  If we mean "no pathspec is allowed", we should
say so instead.

> +		usage_with_options(replay_usage, replay_options);
> +	}
> +
>  	/* requirements/overrides for revs */
>  	revs.reverse = 1;
>  	revs.sort_order = REV_SORT_IN_GRAPH_ORDER;
> diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh
> index a1da4f9ef9..de6e40950e 100755
> --- a/t/t3650-replay-basics.sh
> +++ b/t/t3650-replay-basics.sh
> @@ -80,4 +80,20 @@ test_expect_success 'using replay on bare repo to rebase with a conflict' '
>  	test_expect_code 1 git -C bare replay --onto topic1 B..conflict
>  '
>  
> +test_expect_success 'using replay with (for now) disallowed revision specific option --not' '
> +	test_must_fail git replay --onto main topic2 --not topic1
> +'
> +
> +test_expect_success 'using replay on bare repo with (for now) disallowed revision specific option --first-parent' '
> +	test_must_fail git -C bare replay --onto main --first-parent topic1..topic2
> +'
> +
> +test_expect_success 'using replay with disallowed pathspec' '
> +	test_must_fail git replay --onto main topic1..topic2 A.t
> +'
> +
> +test_expect_success 'using replay on bare repo with disallowed pathspec' '
> +	test_must_fail git -C bare replay --onto main topic1..topic2 -- A.t
> +'
> +
>  test_done