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

Re: [PATCH v2 04/13] Teach rebase interactive the mark command

From
Junio C Hamano <junio@pobox.com>
Date
Apr 22, 2008, 05:32 UTC
Message-ID
<7vabjm78v2.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1208132469-26471-4-git-send-email-joerg@alea.gnuu.de>
Jörg Sommer <joerg@alea.gnuu.de> writes:
Show 44 quoted lines
> This new command can be used to set symbolic marks for an commit while
> doing a rebase. This symbolic name can later be used for merges or
> resets.
>
> The decision to use references for the marks and not files like done with
> the rewritten commits for preserve merges was made to ensure no commit
> objects get lost if prune is started while (a long term) rebase is
> running. This also unifies the checking of the validity of marks and
> references by using rev-parse for it.
>
> The usage of : as the sign for marks conforms with the tag sign of
> fast-export and fast-import.
>
> Signed-off-by: Jörg Sommer <joerg@alea.gnuu.de>
> ---
>  git-rebase--interactive.sh    |   37 ++++++++++++++++++++++++++++++++++++-
>  t/t3404-rebase-interactive.sh |   17 +++++++++++++++++
>  2 files changed, 53 insertions(+), 1 deletions(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 531ee94..6ac316a 100755
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -35,6 +35,8 @@ mark the corrected paths with 'git add <paths>', and
>  run 'git rebase --continue'"
>  export GIT_CHERRY_PICK_HELP
>  
> +mark_prefix=refs/rebase-marks/
> +
>  warn () {
>  	echo "$*" >&2
>  }
> @@ -105,7 +107,13 @@ die_with_patch () {
>  }
>  
>  cleanup_before_quit () {
> -	rm -rf "$DOTEST"
> +	rm -rf "$DOTEST" &&
> +	for ref in "$GIT_DIR/$mark_prefix"*
> +	do
> +		test "$ref" = "$GIT_DIR/$mark_prefix*" && continue
> +		git update-ref -d "${ref#$GIT_DIR/}" "${ref#$GIT_DIR/}" || \
> +			return 1
> +	done

In practice nobody would "run" pack-refs during the rebase session, but I have to wonder if it can be triggered to run as part of automated gc or something, in which case this loop does not work as intended. It needs to be rewritten using for-each-ref.

Show 11 quoted lines
> @@ -244,6 +252,19 @@ peek_next_command () {
>  	sed -n "1s/ .*$//p" < "$TODO"
>  }
>  
> +mark_to_ref () {
> +	case "$1" in
> +	:[!/]*)
> +		# :/SOMETHING is a reference for the last commit whose
> +                # message starts with SOMETHING
> +		echo "$mark_prefix${1#:}"
> +		;;
What was the conclusion of the mark-syntax discussion?

While I know the bang in ":[!negated]" is POSIX, I wonder if everybody's shell we care about groks it.

Could people run this with the shell they care about being supported (Solaris /bin/sh does not count) try this and yell loudly if you get "matches" please? I know bash and dash are Ok, but I do not have easy access to various flabours of BSDs (OSX included).

	case ":/foo" in
        :[!/]*)	echo matches ;;
	*)	echo does not ;;
	esac
