t/t5303-pack-corruption-resilience.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}" done and then carefully proof-read. Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elia Pinto committed
Dec 23, 2015 at 14:45 UTC
a64d080fff93ba87d399085b56e9e86d28493c79
1 file changed
+8
-8
t/t5303-pack-corruption-resilience.sh
+8
-8
@@ -32,23 +32,23 @@ create_test_files() {
32
create_new_pack() {
33
rm -rf .git &&
34
git init &&
35
- blob_1=`git hash-object -t blob -w file_1` &&
36
- blob_2=`git hash-object -t blob -w file_2` &&
37
- blob_3=`git hash-object -t blob -w file_3` &&
38
- pack=`printf "$blob_1\n$blob_2\n$blob_3\n" |
39
- git pack-objects $@ .git/objects/pack/pack` &&
35
+ blob_1=$(git hash-object -t blob -w file_1) &&
36
+ blob_2=$(git hash-object -t blob -w file_2) &&
37
+ blob_3=$(git hash-object -t blob -w file_3) &&
38
+ pack=$(printf "$blob_1\n$blob_2\n$blob_3\n" |
39
+ git pack-objects $@ .git/objects/pack/pack) &&
40
pack=".git/objects/pack/pack-${pack}" &&
41
git verify-pack -v ${pack}.pack
42
}
43
44
do_repack() {
45
- pack=`printf "$blob_1\n$blob_2\n$blob_3\n" |
46
- git pack-objects $@ .git/objects/pack/pack` &&
45
+ pack=$(printf "$blob_1\n$blob_2\n$blob_3\n" |
46
+ git pack-objects $@ .git/objects/pack/pack) &&
47
pack=".git/objects/pack/pack-${pack}"
48
}
49
50
do_corrupt_object() {
51
- ofs=`git show-index < ${pack}.idx | grep $1 | cut -f1 -d" "` &&
51
+ ofs=$(git show-index < ${pack}.idx | grep $1 | cut -f1 -d" ") &&
52
ofs=$(($ofs + $2)) &&
53
chmod +w ${pack}.pack &&
54
dd of=${pack}.pack bs=1 conv=notrunc seek=$ofs &&