Re: [PATCH 5/5] t3404: add test case for abbreviated commands

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

 



Hi Liam,

On Sun, 26 Nov 2017, Liam Beguin wrote:

> Make sure the todo list ends up using single-letter command
> abbreviations when the rebase.abbreviateCommands is enabled.
> This configuration options should not change anything else.

Makes sense. As to the diff:

> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index 6a82d1ed876d..e460ebde3393 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -1260,6 +1260,38 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '
>  	test B = $(git cat-file commit HEAD^ | sed -ne \$p)
>  '
>  
> +test_expect_success 'prepare rebase.abbreviateCommands' '
> +	reset_rebase &&
> +	git checkout -b abbrevcmd master &&
> +	test_commit "first" file1.txt "first line" first &&
> +	test_commit "second" file1.txt "another line" second &&
> +	test_commit "fixup! first" file2.txt "first line again" first_fixup &&
> +	test_commit "squash! second" file1.txt "another line here" second_squash
> +'

In addition to Junio's suggestion to include the "expected" block in the
next test case, I would be in favor of combining all the new code in a
single test case.

Also, I think that the test_commit calls can be simplified to:

	test_commit first &&
	test_commit second &&
	test_commit "fixup! first" first A dummy1 &&
	test_commit "squash! second" second B dummy2 &&

> +cat >expected <<EOF &&
> +p $(git rev-list --abbrev-commit -1 first) first

Maybe $(git rev-parse --short HEAD~3)?

> +f $(git rev-list --abbrev-commit -1 first_fixup) fixup! first
> +x git show HEAD
> +p $(git rev-list --abbrev-commit -1 second) second
> +s $(git rev-list --abbrev-commit -1 second_squash) squash! second
> +x git show HEAD
> +EOF
> +
> +test_expect_success 'respects rebase.abbreviateCommands with fixup, squash and exec' '
> +	test_when_finished "
> +		git checkout master &&
> +		test_might_fail git branch -D abbrevcmd &&
> +		test_might_fail git rebase --abort
> +	" &&
> +	git checkout abbrevcmd &&
> +	set_cat_todo_editor &&
> +	test_config rebase.abbreviateCommands true &&
> +	test_must_fail git rebase -i --exec "git show HEAD" \
> +		--autosquash master >actual &&
> +	test_cmp expected actual
> +'

Otherwise, it looks good!

Thank you for staying on the ball and getting this patch series updated.

Ciao,
Dscho



[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