git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH sg/test-rebase-editor-fix] t3404-rebase-interactive: test abbreviated commands
@ 2018-10-25 20:54 Johannes Sixt
  2018-10-25 21:04 ` Johannes Sixt
  2018-10-26  8:11 ` Johannes Schindelin
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Sixt @ 2018-10-25 20:54 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git Mailing List

Test each short command at least once. The commands changed here
are chosen such that

- tests do not have a prerequisite,
- the 'git rebase' command is not guarded by test_must_fail.

The pick commands are optional noise words in the FAKE_LINES
variable. Test them, too.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 This patch must be placed on top of sg/test-rebase-editor-fix.
 It has a textual conflict with my sequencer 'b' fix from some
 minutes ago, but the resolution should be obvious:

 - 		exec*|break|b)
  -		exec_*|x_*)
 ++		exec_*|x_*|break|b)

 t/lib-rebase.sh               |  4 ++--
 t/t3404-rebase-interactive.sh | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 2ca9fb69d6..0c93d00bdd 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -47,9 +47,9 @@ set_fake_editor () {
 	action=pick
 	for line in $FAKE_LINES; do
 		case $line in
-		pick|squash|fixup|edit|reword|drop)
+		pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d)
 			action="$line";;
-		exec*)
+		exec_*|x_*)
 			echo "$line" | sed 's/_/ /g' >> "$1";;
 		"#")
 			echo '# comment' >> "$1";;
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 352a52e59d..d36ee4f807 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -114,7 +114,7 @@ test_expect_success 'rebase -i with exec allows git commands in subdirs' '
 	git checkout master &&
 	mkdir subdir && (cd subdir &&
 	set_fake_editor &&
-	FAKE_LINES="1 exec_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
+	FAKE_LINES="1 x_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
 		git rebase -i HEAD^
 	)
 '
@@ -499,7 +499,7 @@ test_expect_success 'squash works as expected' '
 	git checkout -b squash-works no-conflict-branch &&
 	one=$(git rev-parse HEAD~3) &&
 	set_fake_editor &&
-	FAKE_LINES="1 squash 3 2" EXPECT_HEADER_COUNT=2 \
+	FAKE_LINES="1 s 3 2" EXPECT_HEADER_COUNT=2 \
 		git rebase -i HEAD~3 &&
 	test $one = $(git rev-parse HEAD~2)
 '
@@ -732,7 +732,7 @@ test_expect_success 'reword' '
 	git show HEAD^ | grep "D changed" &&
 	FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" git rebase -i A &&
 	git show HEAD~3 | grep "B changed" &&
-	FAKE_LINES="1 reword 2 3 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
+	FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
 	git show HEAD~2 | grep "C changed"
 '
 
@@ -758,7 +758,7 @@ test_expect_success 'rebase -i can copy notes over a fixup' '
 	git reset --hard n3 &&
 	git notes add -m"an earlier note" n2 &&
 	set_fake_editor &&
-	GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 fixup 2" git rebase -i n1 &&
+	GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 f 2" git rebase -i n1 &&
 	git notes show > output &&
 	test_cmp expect output
 '
@@ -1208,7 +1208,7 @@ rebase_setup_and_clean () {
 test_expect_success 'drop' '
 	rebase_setup_and_clean drop-test &&
 	set_fake_editor &&
-	FAKE_LINES="1 drop 2 3 drop 4 5" git rebase -i --root &&
+	FAKE_LINES="1 drop 2 3 d 4 5" git rebase -i --root &&
 	test E = $(git cat-file commit HEAD | sed -ne \$p) &&
 	test C = $(git cat-file commit HEAD^ | sed -ne \$p) &&
 	test A = $(git cat-file commit HEAD^^ | sed -ne \$p)
-- 
2.19.1.406.g1aa3f475f3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH sg/test-rebase-editor-fix] t3404-rebase-interactive: test abbreviated commands
  2018-10-25 20:54 [PATCH sg/test-rebase-editor-fix] t3404-rebase-interactive: test abbreviated commands Johannes Sixt
@ 2018-10-25 21:04 ` Johannes Sixt
  2018-10-26  8:11 ` Johannes Schindelin
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2018-10-25 21:04 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git Mailing List

Am 25.10.18 um 22:54 schrieb Johannes Sixt:
> Test each short command at least once. The commands changed here
> are chosen such that
> 
> - tests do not have a prerequisite,
> - the 'git rebase' command is not guarded by test_must_fail.
> 
> The pick commands are optional noise words in the FAKE_LINES
> variable. Test them, too.

Actually, this sentence should better be:

