Skip to content

Commit e3ae4a8

Browse files
jherlandgitster
authored andcommitted
t7407: Use 'rev-parse --short' rather than bash's substring expansion 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 <[email protected]> Signed-off-by: Johan Herland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 64b19ff commit e3ae4a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/t7407-submodule-foreach.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,16 @@ submodulesha1=$(cd clone3/nested1/nested2/nested3/submodule && git rev-parse HEA
201201
sub1sha1=$(cd clone3/sub1 && git rev-parse HEAD)
202202
sub2sha1=$(cd clone3/sub2 && git rev-parse HEAD)
203203
sub3sha1=$(cd clone3/sub3 && git rev-parse HEAD)
204+
sub1sha1_short=$(cd clone3/sub1 && git rev-parse --short HEAD)
205+
sub2sha1_short=$(cd clone3/sub2 && git rev-parse --short HEAD)
204206

205207
cat > expect <<EOF
206208
$nested1sha1 nested1 (heads/master)
207209
$nested2sha1 nested1/nested2 (heads/master)
208210
$nested3sha1 nested1/nested2/nested3 (heads/master)
209211
$submodulesha1 nested1/nested2/nested3/submodule (heads/master)
210-
$sub1sha1 sub1 (${sub1sha1:0:7})
211-
$sub2sha1 sub2 (${sub1sha1:0:7})
212+
$sub1sha1 sub1 ($sub1sha1_short)
213+
$sub2sha1 sub2 ($sub2sha1_short)
212214
$sub3sha1 sub3 (heads/master)
213215
EOF
214216

0 commit comments

Comments
 (0)