git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] t7501: Add test for amending commit to add signoff.

From
Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Date
Jan 9, 2024, 17:24 UTC
Message-ID
<CYACMZ0L7W54.1VITNQ1ZHLZDP@gmail.com>
In-Reply-To
<2113e178-149b-49aa-9d78-ff1c480f754c@gmail.com>
On Tue Jan 9, 2024 at 4:14 PM IST, Phillip Wood wrote:
Show 10 quoted lines
> 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.

Show 9 quoted lines
>
> > +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.
Show 8 quoted lines
>
> > +	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.
Show 19 quoted lines
>
> > +	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!
Previous: Phillip WoodNext: Junio C Hamano
Message 8 of 37 in “[GSOC] t7501: Add tests for various index usages, -i and -o, of commit command and amending commit to add signoff.”
  1. 0/2 [GSOC] t7501: Add tests for various index usages, -i and -o, of commit command and amending commit to add signoff.Ghanshyam Thakkar, Jan 9, 2024
  2. 1/2 t7501: Add tests for various index usages, -i and -o, of commit command.Ghanshyam Thakkar, Jan 9, 2024
  3. Christian CouderJan 9, 2024
  4. Ghanshyam ThakkarJan 9, 2024
  5. Junio C HamanoJan 9, 2024
  6. 2/2 t7501: Add test for amending commit to add signoff.Ghanshyam Thakkar, Jan 9, 2024
  7. Phillip WoodJan 9, 2024
  8. Ghanshyam ThakkarJan 9, 2024
  9. Junio C HamanoJan 9, 2024
  10. Christian CouderJan 9, 2024
  11. 0/2 t7501: add tests for --include, --only,Ghanshyam Thakkar, Jan 9, 2024
  12. 0/2 t7501: add tests for --include, --only andGhanshyam Thakkar, Jan 10, 2024
  13. 0/2 t7501: add tests for --include, --only, --signoffGhanshyam Thakkar, Jan 12, 2024
  14. 1/2 t7501: add tests for --include and --onlyGhanshyam Thakkar, Jan 12, 2024
  15. Junio C HamanoJan 12, 2024
  16. Ghanshyam ThakkarJan 13, 2024
  17. Junio C HamanoJan 13, 2024
  18. Ghanshyam ThakkarJan 13, 2024
  19. 2/2 t7501: add tests for --amend --signoffGhanshyam Thakkar, Jan 12, 2024
  20. 0/2 t7501: add tests for --include, --only, --signoffGhanshyam Thakkar, Jan 13, 2024
  21. 1/2 t7501: add tests for --include and --onlyGhanshyam Thakkar, Jan 13, 2024
  22. Junio C HamanoJan 16, 2024
  23. Junio C HamanoJan 16, 2024
  24. 2/2 t7501: add tests for --amend --signoffGhanshyam Thakkar, Jan 13, 2024
  25. 0/2 t7501: add tests for --include, --only, --signoffGhanshyam Thakkar, Jan 17, 2024
  26. 1/2 t7501: add tests for --include and --onlyGhanshyam Thakkar, Jan 17, 2024
  27. 2/2 t7501: add tests for --amend --signoffGhanshyam Thakkar, Jan 17, 2024
  28. Junio C HamanoJan 17, 2024
  29. 1/2 t7501: add tests for --include and --onlyGhanshyam Thakkar, Jan 10, 2024
  30. Junio C HamanoJan 10, 2024
  31. Ghanshyam ThakkarJan 11, 2024
  32. phillip.wood123@gmail.comJan 11, 2024
  33. 2/2 t7501: add tests for --amend --signoffGhanshyam Thakkar, Jan 10, 2024
  34. phillip.wood123@gmail.comJan 11, 2024
  35. 1/2 t7501: add tests for --include, --only of commitGhanshyam Thakkar, Jan 9, 2024
  36. Junio C HamanoJan 9, 2024
  37. 2/2 t7501: add test for --amend with --signoffGhanshyam Thakkar, Jan 9, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.