The pick commands are optional in the FAKE_LINES variable, but
when used, they do end up in the insn sheet. Test them, too.

> 
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
...
> @@ -732,7 +732,7 @@ test_expect_success 'reword' '
>   	git show HEAD^ | grep "D changed" &&
>   	FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" git rebase -i A &&
>   	git show HEAD~3 | grep "B changed" &&
> -	FAKE_LINES="1 reword 2 3 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
> +	FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
>   	git show HEAD~2 | grep "C changed"
>   '

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH sg/test-rebase-editor-fix] t3404-rebase-interactive: test abbreviated commands
  2018-10-25 20:54 [PATCH sg/test-rebase-editor-fix] t3404-rebase-interactive: test abbreviated commands Johannes Sixt
  2018-10-25 21:04 ` Johannes Sixt
@ 2018-10-26  8:11 ` Johannes Schindelin
  2018-10-27  8:08   ` [PATCH v2 " Johannes Sixt
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2018-10-26  8:11 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List

Hi Hannes,


On Thu, 25 Oct 2018, Johannes Sixt wrote:

> Test each short command at least once. The commands changed here
> are chosen such that

I stumbled over this, and understood it only after looking at the patch.
How about this instead:

	Make sure that each short command is tested at least once. To do
	so, we modify existing tests to avoid lengthening the already
	formidable runtime of t3404 (13 minutes on Windows). These rules
	were followed to find appropriate commands to modify:

> - tests do not have a prerequisite,
> - the 'git rebase' command is not guarded by test_must_fail.
> 
> The pick commands are optional noise words in the FAKE_LINES
> variable. Test them, too.
> 
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>

The rest looks good to me.

Thanks,
Dscho

> ---
>  This patch must be placed on top of sg/test-rebase-editor-fix.
>  It has a textual conflict with my sequencer 'b' fix from some
>  minutes ago, but the resolution should be obvious:
> 
>  - 		exec*|break|b)
>   -		exec_*|x_*)
>  ++		exec_*|x_*|break|b)
> 
>  t/lib-rebase.sh               |  4 ++--
>  t/t3404-rebase-interactive.sh | 10 +++++-----
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
> index 2ca9fb69d6..0c93d00bdd 100644
> --- a/t/lib-rebase.sh
> +++ b/t/lib-rebase.sh
> @@ -47,9 +47,9 @@ set_fake_editor () {
>  	action=pick
>  	for line in $FAKE_LINES; do
>  		case $line in
> -		pick|squash|fixup|edit|reword|drop)
> +		pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d)
>  			action="$line";;
> -		exec*)
> +		exec_*|x_*)
>  			echo "$line" | sed 's/_/ /g' >> "$1";;
>  		"#")
>  			echo '# comment' >> "$1";;
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index 352a52e59d..d36ee4f807 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -114,7 +114,7 @@ test_expect_success 'rebase -i with exec allows git commands in subdirs' '
>  	git checkout master &&
>  	mkdir subdir && (cd subdir &&
>  	set_fake_editor &&
> -	FAKE_LINES="1 exec_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
> +	FAKE_LINES="1 x_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
>  		git rebase -i HEAD^
>  	)
>  '
> @@ -499,7 +499,7 @@ test_expect_success 'squash works as expected' '
>  	git checkout -b squash-works no-conflict-branch &&
>  	one=$(git rev-parse HEAD~3) &&
>  	set_fake_editor &&
> -	FAKE_LINES="1 squash 3 2" EXPECT_HEADER_COUNT=2 \
> +	FAKE_LINES="1 s 3 2" EXPECT_HEADER_COUNT=2 \
>  		git rebase -i HEAD~3 &&
>  	test $one = $(git rev-parse HEAD~2)
>  '
> @@ -732,7 +732,7 @@ test_expect_success 'reword' '
>  	git show HEAD^ | grep "D changed" &&
>  	FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" git rebase -i A &&
>  	git show HEAD~3 | grep "B changed" &&
> -	FAKE_LINES="1 reword 2 3 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
> +	FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
>  	git show HEAD~2 | grep "C changed"
>  '
>  
> @@ -758,7 +758,7 @@ test_expect_success 'rebase -i can copy notes over a fixup' '
>  	git reset --hard n3 &&
>  	git notes add -m"an earlier note" n2 &&
>  	set_fake_editor &&
> -	GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 fixup 2" git rebase -i n1 &&
> +	GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 f 2" git rebase -i n1 &&
>  	git notes show > output &&
>  	test_cmp expect output
>  '
> @@ -1208,7 +1208,7 @@ rebase_setup_and_clean () {
>  test_expect_success 'drop' '
>  	rebase_setup_and_clean drop-test &&
>  	set_fake_editor &&
> -	FAKE_LINES="1 drop 2 3 drop 4 5" git rebase -i --root &&
> +	FAKE_LINES="1 drop 2 3 d 4 5" git rebase -i --root &&
>  	test E = $(git cat-file commit HEAD | sed -ne \$p) &&
>  	test C = $(git cat-file commit HEAD^ | sed -ne \$p) &&
>  	test A = $(git cat-file commit HEAD^^ | sed -ne \$p)
> -- 
> 2.19.1.406.g1aa3f475f3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 sg/test-rebase-editor-fix] t3404-rebase-interactive: test abbreviated commands
  2018-10-26  8:11 ` Johannes Schindelin
