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

Re: [PATCH] rebase: set REF_HEAD_DETACH in checkout_up_to_date()

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 11, 2022, 05:33 UTC
Message-ID
<xmqqczitaw8q.fsf@gitster.g>
In-Reply-To
<pull.1226.git.git.1646975144178.gitgitgadget@gmail.com>
"John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 19 quoted lines
> diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
> index 71b1735e1dd..0b92e78976c 100755
> --- a/t/t3400-rebase.sh
> +++ b/t/t3400-rebase.sh
> @@ -437,4 +437,25 @@ test_expect_success 'rebase when inside worktree subdirectory' '
>  	)
>  '
>  
> +test_expect_success 'rebase with oids' '
> +	git init main-wt &&
> +	(
> +		cd main-wt &&
> +		>file &&
> +		git add file &&
> +		git commit -m initial &&
> +		git checkout -b side &&
> +		echo >>file &&
> +		git commit -a -m side &&
> +		git checkout main &&
The above is sufficient set-up.
> +		git tag hold &&
> +		git checkout -B main hold &&

These two are unnecessary. It was there in my bisect "runme" script only because I originally used an out-of-line repository that is prepared beforehand, so that "move main back to hold and rerun the rebase" can be done regardless of the bug in the previous version checked during "bisect run".

> +		git rev-parse main >pre &&
> +		git rebase $(git rev-parse main) $(git rev-parse side) &&
> +		git rev-parse main >post &&
> +		test "$(git rev-parse side)" = "$(cat .git/HEAD)" &&

You may want to prepare for segfaulting "git rev-parse" in the above three lines.

Never "cat .git/HEAD".  use "git rev-parse".
Show 7 quoted lines
> +		test_cmp pre post
> +	)
> +'
> +
>  test_done
>
> base-commit: 1a4874565fa3b6668042216189551b98b4dc0b1b
Previous: John Cai via GitGitGadgetNext: Junio C Hamano
Message 2 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.