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

[PATCH] git-submodule summary: fix that some "wc" flavors produce leading spaces

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Mar 12, 2008, 08:30 UTC
Message-ID
<47D79489.2070004@viscovery.net>
In-Reply-To
<1205243539-797-3-git-send-email-pkufranky@gmail.com>
From: Johannes Sixt <johannes.sixt@telecom.at>

We print the number of commits in parentheses, but without this change we would get an oddly looking line like this:

    * sm1 4c8d358...41fbea9 (      4):
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
	How portable is this?
	-- Hannes
 git-submodule.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index f7a6ee2..221a4c8 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -462,7 +462,7 @@ cmd_summary() {
 			GIT_DIR="$name/.git" \
 			git log --pretty=oneline --first-parent $range | wc -l
 			)
-			total_commits=" ($total_commits)"
+			total_commits=" ($(($total_commits + 0)))"
 			;;
 		esac
-- 
1.5.4.4.1329.g2c612
Previous: Ping Yin
Message 14 of 14 in “git-submodule summary”
  1. 0/5 git-submodule summaryPing Yin, Mar 11, 2008
  2. 1/5 git-submodule summary: code frameworkPing Yin, Mar 11, 2008
  3. 2/5 git-submodule summary: show commit summaryPing Yin, Mar 11, 2008
  4. 3/5 git-submodule summary: limit summary sizePing Yin, Mar 11, 2008
  5. 4/5 git-submodule summary: documentationPing Yin, Mar 11, 2008
  6. 5/5 git-submodule summary: testPing Yin, Mar 11, 2008
  7. Ping YinMar 12, 2008
  8. Junio C HamanoMar 12, 2008
  9. Ping YinMar 12, 2008
  10. Junio C HamanoMar 12, 2008
  11. Ping YinMar 12, 2008
  12. Junio C HamanoMar 12, 2008
  13. Ping YinMar 12, 2008
  14. git-submodule summary: fix that some "wc" flavors produce leading spacesJohannes Sixt, Mar 12, 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.