Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no WSL/Windows git hooks from autogen.sh #600

Merged
merged 1 commit into from
Jan 12, 2024
Merged
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
43 changes: 40 additions & 3 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,47 @@
#
# Create configure and makefile stuff...

# Check environment
if [ -n "$WSL_DISTRO_NAME" ]; then
# we found a non-blank WSL environment distro name
current_path="$(pwd)"
pattern="/mnt/?"
if [ "$(echo "$current_path" | grep -E "^$pattern")" ]; then
# if we are in WSL and shared Windows file system, 'ln' does not work.
no_links=true
else
no_links=
fi
fi

# Git hooks should come before autoreconf.
if test -d .git
then
mkdir -p .git/hooks && ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commit
if [ -d .git ]; then
if [ ! -d .git/hooks ]; then
mkdir .git/hooks || exit $?
fi

if [ -n "$no_links" ]; then
echo "Linux ln does not work on shared Windows file system in WSL."
if [ ! -e .git/hooks/pre-commit ]; then
echo "The pre-commit.sh file will not be copied to .git/hooks/pre-commit"
# shell scripts do not work on Windows; TODO create equivalent batch file
# cp ./pre-commit.sh .git/hooks/pre-commit || exit $?
fi
# unlike wolfssl, wolfssh is not using pre-push.sh at this time. Enable as needed:
# if [ ! -e .git/hooks/pre-push ]; then
# echo "The pre-push.sh file will not be copied to .git/hooks/pre-commit"
# # shell scripts do not work on Windows; TODO create equivalent batch file
# # cp ./pre-push.sh .git/hooks/pre-push || exit $?
# fi
else
if [ ! -e .git/hooks/pre-commit ]; then
ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commit || exit $?
fi
# unlike wolfssl, wolfssh is not using pre-push.sh at this time Enable as needed:
# if [ ! -e .git/hooks/pre-push ]; then
# ln -s ../../pre-push.sh .git/hooks/pre-push || exit $?
# fi
fi
fi

# If this is a source checkout then call autoreconf with error as well
Expand Down
Loading