git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Charvi Mendiratta <charvi077@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, sunshine@sunshineco.com,
	christian.couder@gmail.com, phillip.wood123@gmail.com,
	Charvi Mendiratta <charvi077@gmail.com>,
	Christian Couder <chriscool@tuxfamily.org>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: [PATCH v3 09/11] t/t3437: use named commits in the tests
Date: Wed, 10 Feb 2021 17:06:49 +0530	[thread overview]
Message-ID: <20210210113650.19715-10-charvi077@gmail.com> (raw)
In-Reply-To: <20210207181439.1178-1-charvi077@gmail.com>

Use the named commits in the tests so that they will still refer to the
same commit if the setup gets changed in the future whereas 'branch~2'
will change which commit it points to.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
---
 t/t3437-rebase-fixup-options.sh | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/t/t3437-rebase-fixup-options.sh b/t/t3437-rebase-fixup-options.sh
index 6b464989e9..6e981fa487 100755
--- a/t/t3437-rebase-fixup-options.sh
+++ b/t/t3437-rebase-fixup-options.sh
@@ -70,6 +70,7 @@ test_expect_success 'setup' '
 	echo B1 >B &&
 	test_tick &&
 	git commit --fixup=HEAD -a &&
+	git tag B1 &&
 	test_tick &&
 	git commit --allow-empty -F - <<-EOF &&
 	amend! B
@@ -91,6 +92,7 @@ test_expect_success 'setup' '
 	echo B2 >B &&
 	test_tick &&
 	FAKE_COMMIT_AMEND="edited squash" git commit --squash=HEAD -a &&
+	git tag B2 &&
 	echo B3 >B &&
 	test_tick &&
 	git commit -a -F - <<-EOF &&
@@ -104,6 +106,7 @@ test_expect_success 'setup' '
 	$EMPTY
 	edited 3
 	EOF
+	git tag B3 &&
 
 	GIT_AUTHOR_NAME="Rebase Author" &&
 	GIT_AUTHOR_EMAIL="rebase.author@example.com" &&
@@ -171,12 +174,12 @@ test_expect_success 'skipping fixup -C after fixup gives correct message' '
 '
 
 test_expect_success 'sequence of fixup, fixup -C & squash --signoff works' '
-	git checkout --detach branch &&
+	git checkout --detach B3 &&
 	FAKE_LINES="1 fixup 2 fixup_-C 3 fixup_-C 4 squash 5 fixup_-C 6" \
 		FAKE_COMMIT_AMEND=squashed \
 		FAKE_MESSAGE_COPY=actual-squash-message \
 		git -c commit.status=false rebase -ik --signoff A &&
-	git diff-tree --exit-code --patch HEAD branch -- &&
+	git diff-tree --exit-code --patch HEAD B3 -- &&
 	test_cmp_rev HEAD^ A &&
 	test_i18ncmp "$TEST_DIRECTORY/t3437/expected-squash-message" \
 		actual-squash-message
@@ -184,7 +187,7 @@ test_expect_success 'sequence of fixup, fixup -C & squash --signoff works' '
 
 test_expect_success 'first fixup -C commented out in sequence fixup fixup -C fixup -C' '
 	test_when_finished "test_might_fail git rebase --abort" &&
-	git checkout branch && git checkout --detach branch~2 &&
+	git checkout --detach B2~ &&
 	git log -1 --pretty=format:%b >expected-message &&
 	FAKE_LINES="1 fixup 2 fixup_-C 3 fixup_-C 4" git rebase -i A &&
 	test_cmp_rev HEAD^ A &&
@@ -194,12 +197,11 @@ test_expect_success 'first fixup -C commented out in sequence fixup fixup -C fix
 test_expect_success 'multiple fixup -c opens editor once' '
 	test_when_finished "test_might_fail git rebase --abort" &&
 	git checkout --detach A3 &&
-	base=$(git rev-parse HEAD~4) &&
 	FAKE_COMMIT_MESSAGE="Modified-A3" \
 		FAKE_LINES="1 fixup_-C 2 fixup_-c 3 fixup_-c 4" \
 		EXPECT_HEADER_COUNT=4 \
-		git rebase -i $base &&
-	test_cmp_rev $base HEAD^ &&
+		git rebase -i A &&
+	test_cmp_rev HEAD^ A &&
 	get_author HEAD >actual-author &&
 	test_cmp expected-author actual-author &&
 	test 1 = $(git show | grep Modified-A3 | wc -l)
@@ -217,12 +219,12 @@ test_expect_success 'sequence squash, fixup & fixup -c gives combined message' '
 '
 
 test_expect_success 'fixup -C works upon --autosquash with amend!' '
-	git checkout --detach branch &&
+	git checkout --detach B3 &&
 	FAKE_COMMIT_AMEND=squashed \
 		FAKE_MESSAGE_COPY=actual-squash-message \
 		git -c commit.status=false rebase -ik --autosquash \
 						--signoff A &&
