File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,14 @@ CHECKS=('^(package\.json|pnpm-lock\.yaml)$' 'pnpm install --lockfile-only --igno
6
6
## Get the upstream branch
7
7
UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo "")
8
8
if [ -z "$UPSTREAM" ]; then
9
- echo "No upstream configured, skipping pre-push checks."
10
- exit 0
9
+ echo "No upstream configured, detecting default branch."
10
+ # Try to detect the default branch from origin/HEAD
11
+ DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
12
+ if [ -z "$DEFAULT_BRANCH" ]; then
13
+ echo "Could not detect default branch, falling back to 'main'."
14
+ DEFAULT_BRANCH="main"
15
+ fi
16
+ UPSTREAM="$DEFAULT_BRANCH"
11
17
fi
12
18
13
19
## Get the list of files changed between upstream and HEAD
You can’t perform that action at this time.
0 commit comments