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

[PATCH] submodule: use abbreviated sha1 in 'status' output

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Sep 29, 2012, 13:43 UTC
Message-ID
<1348926195-4788-2-git-send-email-artagnon@gmail.com>
In-Reply-To
<1348926195-4788-1-git-send-email-artagnon@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 git-submodule.sh |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 1d61ebd..f8efc52 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -942,27 +942,28 @@ cmd_status()
 		name=$(module_name "$sm_path") || exit
 		url=$(git config submodule."$name".url)
 		displaypath="$prefix$sm_path"
+		sha1_abbr=$(git rev-parse --short "$sha1")
 		if test "$stage" = U
 		then
-			say "U$sha1 $displaypath"
+			say "U$sha1_abbr $displaypath"
 			continue
 		fi
 		if test -z "$url" || ! test -d "$sm_path"/.git -o -f "$sm_path"/.git
 		then
-			say "-$sha1 $displaypath"
+			say "-$sha1_abbr $displaypath"
 			continue;
 		fi
-		set_name_rev "$sm_path" "$sha1"
+		set_name_rev "$sm_path" "$sha1_abbr"
 		if git diff-files --ignore-submodules=dirty --quiet -- "$sm_path"
 		then
-			say " $sha1 $displaypath$revname"
+			say " $sha1_abbr $displaypath$revname"
 		else
 			if test -z "$cached"
 			then
-				sha1=$(clear_local_git_env; cd "$sm_path" && git rev-parse --verify HEAD)
-				set_name_rev "$sm_path" "$sha1"
+				sha1_abbr=$(clear_local_git_env; cd "$sm_path" && git rev-parse --short --verify HEAD)
+				set_name_rev "$sm_path" "$sha1_abbr"
 			fi
-			say "+$sha1 $displaypath$revname"
+			say "+$sha1_abbr $displaypath$revname"
 		fi
 
 		if test -n "$recursive"
-- 
1.7.10.4
Previous: Ramkumar RamachandraNext: Jens Lehmann
Message 2 of 15 in “submodule: make 'show' an alias for 'summary'”
  1. submodule: make 'show' an alias for 'summary'Ramkumar Ramachandra, Sep 29, 2012
  2. submodule: use abbreviated sha1 in 'status' outputRamkumar Ramachandra, Sep 29, 2012
  3. Jens LehmannSep 29, 2012
  4. Ramkumar RamachandraSep 29, 2012
  5. Jens LehmannSep 29, 2012
  6. Ramkumar RamachandraOct 1, 2012
  7. Jens LehmannOct 1, 2012
  8. Jens LehmannSep 29, 2012
  9. Ramkumar RamachandraSep 29, 2012
  10. Jens LehmannSep 29, 2012
  11. Ramkumar RamachandraOct 1, 2012
  12. Jens LehmannOct 1, 2012
  13. Ramkumar RamachandraOct 1, 2012
  14. Jens LehmannOct 1, 2012
  15. Junio C HamanoOct 1, 2012

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.