Skip to content

Commit 7e0ac9c

Browse files
authored
chore: bump @socketsecurity/lib to 5.11.4 (#76)
* chore: bump @socketsecurity/lib to 5.11.4 * fix(hooks): scope new branch pre-push checks to commits not on default branch
1 parent f20671f commit 7e0ac9c

3 files changed

Lines changed: 30 additions & 10 deletions

File tree

.git-hooks/pre-push

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,21 @@ TOTAL_ERRORS=0
2626
while read local_ref local_sha remote_ref remote_sha; do
2727
# Get the range of commits being pushed.
2828
if [ "$remote_sha" = "0000000000000000000000000000000000000000" ]; then
29-
# New branch - find the latest published release tag to limit scope.
30-
latest_release=$(git tag --list 'v*' --sort=-version:refname --merged "$local_sha" | head -1)
31-
if [ -n "$latest_release" ]; then
32-
# Check commits since the latest published release.
33-
range="$latest_release..$local_sha"
29+
# New branch - only check commits not on the default remote branch.
30+
default_branch=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
31+
if [ -z "$default_branch" ]; then
32+
default_branch="main"
33+
fi
34+
if git rev-parse "origin/$default_branch" >/dev/null 2>&1; then
35+
range="origin/$default_branch..$local_sha"
3436
else
35-
# No release tags found - check all commits.
36-
range="$local_sha"
37+
# No remote default branch - fall back to release tag.
38+
latest_release=$(git tag --list 'v*' --sort=-version:refname --merged "$local_sha" | head -1)
39+
if [ -n "$latest_release" ]; then
40+
range="$latest_release..$local_sha"
41+
else
42+
range="$local_sha"
43+
fi
3744
fi
3845
else
3946
# Existing branch - check new commits since remote.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"@socketregistry/is-unicode-supported": "workspace:*",
6464
"@socketregistry/packageurl-js": "catalog:",
6565
"@socketregistry/scripts": "file:scripts",
66-
"@socketsecurity/lib": "5.11.3",
66+
"@socketsecurity/lib": "5.11.4",
6767
"@types/fs-extra": "catalog:",
6868
"@types/node": "catalog:",
6969
"@types/normalize-package-data": "catalog:",

pnpm-lock.yaml

Lines changed: 15 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)