Skip to content

Commit c8c42b4

Browse files
authored
Merge pull request #1908 from EliahKagan/run-ci/scripts
Fix a few ShellCheck warnings and stylistic inconsistencies
2 parents 7b17da6 + 2dbd7ba commit c8c42b4

File tree

7 files changed

+84
-83
lines changed

7 files changed

+84
-83
lines changed

Diff for: etc/check-package-size.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ set -eu -o pipefail
44

55
function enter () {
66
local dir="${1:?need directory to enter}"
7-
echo -n $' in' $dir $'\t\t'
8-
cd $dir
7+
printf ' in %s \t→\t' "$dir"
8+
cd -- "$dir"
99
}
1010

1111
function indent () {
12-
"$@" | grep "package size" | while read -r line; do
13-
echo " " $line
12+
"$@" | grep -F 'package size' | while IFS= read -r line; do
13+
echo " $line"
1414
done
1515
}
1616

17-
echo "in root: gitoxide CLI"
17+
echo 'in root: gitoxide CLI'
1818
(enter gix-fsck && indent cargo diet -n --package-size-limit 10KB)
1919
(enter gix-actor && indent cargo diet -n --package-size-limit 10KB)
2020
(enter gix-archive && indent cargo diet -n --package-size-limit 10KB)

Diff for: gix-attributes/tests/fixtures/make_attributes_baseline.sh

+41-40
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22
set -eu -o pipefail
33

4-
mkdir basics;
4+
mkdir basics
55

