fix: improve h5 payment return flow
This commit is contained in:
18
scripts/git-hooks/post-checkout
Executable file
18
scripts/git-hooks/post-checkout
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Third argument is 1 for branch checkout and 0 for file checkout.
|
||||
[ "${3:-0}" = "1" ] || exit 0
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
|
||||
git_dir=$(git rev-parse --git-dir 2>/dev/null) || exit 0
|
||||
case "$git_dir" in
|
||||
/*) ;;
|
||||
*) git_dir="$repo_root/$git_dir" ;;
|
||||
esac
|
||||
|
||||
(
|
||||
cd "$repo_root" || exit 0
|
||||
./scripts/gitnexus-refresh.sh
|
||||
) >>"$git_dir/gitnexus-refresh.log" 2>&1 &
|
||||
|
||||
exit 0
|
||||
15
scripts/git-hooks/post-commit
Executable file
15
scripts/git-hooks/post-commit
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
|
||||
git_dir=$(git rev-parse --git-dir 2>/dev/null) || exit 0
|
||||
case "$git_dir" in
|
||||
/*) ;;
|
||||
*) git_dir="$repo_root/$git_dir" ;;
|
||||
esac
|
||||
|
||||
(
|
||||
cd "$repo_root" || exit 0
|
||||
./scripts/gitnexus-refresh.sh
|
||||
) >>"$git_dir/gitnexus-refresh.log" 2>&1 &
|
||||
|
||||
exit 0
|
||||
15
scripts/git-hooks/post-merge
Executable file
15
scripts/git-hooks/post-merge
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
|
||||
git_dir=$(git rev-parse --git-dir 2>/dev/null) || exit 0
|
||||
case "$git_dir" in
|
||||
/*) ;;
|
||||
*) git_dir="$repo_root/$git_dir" ;;
|
||||
esac
|
||||
|
||||
(
|
||||
cd "$repo_root" || exit 0
|
||||
./scripts/gitnexus-refresh.sh
|
||||
) >>"$git_dir/gitnexus-refresh.log" 2>&1 &
|
||||
|
||||
exit 0
|
||||
15
scripts/git-hooks/post-rewrite
Executable file
15
scripts/git-hooks/post-rewrite
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
|
||||
git_dir=$(git rev-parse --git-dir 2>/dev/null) || exit 0
|
||||
case "$git_dir" in
|
||||
/*) ;;
|
||||
*) git_dir="$repo_root/$git_dir" ;;
|
||||
esac
|
||||
|
||||
(
|
||||
cd "$repo_root" || exit 0
|
||||
./scripts/gitnexus-refresh.sh
|
||||
) >>"$git_dir/gitnexus-refresh.log" 2>&1 &
|
||||
|
||||
exit 0
|
||||
54
scripts/gitnexus-refresh.sh
Executable file
54
scripts/gitnexus-refresh.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "${GITNEXUS_AUTO_REFRESH:-1}" = "0" ]; then
|
||||
echo "GitNexus auto refresh disabled by GITNEXUS_AUTO_REFRESH=0"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || {
|
||||
echo "Not inside a git repository"
|
||||
exit 1
|
||||
}
|
||||
cd "$repo_root"
|
||||
|
||||
git_dir=$(git rev-parse --git-dir)
|
||||
case "$git_dir" in
|
||||
/*) ;;
|
||||
*) git_dir="$repo_root/$git_dir" ;;
|
||||
esac
|
||||
|
||||
head_commit=$(git rev-parse HEAD 2>/dev/null || true)
|
||||
if [ -z "$head_commit" ]; then
|
||||
echo "No HEAD commit found; skip GitNexus refresh"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
stamp_file="$git_dir/gitnexus-indexed-head"
|
||||
lock_dir="$git_dir/gitnexus-refresh.lock"
|
||||
|
||||
if [ -f "$stamp_file" ] && [ "$(cat "$stamp_file" 2>/dev/null || true)" = "$head_commit" ]; then
|
||||
echo "GitNexus index already refreshed for $head_commit"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! mkdir "$lock_dir" 2>/dev/null; then
|
||||
echo "GitNexus refresh already running; skip"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cleanup() {
|
||||
rmdir "$lock_dir" 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT HUP INT TERM
|
||||
|
||||
echo "GitNexus refresh started for $head_commit"
|
||||
|
||||
if npx gitnexus analyze --index-only --name anxinyan .; then
|
||||
printf '%s\n' "$head_commit" > "$stamp_file"
|
||||
echo "GitNexus refresh completed for $head_commit"
|
||||
else
|
||||
status=$?
|
||||
echo "GitNexus refresh failed with exit code $status"
|
||||
exit "$status"
|
||||
fi
|
||||
Reference in New Issue
Block a user