Skip to content

Commit

Permalink
t7407: Use 'rev-parse --short' rather than bash's substring expansion…
Browse files Browse the repository at this point in the history
… notation

The substring expansion notation is a bashism that we have not so far
adopted.  Use 'git rev-parse --short' instead, as this also handles
the case where the unique abbreviation is longer than 7 characters.

Also fix the typo; the object name for submodule #2 was copied from
submodule #1's by mistake.

Suggested-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johan Herland authored and Junio C Hamano committed Aug 20, 2009
1 parent 64b19ff commit e3ae4a8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions t/t7407-submodule-foreach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,16 @@ submodulesha1=$(cd clone3/nested1/nested2/nested3/submodule && git rev-parse HEA
sub1sha1=$(cd clone3/sub1 && git rev-parse HEAD)
sub2sha1=$(cd clone3/sub2 && git rev-parse HEAD)
sub3sha1=$(cd clone3/sub3 && git rev-parse HEAD)
sub1sha1_short=$(cd clone3/sub1 && git rev-parse --short HEAD)
sub2sha1_short=$(cd clone3/sub2 && git rev-parse --short HEAD)

cat > expect <<EOF
$nested1sha1 nested1 (heads/master)
$nested2sha1 nested1/nested2 (heads/master)
$nested3sha1 nested1/nested2/nested3 (heads/master)
$submodulesha1 nested1/nested2/nested3/submodule (heads/master)
$sub1sha1 sub1 (${sub1sha1:0:7})
$sub2sha1 sub2 (${sub1sha1:0:7})
$sub1sha1 sub1 ($sub1sha1_short)
$sub2sha1 sub2 ($sub2sha1_short)
$sub3sha1 sub3 (heads/master)
EOF

Expand Down

0 comments on commit e3ae4a8

Please sign in to comment.