66
function baseline() {
77
{
88
echo "$1"
9-
GIT_ATTR_NOSYSTEM=1 git -c core.attributesFile=$PWD/user.attributes check-attr -a "$1"
9+
GIT_ATTR_NOSYSTEM=1 git -c core.attributesFile="$PWD/user.attributes" check-attr -a "$1"
1010
echo
1111
} >> baseline
1212
}
@@ -17,39 +17,40 @@ function baseline() {
1717

1818
# based on https://github.com/git/git/blob/140b9478dad5d19543c1cb4fd293ccec228f1240/t/t0003-attributes.sh#L45
1919
mkdir -p a/b/d a/c b
20-
(
21-
echo "[attr]notest !test"
22-
echo "\" d \" test=d"
23-
echo " e test=e"
24-
echo " e\" test=e"
25-
echo "f test=f"
26-
echo "a/i test=a/i"
27-
echo "onoff test -test"
28-
echo "offon -test test"
29-
echo "no notest"
30-
echo "A/e/F test=A/e/F"
31-
echo "\!escaped test-escaped"
32-
echo "**/recursive test-double-star-slash"
33-
echo "a**f test-double-star-no-slash"
34-
echo "dir-slash/ never"
35-
echo "dir/** always"
36-
) > .gitattributes
37-
(
38-
echo "g test=a/g"
39-
echo "b/g test=a/b/g"
40-
) > a/.gitattributes
41-
(
42-
echo "h test=a/b/h"
43-
echo "d/* test=a/b/d/*"
44-
echo "d/yes notest"
45-
) > a/b/.gitattributes
46-
(
47-
echo "global test=global"
48-
echo "z/x/a global-no-wildcard-case-test"
49-
echo "z/x/* global-wildcard-case-test"
50-
) > user.attributes
20+
{
21+
echo '[attr]notest !test'
22+
echo '" d " test=d'
23+
echo ' e test=e'
24+
echo ' e" test=e'
25+
echo 'f test=f'
26+
echo 'a/i test=a/i'
27+
echo 'onoff test -test'
28+
echo 'offon -test test'
29+
echo 'no notest'
30+
echo 'A/e/F test=A/e/F'
31+
echo '\!escaped test-escaped'
32+
echo '**/recursive test-double-star-slash'
33+
echo 'a**f test-double-star-no-slash'
34+
echo 'dir-slash/ never'
35+
echo 'dir/** always'
36+
} > .gitattributes
37+
{
38+
echo 'g test=a/g'
39+
echo 'b/g test=a/b/g'
40+
} > a/.gitattributes
41+
{
42+
echo 'h test=a/b/h'
43+
echo 'd/* test=a/b/d/*'
44+
echo 'd/yes notest'
45+
} > a/b/.gitattributes
46+
{
47+
echo 'global test=global'
48+
echo 'z/x/a global-no-wildcard-case-test'
49+
echo 'z/x/* global-wildcard-case-test'
50+
} > user.attributes
5151

52-
git add . && git commit -qm c1
52+
git add .
53+
git commit -qm c1
5354

5455
baseline z/x/a
5556
baseline Z/x/a
@@ -67,7 +68,7 @@ function baseline() {
6768
baseline a/recursive
6869
baseline a/b/recursive
6970
baseline a/b/c/recursive
70-
baseline "!escaped"
71+
baseline '!escaped'
7172
baseline af
7273
baseline axf
7374
baseline a/b/d/no
@@ -77,7 +78,7 @@ function baseline() {
7778
baseline a/B/D/g
7879
baseline b/g
7980
baseline a/c/f
80-
baseline "e\""
81+
baseline 'e"'
8182
baseline a/i
8283
baseline A/b/h
8384
baseline A/B/D/NO
@@ -100,23 +101,23 @@ mkdir lookup-order
100101
(cd lookup-order
101102

102103
function baseline_selected() {
103-
local path=${1?first argument is the path to match}
104+
local path="${1?first argument is the path to match}"
104105
shift
105106
{
106107
echo "$path"
107-
git -c core.attributesFile=$PWD/user.attributes check-attr $@ -- "$path"
108+
git -c core.attributesFile="$PWD/user.attributes" check-attr "$@" -- "$path"
108109
echo
109110
} >> baseline.selected
110111
}
111112

112113
git init
113-
cat <<EOF > user.attributes
114+
cat <<'EOF' > user.attributes
114115
[attr]my-text text
115116
[attr]my-binary binary
116117
117118
* location=user
118119
EOF
119-
cat <<EOF > .gitattributes
120+
cat <<'EOF' > .gitattributes
120121
[attr]b-cycle a-cycle my-text
121122
[attr]a-cycle b-cycle my-binary
122123
[attr]recursive recursively-assigned-attr

Diff for: gix-date/tests/fixtures/generate_git_date_baseline.sh

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
#!/usr/bin/env bash
22
set -eu -o pipefail
33

4-
git init;
4+
git init
55

66
function baseline() {
7-
local test_date=$1 # first argument is the date to test
8-
local test_name=$2 # second argument is the format name for re-formatting
7+
local test_date="$1" # first argument is the date to test
8+
local test_name="$2" # second argument is the format name for re-formatting
9+
10+
local status=0
11+
git -c section.key="$test_date" config --type=expiry-date section.key || status="$?"
912

10-
git -c section.key="$test_date" config --type=expiry-date section.key && status=0 || status=$?
1113
{
12-
echo "$test_date"
13-
echo "$test_name"
14-
echo "$status"
15-
if [ $status == 0 ]
16-
then
17-
git -c section.key="$test_date" config --type=expiry-date section.key
18-
else
19-
echo "-1"
20-
fi
14+
echo "$test_date"
15+
echo "$test_name"
16+
echo "$status"
17+
if [ "$status" = 0 ]; then
18+
git -c section.key="$test_date" config --type=expiry-date section.key
19+
else
20+
echo '-1'
21+
fi
2122
} >> baseline.git
2223
}
2324

@@ -43,4 +44,3 @@ baseline '1234567890' 'UNIX'
4344
baseline '1660874655 +0800' 'RAW'
4445

4546
# Note that we can't necessarily put 64bit dates here yet as `git` on the system might not yet support it.
46-
Binary file not shown.
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

3-
set -eox pipefail
3+
set -eux -o pipefail
44

5-
ROOT=$1
6-
OUTPUT_CORPUS=$2
7-
FIXTURES_DIR=$(readlink -f $ROOT/gix-object/tests/fixtures/commit)
5+
root="$1"
6+
output_corpus="$2"
7+
fixtures_dir="$(readlink -f -- "$root/gix-object/tests/fixtures/commit")"
88

9-
echo $ROOT
10-
echo $FIXTURES_DIR
9+
echo "$root"
10+
echo "$fixtures_dir"
1111

12-
zip -j $OUTPUT_CORPUS $FIXTURES_DIR/*
12+
zip -j "$output_corpus" "$fixtures_dir"/*
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

3-
set -eox pipefail
3+
set -eux -o pipefail
44

5-
ROOT=$1
6-
OUTPUT_CORPUS=$2
7-
FIXTURES_DIR=$(readlink -f $ROOT/gix-object/tests/fixtures/tag)
5+
root="$1"
6+
output_corpus="$2"
7+
fixtures_dir="$(readlink -f -- "$root/gix-object/tests/fixtures/tag")"
88

9-
echo $ROOT
10-
echo $FIXTURES_DIR
9+
echo "$root"
10+
echo "$fixtures_dir"
1111

12-
zip -j $OUTPUT_CORPUS $FIXTURES_DIR/*
12+
zip -j "$output_corpus" "$fixtures_dir"/*
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

3-
set -eox pipefail
3+
set -eux -o pipefail
44

5-
ROOT=$1
6-
OUTPUT_CORPUS=$2
7-
FIXTURES_DIR=$(readlink -f $ROOT/gix-object/tests/fixtures/tree)
5+
root="$1"
6+
output_corpus="$2"
7+
fixtures_dir="$(readlink -f -- "$root/gix-object/tests/fixtures/tree")"
88

9-
echo $ROOT
10-
echo $FIXTURES_DIR
9+
echo "$root"
10+
echo "$fixtures_dir"
1111

12-
zip -j $OUTPUT_CORPUS $FIXTURES_DIR/*
12+
zip -j "$output_corpus" "$fixtures_dir"/*

0 commit comments

Comments
 (0)