Skip to content

Commit

Permalink
Fix existing test issues 💙
Browse files Browse the repository at this point in the history
  • Loading branch information
rycus86 committed Oct 7, 2024
1 parent 89f5359 commit 61e0a47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions base-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ set_main_variables() {
ACCEPT_CHANGES=

CURRENT_GIT_DIR=$(git rev-parse --git-common-dir 2>/dev/null)
if [ -z "${CURRENT_GIT_DIR}" ] && [ -n "${GIT_DIR}" ]; then
# Patch up the current git dir when the above did not find it yet, perhaps during git init
CURRENT_GIT_DIR="${GIT_DIR}"
fi
if [ ! -d "${CURRENT_GIT_DIR}" ]; then
echo "! Hook not run inside a git repository" >&2
return 1
Expand Down Expand Up @@ -405,12 +409,10 @@ is_trusted_repo() {
fi
fi
fi

return 1
}



#####################################################
# Performs checks for new and changed hooks,
# and prompts the user for approval if needed.
Expand Down
4 changes: 2 additions & 2 deletions tests/step-061.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ mkdir -p /tmp/shared/first-shared.git/.githooks/pre-commit &&
git config --global githooks.shared 'file:///tmp/shared/first-shared.git' || exit 1

mkdir -p /tmp/test061/.githooks &&
echo '/tmp/shared/second-shared.git' >/tmp/test061/.githooks/.shared &&
cd /tmp/test061 &&
git init ||
git init &&
echo '/tmp/shared/second-shared.git' >/tmp/test061/.githooks/.shared ||
exit 1

if git hooks list | grep -q "sample-one"; then
Expand Down
2 changes: 1 addition & 1 deletion tests/test-opensuse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TEST_DIR=$(dirname "$0")

cat <<EOF | docker build --force-rm -t githooks:opensuse-base -
FROM opensuse/tumbleweed
RUN zypper install -y git-core find
RUN zypper install -y git-core find awk
EOF

exec sh "$TEST_DIR"/exec-tests.sh 'opensuse' "$@"

0 comments on commit 61e0a47

Please sign in to comment.