Skip to content

Commit 257507a

Browse files
committed
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
2 parents 75e1a08 + 0586a43 commit 257507a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

git-submodule.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,11 @@ cmd_summary() {
850850
;;
851851
esac
852852

853-
sha1_abbr_src=$(echo $sha1_src | cut -c1-7)
854-
sha1_abbr_dst=$(echo $sha1_dst | cut -c1-7)
853+
sha1_abbr_src=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_src 2>/dev/null ||
854+
echo $sha1_src | cut -c1-7)
855+
sha1_abbr_dst=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_dst 2>/dev/null ||
856+
echo $sha1_dst | cut -c1-7)
857+
855858
if test $status = T
856859
then
857860
blob="$(gettext "blob")"

0 commit comments

Comments
 (0)