git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Subject: [PATCH] submodule: use abbreviated sha1 in 'status' output
Date: Sat, 29 Sep 2012 19:13:15 +0530	[thread overview]
Message-ID: <1348926195-4788-2-git-send-email-artagnon@gmail.com> (raw)
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

  reply	other threads:[~2012-09-29 13:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-29 13:43 [PATCH] submodule: make 'show' an alias for 'summary' Ramkumar Ramachandra
2012-09-29 13:43 ` Ramkumar Ramachandra [this message]
2012-09-29 14:31   ` [PATCH] submodule: use abbreviated sha1 in 'status' output Jens Lehmann
2012-09-29 14:45     ` Ramkumar Ramachandra
2012-09-29 15:05       ` Jens Lehmann
2012-10-01  6:42         ` Ramkumar Ramachandra
2012-10-01 17:22           ` Jens Lehmann
2012-09-29 14:49 ` [PATCH] submodule: make 'show' an alias for 'summary' Jens Lehmann
2012-09-29 15:07   ` Ramkumar Ramachandra
2012-09-29 15:27     ` Jens Lehmann
2012-10-01  6:45       ` Ramkumar Ramachandra
2012-10-01 17:26         ` Jens Lehmann
2012-10-01 17:33           ` Ramkumar Ramachandra
2012-10-01 19:31             ` Jens Lehmann
2012-10-01 17:41           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348926195-4788-2-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).