diff --git a/etc/check-package-size.sh b/etc/check-package-size.sh index c23bad23336..3a05c237c0e 100755 --- a/etc/check-package-size.sh +++ b/etc/check-package-size.sh @@ -4,17 +4,17 @@ set -eu -o pipefail function enter () { local dir="${1:?need directory to enter}" - echo -n $' in' $dir $'\t→\t' - cd $dir + printf ' in %s \t→\t' "$dir" + cd -- "$dir" } function indent () { - "$@" | grep "package size" | while read -r line; do - echo " " $line + "$@" | grep -F 'package size' | while IFS= read -r line; do + echo " $line" done } -echo "in root: gitoxide CLI" +echo 'in root: gitoxide CLI' (enter gix-fsck && indent cargo diet -n --package-size-limit 10KB) (enter gix-actor && indent cargo diet -n --package-size-limit 10KB) (enter gix-archive && indent cargo diet -n --package-size-limit 10KB) diff --git a/gix-attributes/tests/fixtures/make_attributes_baseline.sh b/gix-attributes/tests/fixtures/make_attributes_baseline.sh index 47f109e971d..c31d78fbe9f 100755 --- a/gix-attributes/tests/fixtures/make_attributes_baseline.sh +++ b/gix-attributes/tests/fixtures/make_attributes_baseline.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash set -eu -o pipefail -mkdir basics; +mkdir basics function baseline() { { echo "$1" - GIT_ATTR_NOSYSTEM=1 git -c core.attributesFile=$PWD/user.attributes check-attr -a "$1" + GIT_ATTR_NOSYSTEM=1 git -c core.attributesFile="$PWD/user.attributes" check-attr -a "$1" echo } >> baseline } @@ -17,39 +17,40 @@ function baseline() { # based on https://github.com/git/git/blob/140b9478dad5d19543c1cb4fd293ccec228f1240/t/t0003-attributes.sh#L45 mkdir -p a/b/d a/c b - ( - echo "[attr]notest !test" - echo "\" d \" test=d" - echo " e test=e" - echo " e\" test=e" - echo "f test=f" - echo "a/i test=a/i" - echo "onoff test -test" - echo "offon -test test" - echo "no notest" - echo "A/e/F test=A/e/F" - echo "\!escaped test-escaped" - echo "**/recursive test-double-star-slash" - echo "a**f test-double-star-no-slash" - echo "dir-slash/ never" - echo "dir/** always" - ) > .gitattributes - ( - echo "g test=a/g" - echo "b/g test=a/b/g" - ) > a/.gitattributes - ( - echo "h test=a/b/h" - echo "d/* test=a/b/d/*" - echo "d/yes notest" - ) > a/b/.gitattributes - ( - echo "global test=global" - echo "z/x/a global-no-wildcard-case-test" - echo "z/x/* global-wildcard-case-test" - ) > user.attributes + { + echo '[attr]notest !test' + echo '" d " test=d' + echo ' e test=e' + echo ' e" test=e' + echo 'f test=f' + echo 'a/i test=a/i' + echo 'onoff test -test' + echo 'offon -test test' + echo 'no notest' + echo 'A/e/F test=A/e/F' + echo '\!escaped test-escaped' + echo '**/recursive test-double-star-slash' + echo 'a**f test-double-star-no-slash' + echo 'dir-slash/ never' + echo 'dir/** always' + } > .gitattributes + { + echo 'g test=a/g' + echo 'b/g test=a/b/g' + } > a/.gitattributes + { + echo 'h test=a/b/h' + echo 'd/* test=a/b/d/*' + echo 'd/yes notest' + } > a/b/.gitattributes + { + echo 'global test=global' + echo 'z/x/a global-no-wildcard-case-test' + echo 'z/x/* global-wildcard-case-test' + } > user.attributes - git add . && git commit -qm c1 + git add . + git commit -qm c1 baseline z/x/a baseline Z/x/a @@ -67,7 +68,7 @@ function baseline() { baseline a/recursive baseline a/b/recursive baseline a/b/c/recursive - baseline "!escaped" + baseline '!escaped' baseline af baseline axf baseline a/b/d/no @@ -77,7 +78,7 @@ function baseline() { baseline a/B/D/g baseline b/g baseline a/c/f - baseline "e\"" + baseline 'e"' baseline a/i baseline A/b/h baseline A/B/D/NO @@ -100,23 +101,23 @@ mkdir lookup-order (cd lookup-order function baseline_selected() { - local path=${1?first argument is the path to match} + local path="${1?first argument is the path to match}" shift { echo "$path" - git -c core.attributesFile=$PWD/user.attributes check-attr $@ -- "$path" + git -c core.attributesFile="$PWD/user.attributes" check-attr "$@" -- "$path" echo } >> baseline.selected } git init - cat < user.attributes + cat <<'EOF' > user.attributes [attr]my-text text [attr]my-binary binary * location=user EOF - cat < .gitattributes + cat <<'EOF' > .gitattributes [attr]b-cycle a-cycle my-text [attr]a-cycle b-cycle my-binary [attr]recursive recursively-assigned-attr diff --git a/gix-date/tests/fixtures/generate_git_date_baseline.sh b/gix-date/tests/fixtures/generate_git_date_baseline.sh index 45d5217b6a9..1b241350b1d 100755 --- a/gix-date/tests/fixtures/generate_git_date_baseline.sh +++ b/gix-date/tests/fixtures/generate_git_date_baseline.sh @@ -1,23 +1,24 @@ #!/usr/bin/env bash set -eu -o pipefail -git init; +git init function baseline() { - local test_date=$1 # first argument is the date to test - local test_name=$2 # second argument is the format name for re-formatting + local test_date="$1" # first argument is the date to test + local test_name="$2" # second argument is the format name for re-formatting + + local status=0 + git -c section.key="$test_date" config --type=expiry-date section.key || status="$?" - git -c section.key="$test_date" config --type=expiry-date section.key && status=0 || status=$? { - echo "$test_date" - echo "$test_name" - echo "$status" - if [ $status == 0 ] - then - git -c section.key="$test_date" config --type=expiry-date section.key - else - echo "-1" - fi + echo "$test_date" + echo "$test_name" + echo "$status" + if [ "$status" = 0 ]; then + git -c section.key="$test_date" config --type=expiry-date section.key + else + echo '-1' + fi } >> baseline.git } @@ -43,4 +44,3 @@ baseline '1234567890' 'UNIX' baseline '1660874655 +0800' 'RAW' # Note that we can't necessarily put 64bit dates here yet as `git` on the system might not yet support it. - diff --git a/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar b/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar index aced50eb9d7..073cb0db8a3 100644 Binary files a/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar and b/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar differ diff --git a/gix-object/fuzz/fuzz_targets/fuzz_commit_corpus_builder.sh b/gix-object/fuzz/fuzz_targets/fuzz_commit_corpus_builder.sh index 333448859bb..92044d9ab20 100755 --- a/gix-object/fuzz/fuzz_targets/fuzz_commit_corpus_builder.sh +++ b/gix-object/fuzz/fuzz_targets/fuzz_commit_corpus_builder.sh @@ -1,12 +1,12 @@ -#!/usr/bin/bash +#!/usr/bin/env bash -set -eox pipefail +set -eux -o pipefail -ROOT=$1 -OUTPUT_CORPUS=$2 -FIXTURES_DIR=$(readlink -f $ROOT/gix-object/tests/fixtures/commit) +root="$1" +output_corpus="$2" +fixtures_dir="$(readlink -f -- "$root/gix-object/tests/fixtures/commit")" -echo $ROOT -echo $FIXTURES_DIR +echo "$root" +echo "$fixtures_dir" -zip -j $OUTPUT_CORPUS $FIXTURES_DIR/* +zip -j "$output_corpus" "$fixtures_dir"/* diff --git a/gix-object/fuzz/fuzz_targets/fuzz_tag_corpus_builder.sh b/gix-object/fuzz/fuzz_targets/fuzz_tag_corpus_builder.sh index 5c4bafac585..9bf588b46b9 100755 --- a/gix-object/fuzz/fuzz_targets/fuzz_tag_corpus_builder.sh +++ b/gix-object/fuzz/fuzz_targets/fuzz_tag_corpus_builder.sh @@ -1,12 +1,12 @@ -#!/usr/bin/bash +#!/usr/bin/env bash -set -eox pipefail +set -eux -o pipefail -ROOT=$1 -OUTPUT_CORPUS=$2 -FIXTURES_DIR=$(readlink -f $ROOT/gix-object/tests/fixtures/tag) +root="$1" +output_corpus="$2" +fixtures_dir="$(readlink -f -- "$root/gix-object/tests/fixtures/tag")" -echo $ROOT -echo $FIXTURES_DIR +echo "$root" +echo "$fixtures_dir" -zip -j $OUTPUT_CORPUS $FIXTURES_DIR/* +zip -j "$output_corpus" "$fixtures_dir"/* diff --git a/gix-object/fuzz/fuzz_targets/fuzz_tree_corpus_builder.sh b/gix-object/fuzz/fuzz_targets/fuzz_tree_corpus_builder.sh index dac2aa33974..cc458e67fc3 100755 --- a/gix-object/fuzz/fuzz_targets/fuzz_tree_corpus_builder.sh +++ b/gix-object/fuzz/fuzz_targets/fuzz_tree_corpus_builder.sh @@ -1,12 +1,12 @@ -#!/usr/bin/bash +#!/usr/bin/env bash -set -eox pipefail +set -eux -o pipefail -ROOT=$1 -OUTPUT_CORPUS=$2 -FIXTURES_DIR=$(readlink -f $ROOT/gix-object/tests/fixtures/tree) +root="$1" +output_corpus="$2" +fixtures_dir="$(readlink -f -- "$root/gix-object/tests/fixtures/tree")" -echo $ROOT -echo $FIXTURES_DIR +echo "$root" +echo "$fixtures_dir" -zip -j $OUTPUT_CORPUS $FIXTURES_DIR/* +zip -j "$output_corpus" "$fixtures_dir"/*