Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ CASE_NUM=$((CASE_NUM + 1))
case_dir=$(new_case_dir)
project_dir="$case_dir/git-project-root"
mkdir -p "$project_dir/nested/subdir"
(cd "$project_dir" && git init -q && git config user.email t@t.test && git config user.name t && git commit -q --allow-empty -m init)
(cd "$project_dir" && git init -q && git -c user.email=t@t.test -c user.name=t -c commit.gpgsign=false commit -q --allow-empty -m init)
Comment thread
kyle-sexton marked this conversation as resolved.
# Derive the native-Windows form from `git rev-parse --show-toplevel` itself
# (forward-slash-to-backslash only) rather than `cygpath -w`: on this
# machine cygpath silently 8.3-shortens a profile segment (KyleSexton ->
Expand Down
16 changes: 7 additions & 9 deletions scripts/affected-tests.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SELF_DIR/.." && pwd)"
SCRIPT="$SELF_DIR/affected-tests.sh"
NO_SUITE="$SELF_DIR/affected-tests-no-suite.txt"
# shellcheck source=test-git-helpers.sh
. "$SELF_DIR/test-git-helpers.sh"

PASS=0
FAIL=0
Expand Down Expand Up @@ -42,11 +44,7 @@ mk_widget_consumer() {
mk_repo() {
local dir
dir="$(mktemp -d "${TMPDIR:-/tmp}/affected-tests-fixture.XXXXXX")"
git -C "$dir" init -q
git -C "$dir" config user.email t@t.test
git -C "$dir" config user.name test
git -C "$dir" config commit.gpgsign false
git -C "$dir" config core.autocrlf false
git_init_safe "$dir"
Comment thread
kyle-sexton marked this conversation as resolved.

mkdir -p "$dir/scripts" "$dir/lib" \
"$dir/plugins/alpha/hooks" "$dir/plugins/beta/hooks"
Expand Down Expand Up @@ -80,8 +78,8 @@ mk_repo() {
# A file no suite names and no no-suite pattern covers.
printf 'echo orphan\n' >"$dir/scripts/zzorphan-tool.sh"

git -C "$dir" add scripts lib plugins >/dev/null
git -C "$dir" commit -qm base >/dev/null
git_test_config "$dir" add scripts lib plugins >/dev/null
git_test_config "$dir" commit -qm base >/dev/null
printf '%s' "$dir"
}

Expand Down Expand Up @@ -144,8 +142,8 @@ mkdir -p "$repo/plugins/gamma/hooks"
printf 'widget_helper() { echo widget; }\n' >"$repo/plugins/gamma/hooks/widget.sh"
mk_widget_consumer "$repo/plugins/gamma/hooks/gamma-hook.sh"
suite_body gamma-hook >"$repo/plugins/gamma/hooks/gamma-hook.test.sh"
git -C "$repo" add plugins/gamma >/dev/null
git -C "$repo" commit -qm gamma >/dev/null
git_test_config "$repo" add plugins/gamma >/dev/null
git_test_config "$repo" commit -qm gamma >/dev/null
run_sel "$repo" lib/widget.sh
out="$OUT"
if [[ "$RC" -eq 0 ]] && has_line "$out" plugins/gamma/hooks/gamma-hook.test.sh; then
Expand Down
9 changes: 4 additions & 5 deletions scripts/check-changed-skills.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ set -uo pipefail

SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT="$SELF_DIR/check-changed-skills.sh"
# shellcheck source=test-git-helpers.sh
. "$SELF_DIR/test-git-helpers.sh"

PASS=0
FAIL=0
Expand All @@ -35,10 +37,7 @@ chmod +x "$STUB"
mk_repo() {
local dir
dir="$(mktemp -d)"
git -C "$dir" init -q
git -C "$dir" config user.email t@t.test
git -C "$dir" config user.name test
git -C "$dir" config commit.gpgsign false
git_init_safe "$dir"
mkdir -p "$dir/scripts"
cp "$SCRIPT" "$dir/scripts/check-changed-skills.sh"
printf '%s' "$dir"
Expand All @@ -52,7 +51,7 @@ add_skill() {
printf 'content %s\n' "$RANDOM" >"$path"
}

commit_all() { git -C "$1" add -A && git -C "$1" commit -qm "$2"; }
commit_all() { git_test_config "$1" add -A && git_test_config "$1" commit -qm "$2"; }
base_sha() { git -C "$1" rev-parse HEAD; }

# run <repo> <base> — invoke the script from the repo root, stub as checker.
Expand Down
Loading
Loading