git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ghanshyam Thakkar" <shyamthakkar001@gmail.com>
To: <phillip.wood@dunelm.org.uk>, <git@vger.kernel.org>
Cc: "Christian Couder" <christian.couder@gmail.com>
Subject: Re: [PATCH 2/2] t7501: Add test for amending commit to add signoff.
Date: Tue, 09 Jan 2024 22:54:46 +0530	[thread overview]
Message-ID: <CYACMZ0L7W54.1VITNQ1ZHLZDP@gmail.com> (raw)
In-Reply-To: <2113e178-149b-49aa-9d78-ff1c480f754c@gmail.com>

On Tue Jan 9, 2024 at 4:14 PM IST, Phillip Wood wrote:
> Hi Ghanshyam
>
> On 09/01/2024 06:04, Ghanshyam Thakkar wrote:
> > This commit adds test for amending the latest commit to add
> > Signed-off-by trailer at the end of commit message.
>
> If we're not already testing this then it seems like a useful addition, 
> thanks for working on it. It would also be helpful to check that "git 
> commit --amend --signoff" does not add a Signed-off-by: trailer if it 
> already exists.

I hadn't thought of that. I have hastily sent the v2 without seeing this
comment. I will add this test in v3.
>
> > +test_expect_success 'amend commit to add signoff' '
> > +
> > +	test_when_finished "rm -rf testdir" &&
> > +	git init testdir &&
>
> As Christian said about the other patch in this series I don't think we 
> need a new repository here. In our test files we use the same repository 
> for the whole file unless there is a compelling reason not to.

Updated from v2 onwards.
>
> > +	echo content >testdir/file &&
> > +	git -C testdir add file &&
> > +	git -C testdir commit -m "file" &&
>
> I think these three lines can be replaced by
>
> 	test_commit --no-tag file file content

Thank you for the suggestion. I have updated the test to use test_commit.
>
> > +	git -C testdir commit --amend --signoff &&
>
> > +	git -C testdir log -1 --pretty=format:%B >actual &&
> > +	(
> > +		echo file &&
> > +		echo &&
> > +		git -C testdir var GIT_COMMITTER_IDENT >ident &&
> > +		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident
> > +	) >expected &&
> > +	test_cmp expected actual
>
> This section of the test can be improved by using test_commit_message
>
> 	test_commit_message HEAD <<-EOF
> 	file
> 	
> 	Signed-off-by: $GIT_COMMITER_NAME <$GIT_COMMITTER_EMAIL>
> 	EOF
I have updated the test to use above approach.

Thank you for the review!

  reply	other threads:[~2024-01-09 17:24 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 [this message]
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   ` [PATCH v3 2/2] t7501: add tests for --amend --signoff Ghanshyam Thakkar
2024-01-11 16:30     ` 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=CYACMZ0L7W54.1VITNQ1ZHLZDP@gmail.com \
    --to=shyamthakkar001@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /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 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 NNTP newsgroup(s).