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

Re: [PATCH] rebase--interactive: count squash commits above 10 correctly

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 8, 2017, 03:26 UTC
Message-ID
<xmqqlgum1bbt.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170107082318.jj3izthx2ylscrns@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
>  git-rebase--interactive.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index b0a6f2b7ba..4734094a3f 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -425,7 +425,7 @@ update_squash_messages () {
>  	if test -f "$squash_msg"; then
>  		mv "$squash_msg" "$squash_msg".bak || exit
>  		count=$(($(sed -n \
> -			-e "1s/^$comment_char.*\([0-9][0-9]*\).*/\1/p" \
> +			-e "1s/^$comment_char[^0-9]*\([0-9][0-9]*\).*/\1/p" \

I would have written it to match ".*[^1-9]\([1-9][0-9]*\)", though. Even if a foreign language expresses all its words as digits (or has a digit as the last letter of the last word before the number), a translation into it must have a non-digit before the number to disambiguate---but I guess I am being ultra-pedantic, and I think what you wrote would be sufficient in practice.

As you guys discussed, this code will hopefully disappear in a cycle or two anyway ;-) Let's queue this as-is.

Thanks.
>  			-e "q" < "$squash_msg".bak)+1))
>  		{
>  			printf '%s\n' "$comment_char $(eval_ngettext \
Previous: Jeff King
Message 6 of 6 in “Squashing commits with git rebase -i may miscount commits in commit message”
  1. Brandon TolschJan 6, 2017
  2. Johannes SchindelinJan 6, 2017
  3. rebase--interactive: count squash commits above 10 correctlyJeff King, Jan 7, 2017
  4. Johannes SchindelinJan 7, 2017
  5. Jeff KingJan 7, 2017
  6. Junio C HamanoJan 8, 2017

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.