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

[PATCH] rebase--interactive: do not use one-or-more (\+) in sed.

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 1, 2007, 09:05 UTC
Message-ID
<7vejhiu565.fsf_-_@gitster.siamese.dyndns.org>
In-Reply-To
<7vmyw6u5ca.fsf@gitster.siamese.dyndns.org>

This is a continuation of the other one to avoid one-or-more operator in sed. At the same time, it actually tightens error checking, because the numbers in the squash messages are not padded with leading zero and cannot begin with 0.

With this, I think we do not have any more use of one-or-more (\+) in sed scripts.

---
 git-rebase--interactive.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index ec798a1..abc2b1c 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -190,7 +190,7 @@ nth_string () {
 
 make_squash_message () {
 	if test -f "$SQUASH_MSG"; then
-		COUNT=$(($(sed -n "s/^# This is [^0-9]*\([0-9]\+\).*/\1/p" \
+		COUNT=$(($(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \
 			< "$SQUASH_MSG" | tail -n 1)+1))
 		echo "# This is a combination of $COUNT commits."
 		sed -n "2,\$p" < "$SQUASH_MSG"
Previous: Junio C HamanoNext: Johannes Schindelin
Message 3 of 15 in “rebase -m: Fix incorrect short-logs of already applied commits.”
  1. rebase -m: Fix incorrect short-logs of already applied commits.Johannes Sixt, Sep 1, 2007
  2. Junio C HamanoSep 1, 2007
  3. rebase--interactive: do not use one-or-more (\+) in sed.Junio C Hamano, Sep 1, 2007
  4. Johannes SchindelinSep 1, 2007
  5. David KastrupSep 2, 2007
  6. Junio C HamanoSep 2, 2007
  7. David KastrupSep 2, 2007
  8. Simon 'corecode' SchubertSep 2, 2007
  9. Johannes SchindelinSep 2, 2007
  10. NixSep 2, 2007
  11. Benoit SIGOURESep 5, 2007
  12. NixSep 5, 2007
  13. David KastrupSep 1, 2007
  14. Johannes SixtSep 1, 2007
  15. Robin RosenbergSep 1, 2007

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.