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

Re: [PATCH v2] rebase -i: respect core.commentchar

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2013, 00:13 UTC
Message-ID
<7vehgmjsno.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130211230804.GF2270@serenity.lan>
John Keeping <john@keeping.me.uk> writes:
Show 9 quoted lines
> @@ -179,7 +182,9 @@ die_abort () {
>  }
>  
>  has_action () {
> -	sane_grep '^[^#]' "$1" >/dev/null
> +	echo "space stripped actions:" >&2
> +	git stripspace --strip-comments <"$1" >&2
> +	test -n "$(git stripspace --strip-comments <"$1")"
>  }
I'll remove the debugging remnants while queuing.
Show 8 quoted lines
>  	fixup)
>  		echo
> -		echo "# The $(nth_string $count) commit message will be skipped:"
> +		printf '%s\n' "$comment_char The $(nth_string $count) commit message will be skipped:"
>  		echo
> -		commit_message $2 | sed -e 's/^/#	/'
> +		# Change the space after the comment character to TAB:
> +		commit_message $2 | git stripspace --comment-lines | sed -e 's/ /	/'

I think this changes the behaviour but in a good way. It used to show an empty line in the incoming commit message to a hash followed by a trailing HT before the end of line, but now it only emits the comment char immediately followed by the end of line.

Show 10 quoted lines
> @@ -942,20 +948,18 @@ test -s "$todo" || echo noop >> "$todo"
>  test -n "$autosquash" && rearrange_squash "$todo"
>  test -n "$cmd" && add_exec_commands "$todo"
>  
> -cat >> "$todo" << EOF
> -
> -# Rebase $shortrevisions onto $shortonto
> -EOF
> +echo >>"$todo"
> +printf '%s\n' "$comment_char Rebase $shortrevisions onto $shortonto" >>"$todo"
I think you can still do
	cat >>"$todo" <<EOF
	$comment_char Rebase $shortrevisions onto...
	EOF

here with any funny comment character. Doing this with two separate I/O does not hurt very much, but the resulting code may be easier to scan if left as here-text with a single cat.

Please eyeball what is in 'pu' (I have a separate squashable fixup on top of your patch) and let me know if I made mistakes.

Thanks for working on this.
Previous: John KeepingNext: John Keeping
Message 6 of 13 in “rebase -i: respect core.commentchar”
  1. rebase -i: respect core.commentcharJohn Keeping, Feb 11, 2013
  2. Junio C HamanoFeb 11, 2013
  3. John KeepingFeb 11, 2013
  4. Junio C HamanoFeb 11, 2013
  5. rebase -i: respect core.commentcharJohn Keeping, Feb 11, 2013
  6. Junio C HamanoFeb 12, 2013
  7. John KeepingFeb 12, 2013
  8. Junio C HamanoFeb 12, 2013
  9. John KeepingFeb 12, 2013
  10. Junio C HamanoFeb 12, 2013
  11. Junio C HamanoFeb 12, 2013
  12. John KeepingFeb 12, 2013
  13. Junio C HamanoFeb 12, 2013

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.