Previous: Jörg SommerNext: Junio C Hamano
Message 53 of 104 in “Move redo merge code in a function”
  1. 1/4 Move redo merge code in a functionJörg Sommer, Mar 23, 2008
  2. 2/4 Rework redo_mergeJörg Sommer, Mar 23, 2008
  3. 3/4 Add a function for get the parents of a commitJörg Sommer, Mar 23, 2008
  4. 4/4 git-rebase -i: New option to support rebase with mergesJörg Sommer, Mar 23, 2008
  5. Johannes SchindelinMar 23, 2008
  6. Jörg SommerMar 24, 2008
  7. Johannes SchindelinMar 24, 2008
  8. Jörg SommerMar 24, 2008
  9. Junio C HamanoMar 24, 2008
  10. Junio C HamanoMar 24, 2008
  11. Jörg SommerMar 25, 2008
  12. Junio C HamanoMar 26, 2008
  13. Teach rebase interactive more commands to do better preserve mergesJörg Sommer, Apr 9, 2008
  14. 01/10 Teach rebase interactive the mark commandJörg Sommer, Apr 9, 2008
  15. 02/10 Teach rebase interactive the reset commandJörg Sommer, Apr 9, 2008
  16. 03/10 Teach rebase interactive the merge commandJörg Sommer, Apr 9, 2008
  17. 04/10 Move redo merge code in a functionJörg Sommer, Apr 9, 2008
  18. 05/10 Rework redo_mergeJörg Sommer, Apr 9, 2008
  19. 06/10 Unify the lenght of $SHORT* and the commits in the TODO listJörg Sommer, Apr 9, 2008
  20. 07/10 fake-editor: output TODO list if unchangedJörg Sommer, Apr 9, 2008
  21. 08/10 Don't append default merge message to -m messageJörg Sommer, Apr 9, 2008
  22. 09/10 Select all lines with fake-editorJörg Sommer, Apr 9, 2008
  23. 10/10 Do rebase with preserve merges with advanced TODO listJörg Sommer, Apr 9, 2008
  24. Junio C HamanoApr 12, 2008
  25. Jörg SommerApr 12, 2008
  26. Junio C HamanoApr 13, 2008
  27. Jörg SommerApr 13, 2008
  28. TarmiganApr 14, 2008
  29. Junio C HamanoApr 11, 2008
  30. Jörg SommerApr 12, 2008
  31. Mike RalphsonApr 10, 2008
  32. Jörg SommerApr 12, 2008
  33. Junio C HamanoApr 11, 2008
  34. Jörg SommerApr 12, 2008
  35. Shawn O. PearceApr 13, 2008
  36. Jörg SommerApr 13, 2008
  37. Shawn O. PearceApr 14, 2008
  38. Junio C HamanoApr 14, 2008
  39. Jörg SommerApr 14, 2008
  40. 01/13 fake-editor: output TODO list if unchangedJörg Sommer, Apr 14, 2008
  41. 02/13 Don't append default merge message to -m messageJörg Sommer, Apr 14, 2008
  42. 03/13 Move cleanup code into it's own functionJörg Sommer, Apr 14, 2008
  43. 04/13 Teach rebase interactive the mark commandJörg Sommer, Apr 14, 2008
  44. 05/13 Teach rebase interactive the reset commandJörg Sommer, Apr 14, 2008
  45. 06/13 Move redo merge code in a functionJörg Sommer, Apr 14, 2008
  46. 07/13 Teach rebase interactive the merge commandJörg Sommer, Apr 14, 2008
  47. 08/13 Unify the lenght of $SHORT* and the commits in the TODO listJörg Sommer, Apr 14, 2008
  48. 09/13 Select all lines with fake-editorJörg Sommer, Apr 14, 2008
  49. 10/13 Do rebase with preserve merges with advanced TODO listJörg Sommer, Apr 14, 2008
  50. 11/13 Add option --first-parentJörg Sommer, Apr 14, 2008
  51. 12/13 Teach rebase interactive the tag commandJörg Sommer, Apr 14, 2008
  52. 13/13 Add option --preserve-tagsJörg Sommer, Apr 14, 2008
  53. Junio C HamanoApr 22, 2008
  54. Junio C HamanoApr 22, 2008
  55. Johannes SchindelinApr 22, 2008
  56. Jörg SommerApr 22, 2008
  57. Johannes SchindelinApr 22, 2008
  58. Junio C HamanoApr 22, 2008
  59. Johannes SchindelinApr 22, 2008
  60. Junio C HamanoApr 29, 2008
  61. Johannes SchindelinApr 29, 2008
  62. Junio C HamanoApr 29, 2008
  63. Johannes SixtApr 29, 2008
  64. Johannes SchindelinApr 29, 2008
  65. Junio C HamanoApr 29, 2008
  66. Johannes SchindelinApr 29, 2008
  67. Junio C HamanoApr 29, 2008
  68. Johannes SchindelinApr 29, 2008
  69. Junio C HamanoApr 29, 2008
  70. Johannes SchindelinApr 29, 2008
  71. Junio C HamanoApr 30, 2008
  72. Johannes SixtApr 30, 2008
  73. Junio C HamanoApr 30, 2008
  74. Johannes SchindelinApr 30, 2008
  75. Junio C HamanoApr 30, 2008
  76. Johannes SixtApr 30, 2008
  77. Johannes SchindelinApr 30, 2008
  78. Junio C HamanoMay 1, 2008
  79. Johannes SchindelinMay 3, 2008
  80. Junio C HamanoMay 3, 2008
  81. Johannes SchindelinMay 4, 2008
  82. Jörg SommerMay 4, 2008
  83. Dmitry PotapovApr 30, 2008
  84. Johannes SchindelinMay 1, 2008
  85. Junio C HamanoApr 22, 2008
  86. Jörg SommerApr 25, 2008
  87. Teach rebase interactive the mark commandJörg Sommer, Apr 25, 2008
  88. Junio C HamanoApr 27, 2008
  89. Jörg SommerApr 27, 2008
  90. Teach rebase interactive the mark commandJörg Sommer, Apr 14, 2008
  91. Shawn O. PearceApr 14, 2008
  92. mark parsing in fast-importJörg Sommer, Apr 20, 2008
  93. Shawn O. PearceApr 21, 2008
  94. Jörg SommerApr 21, 2008
  95. Shawn O. PearceApr 21, 2008
  96. Jörg SommerApr 22, 2008
  97. Shawn O. PearceApr 22, 2008
  98. Make mark parsing much more restrictiveJörg Sommer, Apr 25, 2008
  99. Junio C HamanoApr 20, 2008
  100. Jörg SommerApr 21, 2008
  101. Junio C HamanoApr 22, 2008
  102. Johannes SchindelinMar 23, 2008
  103. Johannes SchindelinMar 23, 2008
  104. Johannes SchindelinMar 23, 2008

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.