Skip to content

Commit 7303da3

Browse files
periperidipgitster
authored andcommitted
t7401: use 'short' instead of 'verify' and cut in rev-parse calls
'git rev-parse' can limit the number of characters in the hash it outputs using the '--short' option, thereby, making the 'cut' invocation redundant. Since using '--short' implies '--verify' as well, we can safely replace the latter with the former. This change results in the helper functions getting the hash in the same way 'summary' gets the hash internally. So, avoid the unnecessary invocation to 'cut' in the helper functions. Mentored-by: Christian Couder <[email protected]> Mentored-by: Kaartic Sivaraam <[email protected]> Signed-off-by: Shourya Shukla <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 94e06c9 commit 7303da3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/t7401-submodule-summary.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ add_file () {
2121
test_tick &&
2222
git commit -m "Add $name"
2323
done >/dev/null
24-
git rev-parse --verify HEAD | cut -c1-7
24+
git rev-parse --short HEAD
2525
cd "$owd"
2626
}
2727
commit_file () {
@@ -125,7 +125,7 @@ commit_file sm1 &&
125125
head3=$(
126126
cd sm1 &&
127127
git reset --hard HEAD~2 >/dev/null &&
128-
git rev-parse --verify HEAD | cut -c1-7
128+
git rev-parse --short HEAD
129129
)
130130

131131
test_expect_success 'modified submodule(backward)' "

0 commit comments

Comments
 (0)