All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
To: git@vger.kernel.org
Cc: phillip.wood123@gmail.com, christian.couder@gmail.com,
	gitster@pobox.com, Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Subject: [PATCH v3 2/2] t7501: add tests for --amend --signoff
Date: Wed, 10 Jan 2024 22:05:20 +0530	[thread overview]
Message-ID: <20240110163622.51182-6-shyamthakkar001@gmail.com> (raw)
In-Reply-To: <20240109165304.8027-2-shyamthakkar001@gmail.com>

Add tests for amending the commit to add Signed-off-by trailer. And
also to check if it does not add another trailer if one already exists.

Currently, there are tests for --signoff separately in t7501, however,
they are not tested with --amend.

Therefore, these tests belong with other similar tests of --amend in
t7501-commit-basic-functionality.

Signed-off-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
---
 t/t7501-commit-basic-functionality.sh | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/t/t7501-commit-basic-functionality.sh b/t/t7501-commit-basic-functionality.sh
index e005175d0b..546d60d7fc 100755
--- a/t/t7501-commit-basic-functionality.sh
+++ b/t/t7501-commit-basic-functionality.sh
@@ -3,8 +3,7 @@
 # Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com>
 #
 
-# fixme: test the various index usages, test reflog,
-# signoff
+# fixme: test the various index usages, test reflog
 
 test_description='git commit'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
@@ -430,6 +429,30 @@ test_expect_success 'amend commit to fix date' '
 
 '
 
+test_expect_success 'amend commit to add signoff' '
+
+	test_commit "msg" file content &&
+	git commit --amend --signoff &&
+	test_commit_message HEAD <<-EOF
+	msg
+
+	Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
+	EOF
+
+'
+
+test_expect_success 'amend does not add signoff if it already exists' '
+
+	test_commit --signoff "tenor" file newcontent &&
+	git commit --amend --signoff &&
+	test_commit_message HEAD <<-EOF
+	tenor
+
+	Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
+	EOF
+
+'
+
 test_expect_success 'commit mentions forced date in output' '
 	git commit --amend --date=2010-01-02T03:04:05 >output &&
 	grep "Date: *Sat Jan 2 03:04:05 2010" output
-- 
2.43.0


  parent reply	other threads:[~2024-01-10 16:37 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09  6:04 [PATCH 0/2][GSOC] t7501: Add tests for various index usages, -i and -o, of commit command and amending commit to add signoff Ghanshyam Thakkar
2024-01-09  6:04 ` [PATCH 1/2] t7501: Add tests for various index usages, -i and -o, of commit command Ghanshyam Thakkar
2024-01-09  9:20   ` Christian Couder
2024-01-09 17:10     ` Ghanshyam Thakkar
2024-01-09 17:35   ` Junio C Hamano
2024-01-09  6:04 ` [PATCH 2/2] t7501: Add test for amending commit to add signoff Ghanshyam Thakkar
2024-01-09 10:44   ` Phillip Wood
2024-01-09 17:24     ` Ghanshyam Thakkar
2024-01-09 17:45   ` Junio C Hamano
2024-01-09  9:32 ` [PATCH 0/2][GSOC] t7501: Add tests for various index usages, -i and -o, of commit command and " Christian Couder
2024-01-09 16:51 ` [PATCH v2 0/2] t7501: add tests for --include, --only, Ghanshyam Thakkar
2024-01-10 16:35   ` [PATCH v3 0/2] t7501: add tests for --include, --only and Ghanshyam Thakkar
2024-01-12 18:00     ` [PATCH v4 0/2] t7501: add tests for --include, --only, --signoff Ghanshyam Thakkar
2024-01-12 18:00       ` [PATCH v4 1/2] t7501: add tests for --include and --only Ghanshyam Thakkar
2024-01-12 23:10         ` Junio C Hamano
2024-01-13  1:00           ` Ghanshyam Thakkar
2024-01-13  1:16         ` Junio C Hamano
2024-01-13  1:47           ` Ghanshyam Thakkar
2024-01-12 18:00       ` [PATCH v4 2/2] t7501: add tests for --amend --signoff Ghanshyam Thakkar
2024-01-13  4:21       ` [PATCH v5 0/2] t7501: add tests for --include, --only, --signoff Ghanshyam Thakkar
2024-01-13  4:21         ` [PATCH v5 1/2] t7501: add tests for --include and --only Ghanshyam Thakkar
2024-01-16 15:41           ` Junio C Hamano
2024-01-16 15:56           ` Junio C Hamano
2024-01-13  4:21         ` [PATCH v5 2/2] t7501: add tests for --amend --signoff Ghanshyam Thakkar
2024-01-17 16:13         ` [PATCH v6 0/2] t7501: add tests for --include, --only, --signoff Ghanshyam Thakkar
2024-01-17 16:13           ` [PATCH v6 1/2] t7501: add tests for --include and --only Ghanshyam Thakkar
2024-01-17 16:13           ` [PATCH v6 2/2] t7501: add tests for --amend --signoff Ghanshyam Thakkar
2024-01-17 21:33           ` [PATCH v6 0/2] t7501: add tests for --include, --only, --signoff Junio C Hamano
2024-01-10 16:35   ` [PATCH v3 1/2] t7501: add tests for --include and --only Ghanshyam Thakkar
2024-01-10 18:37     ` Junio C Hamano
2024-01-11  1:58       ` Ghanshyam Thakkar
2024-01-11 16:33     ` phillip.wood123
2024-01-10 16:35   ` Ghanshyam Thakkar [this message]
2024-01-11 16:30     ` [PATCH v3 2/2] t7501: add tests for --amend --signoff phillip.wood123
2024-01-09 16:51 ` [PATCH v2 1/2] t7501: add tests for --include, --only of commit Ghanshyam Thakkar
2024-01-09 17:50   ` Junio C Hamano
2024-01-09 16:51 ` [PATCH v2 2/2] t7501: add test for --amend with --signoff Ghanshyam Thakkar

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

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

  git send-email \
    --in-reply-to=20240110163622.51182-6-shyamthakkar001@gmail.com \
    --to=shyamthakkar001@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood123@gmail.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.