@ 2018-10-27  8:08   ` Johannes Sixt
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2018-10-27  8:08 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git Mailing List

Make sure that each short command is tested at least once. To
not exacerbate the runtime of the test script, do not add new
tests, but modify existing ones according to these criteria:

- The test does not have a prerequisite.
- The 'git rebase' command is not guarded by test_must_fail.

The pick commands are optional in the FAKE_LINES variable, but
when used, they do end up in the insn sheet. Test them, too.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 v2:
 - updated commit message
 - patch text is unchanged

 t/lib-rebase.sh               |  4 ++--
 t/t3404-rebase-interactive.sh | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 2ca9fb69d6..0c93d00bdd 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -47,9 +47,9 @@ set_fake_editor () {
 	action=pick
 	for line in $FAKE_LINES; do
 		case $line in
-		pick|squash|fixup|edit|reword|drop)
+		pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d)
 			action="$line";;
-		exec*)
+		exec_*|x_*)
 			echo "$line" | sed 's/_/ /g' >> "$1";;
 		"#")
 			echo '# comment' >> "$1";;
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 352a52e59d..d36ee4f807 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -114,7 +114,7 @@ test_expect_success 'rebase -i with exec allows git commands in subdirs' '
 	git checkout master &&
 	mkdir subdir && (cd subdir &&
 	set_fake_editor &&
-	FAKE_LINES="1 exec_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
+	FAKE_LINES="1 x_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
 		git rebase -i HEAD^
 	)
 '
@@ -499,7 +499,7 @@ test_expect_success 'squash works as expected' '
 	git checkout -b squash-works no-conflict-branch &&
 	one=$(git rev-parse HEAD~3) &&
 	set_fake_editor &&
-	FAKE_LINES="1 squash 3 2" EXPECT_HEADER_COUNT=2 \
+	FAKE_LINES="1 s 3 2" EXPECT_HEADER_COUNT=2 \
 		git rebase -i HEAD~3 &&
 	test $one = $(git rev-parse HEAD~2)
 '
@@ -732,7 +732,7 @@ test_expect_success 'reword' '
 	git show HEAD^ | grep "D changed" &&
 	FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" git rebase -i A &&
 	git show HEAD~3 | grep "B changed" &&
-	FAKE_LINES="1 reword 2 3 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
+	FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" git rebase -i A &&
 	git show HEAD~2 | grep "C changed"
 '
 
@@ -758,7 +758,7 @@ test_expect_success 'rebase -i can copy notes over a fixup' '
 	git reset --hard n3 &&
 	git notes add -m"an earlier note" n2 &&
 	set_fake_editor &&
-	GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 fixup 2" git rebase -i n1 &&
+	GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 f 2" git rebase -i n1 &&
 	git notes show > output &&
 	test_cmp expect output
 '
@@ -1208,7 +1208,7 @@ rebase_setup_and_clean () {
 test_expect_success 'drop' '
 	rebase_setup_and_clean drop-test &&
 	set_fake_editor &&
-	FAKE_LINES="1 drop 2 3 drop 4 5" git rebase -i --root &&
+	FAKE_LINES="1 drop 2 3 d 4 5" git rebase -i --root &&
 	test E = $(git cat-file commit HEAD | sed -ne \$p) &&
 	test C = $(git cat-file commit HEAD^ | sed -ne \$p) &&
 	test A = $(git cat-file commit HEAD^^ | sed -ne \$p)
-- 
2.19.1.406.g1aa3f475f3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-27  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-25 20:54 [PATCH sg/test-rebase-editor-fix] t3404-rebase-interactive: test abbreviated commands Johannes Sixt
2018-10-25 21:04 ` Johannes Sixt
2018-10-26  8:11 ` Johannes Schindelin
2018-10-27  8:08   ` [PATCH v2 " Johannes Sixt

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).