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

Re: [PATCH v3 1/2] rebase: use test_commit helper in setup

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Mar 17, 2022, 13:37 UTC
Message-ID
<220317.86v8wcd7ig.gmgdl@evledraar.gmail.com>
In-Reply-To
<f658eb00bcd2429859bc7b0d3b19bfa8a7791ca8.1647487001.git.gitgitgadget@gmail.com>
On Thu, Mar 17 2022, John Cai via GitGitGadget wrote:
Show 43 quoted lines
> From: John Cai <johncai86@gmail.com>
>
> To prepare for the next commit that will test rebase with oids instead
> of branch names, update the rebase setup test to add a couple of tags we
> can use. This uses the test_commit helper so we can replace some lines
> that add a commit manually.
>
> Setting logAllRefUpdates is not necessary because it's on by default for
> repositories with a working tree.
>
> Helped-by: Phillip Wood <phillip.wood123@gmail.com>
> Signed-off-by: John Cai <johncai86@gmail.com>
> ---
>  t/t3400-rebase.sh | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
> index 71b1735e1dd..0643d015255 100755
> --- a/t/t3400-rebase.sh
> +++ b/t/t3400-rebase.sh
> @@ -18,10 +18,7 @@ GIT_AUTHOR_EMAIL=bogus@email@address
>  export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
>  
>  test_expect_success 'prepare repository with topic branches' '
> -	git config core.logAllRefUpdates true &&
> -	echo First >A &&
> -	git update-index --add A &&
> -	git commit -m "Add A." &&
> +	test_commit "Add A." A First First &&
>  	git checkout -b force-3way &&
>  	echo Dummy >Y &&
>  	git update-index --add Y &&
> @@ -32,9 +29,7 @@ test_expect_success 'prepare repository with topic branches' '
>  	git mv A D/A &&
>  	git commit -m "Move A." &&
>  	git checkout -b my-topic-branch main &&
> -	echo Second >B &&
> -	git update-index --add B &&
> -	git commit -m "Add B." &&
> +	test_commit "Add B." B Second Second &&
>  	git checkout -f main &&
>  	echo Third >>A &&
>  	git update-index A &&

At least these could also be done, and skimming there's a few more "git commit" that could also be converted:

diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 0643d015255..6dc8df8be7e 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -35,9 +35,7 @@ test_expect_success 'prepare repository with topic branches' '
 	git update-index A &&
 	git commit -m "Modify A." &&
 	git checkout -b side my-topic-branch &&
-	echo Side >>C &&
-	git add C &&
-	git commit -m "Add C" &&
+	test_commit --no-tag "Add C" C Side &&
 	git checkout -f my-topic-branch &&
 	git tag topic
 '
@@ -114,10 +112,7 @@ test_expect_success 'rebase off of the previous branch using "-"' '
 test_expect_success 'rebase a single mode change' '
 	git checkout main &&
 	git branch -D topic &&
-	echo 1 >X &&
-	git add X &&
-	test_tick &&
-	git commit -m prepare &&
+	test_commit prepare X 1 &&
 	git checkout -b modechange HEAD^ &&
 	echo 1 >X &&
 	git add X &&

Maybe worthwhile squashing in & doing the rest?

Note that --no-tag and --append allow for converting more than could be
in the past before those (relatively recently added) options.
Previous: John Cai via GitGitGadgetNext: John Cai via GitGitGadget
Message 25 of 41 in “rebase: set REF_HEAD_DETACH in checkout_up_to_date()”
  1. rebase: set REF_HEAD_DETACH in checkout_up_to_date()John Cai via GitGitGadget, Mar 11, 2022
  2. Junio C HamanoMar 11, 2022
  3. Junio C HamanoMar 11, 2022
  4. John CaiMar 11, 2022
  5. Phillip WoodMar 11, 2022
  6. John CaiMar 11, 2022
  7. John CaiMar 11, 2022
  8. Phillip WoodMar 11, 2022
  9. 0/2 rebase: update HEAD when is an oidJohn Cai via GitGitGadget, Mar 11, 2022
  10. 1/2 rebase: use test_commit helper in setupJohn Cai via GitGitGadget, Mar 11, 2022
  11. Junio C HamanoMar 13, 2022
  12. Phillip WoodMar 14, 2022
  13. Junio C HamanoMar 14, 2022
  14. 2/2 rebase: set REF_HEAD_DETACH in checkout_up_to_date()John Cai via GitGitGadget, Mar 11, 2022
  15. Junio C HamanoMar 13, 2022
  16. Phillip WoodMar 14, 2022
  17. Phillip WoodMar 14, 2022
  18. John CaiMar 14, 2022
  19. Phillip WoodMar 14, 2022
  20. 0/2 rebase: update HEAD when is an oidJohn Cai via GitGitGadget, Mar 17, 2022
  21. 2/2 rebase: set REF_HEAD_DETACH in checkout_up_to_date()John Cai via GitGitGadget, Mar 17, 2022
  22. Ævar Arnfjörð BjarmasonMar 17, 2022
  23. Junio C HamanoMar 17, 2022
  24. 1/2 rebase: use test_commit helper in setupJohn Cai via GitGitGadget, Mar 17, 2022
  25. Ævar Arnfjörð BjarmasonMar 17, 2022
  26. 0/3 rebase: update HEAD when is an oidJohn Cai via GitGitGadget, Mar 17, 2022
  27. 1/3 rebase: test showing bug in rebase with non-branchJohn Cai via GitGitGadget, Mar 17, 2022
  28. Junio C HamanoMar 17, 2022
  29. Junio C HamanoMar 17, 2022
  30. John CaiMar 17, 2022
  31. 2/3 rebase: use test_commit helper in setupJohn Cai via GitGitGadget, Mar 17, 2022
  32. Phillip WoodMar 18, 2022
  33. John CaiMar 18, 2022
  34. 3/3 rebase: set REF_HEAD_DETACH in checkout_up_to_date()John Cai via GitGitGadget, Mar 17, 2022
  35. Junio C HamanoMar 17, 2022
  36. John CaiMar 18, 2022
  37. 0/2 rebase: update HEAD when is an oidJohn Cai via GitGitGadget, Mar 18, 2022
  38. 1/2 rebase: use test_commit helper in setupJohn Cai via GitGitGadget, Mar 18, 2022
  39. Junio C HamanoMar 18, 2022
  40. 2/2 rebase: set REF_HEAD_DETACH in checkout_up_to_date()John Cai via GitGitGadget, Mar 18, 2022
  41. Junio C HamanoMar 18, 2022

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.