summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-02-07 06:05:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-07 06:05:27 (GMT)
commit257507a35e1d13d8849bbdf9324a060232a82bdf (patch)
treefcee48127922c0e01577303b1270a2c60a285fe3 /git-submodule.sh
parent75e1a08b605b48a89d45d3b4401495909e0a61bf (diff)
parent0586a438f64bc13d6634379cbeeaa96c9e8241d9 (diff)
downloadgit-257507a35e1d13d8849bbdf9324a060232a82bdf.zip
git-257507a35e1d13d8849bbdf9324a060232a82bdf.tar.gz
git-257507a35e1d13d8849bbdf9324a060232a82bdf.tar.bz2
Merge branch 'sh/submodule-summary-abbrev-fix'
The "git submodule summary" subcommand showed shortened commit object names by mechanically truncating them at 7-hexdigit, which has been improved to let "rev-parse --short" scale the length of the abbreviation with the size of the repository. * sh/submodule-summary-abbrev-fix: git-submodule.sh: shorten submodule SHA-1s using rev-parse
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 02a0d72..b5f2bee 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -850,8 +850,11 @@ cmd_summary() {
;;
esac
- sha1_abbr_src=$(echo $sha1_src | cut -c1-7)
- sha1_abbr_dst=$(echo $sha1_dst | cut -c1-7)
+ sha1_abbr_src=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_src 2>/dev/null ||
+ echo $sha1_src | cut -c1-7)
+ sha1_abbr_dst=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_dst 2>/dev/null ||
+ echo $sha1_dst | cut -c1-7)
+
if test $status = T
then
blob="$(gettext "blob")"