-	git diff-tree --exit-code --patch HEAD branch -- &&
+	git diff-tree --exit-code --patch HEAD B3 -- &&
 	test_cmp_rev HEAD^ A &&
 	test_i18ncmp "$TEST_DIRECTORY/t3437/expected-squash-message" \
 		actual-squash-message
-- 
2.29.0.rc1


  parent reply	other threads:[~2021-02-10 11:44 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 18:14 [PATCH 0/7][Outreachy] Improve the 'fixup [-C | -c]' in interactive rebase Charvi Mendiratta
2021-02-07 18:14 ` [PATCH 1/7] sequencer: fixup the datatype of the 'flag' argument Charvi Mendiratta
2021-02-07 18:14 ` [PATCH 2/7] sequencer: rename a few functions Charvi Mendiratta
2021-02-07 18:14 ` [PATCH 3/7] rebase -i: clarify and fix 'fixup -c' rebase-todo help Charvi Mendiratta
2021-02-07 18:49   ` Eric Sunshine
2021-02-08  4:30     ` Charvi Mendiratta
2021-02-07 18:14 ` [PATCH 4/7] t/lib-rebase: change the implementation of commands with options Charvi Mendiratta
2021-02-07 18:14 ` [PATCH 5/7] t3437: fix indendation of the here-doc Charvi Mendiratta
2021-02-07 18:54   ` Eric Sunshine
2021-02-08  4:30     ` Charvi Mendiratta
2021-02-08 10:37     ` Phillip Wood
2021-02-07 18:14 ` [PATCH 6/7] t/t3437: update the tests Charvi Mendiratta
2021-02-07 18:43   ` Eric Sunshine
2021-02-08  4:30     ` Charvi Mendiratta
2021-02-07 18:14 ` [PATCH 7/7] doc/rebase -i: fix typo in the documentation of 'fixup' command Charvi Mendiratta
2021-02-07 18:57 ` [PATCH 0/7][Outreachy] Improve the 'fixup [-C | -c]' in interactive rebase Eric Sunshine
2021-02-08  4:31   ` Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 00/11][Outreachy] " Charvi Mendiratta
2021-02-08 21:57   ` Junio C Hamano
2021-02-09  7:19     ` Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 01/11] sequencer: fixup the datatype of the 'flag' argument Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 02/11] sequencer: rename a few functions Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 03/11] rebase -i: clarify and fix 'fixup -c' rebase-todo help Charvi Mendiratta
2021-02-08 21:24   ` Junio C Hamano
2021-02-09  7:13     ` Charvi Mendiratta
2021-02-09  8:33       ` Eric Sunshine
2021-02-09 19:08         ` Junio C Hamano
2021-02-09 19:13           ` Eric Sunshine
2021-02-10  5:43             ` Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 04/11] t/lib-rebase: change the implementation of commands with options Charvi Mendiratta
2021-02-08 21:36   ` Junio C Hamano
2021-02-08 23:19     ` Christian Couder
2021-02-09  7:19       ` Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 05/11] t/t3437: fix indentation of the here-doc Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 06/11] t/t3437: remove the dependency of 'expected-message' file from tests Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 07/11] t/t3437: check author date of the fixed up commit Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 08/11] t/t3437: simplify and document the test helpers Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 09/11] t/t3437: cleanup the 'setup' test and use named commits in the tests Charvi Mendiratta
2021-02-08 21:41   ` Junio C Hamano
2021-02-09  7:13     ` Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 10/11] t/t3437: fixup the test 'multiple fixup -c opens editor once' Charvi Mendiratta
2021-02-08 19:25 ` [PATCH v2 11/11] doc/rebase -i: fix typo in the documentation of 'fixup' command Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 00/11][Outreachy] Improve the 'fixup [-C | -c]' in interactive rebase Charvi Mendiratta
2021-02-11 17:19   ` Junio C Hamano
2021-02-11 22:26     ` Charvi Mendiratta
2021-02-11 22:44       ` Junio C Hamano
2021-02-12  0:19         ` Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 01/11] sequencer: fixup the datatype of the 'flag' argument Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 02/11] sequencer: rename a few functions Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 03/11] rebase -i: clarify and fix 'fixup -c' rebase-todo help Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 04/11] t/lib-rebase: update the documentation of FAKE_LINES Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 05/11] t/t3437: fixup here-docs in the 'setup' test Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 06/11] t/t3437: remove the dependency of 'expected-message' file from tests Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 07/11] t/t3437: check the author date of fixed up commit Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 08/11] t/t3437: simplify and document the test helpers Charvi Mendiratta
2021-02-10 11:36 ` Charvi Mendiratta [this message]
2021-02-10 11:36 ` [PATCH v3 10/11] t/t3437: fixup the test 'multiple fixup -c opens editor once' Charvi Mendiratta
2021-02-10 11:36 ` [PATCH v3 11/11] doc/rebase -i: fix typo in the documentation of 'fixup' command Charvi Mendiratta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210210113650.19715-10-charvi077@gmail.com \
    --to=charvi077@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood123@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).