Skip to content

Commit 0db5904

Browse files
committed
Fix file names for changed files to work with globbing
1 parent 54f9a80 commit 0db5904

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.1.31"
9+
version = "2.1.32"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.1.31'
2+
__version__ = '2.1.32'

socketsecurity/core/git_interface.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ def __init__(self, path: str):
1515
self.repo = Repo(path)
1616
assert self.repo
1717
self.head = self.repo.head
18+
19+
# Always fetch all remote refs to ensure branches exist for diffing
20+
try:
21+
self.repo.git.fetch('--all')
22+
log.debug("Fetched all remote refs for diffing.")
23+
except Exception as fetch_error:
24+
log.debug(f"Failed to fetch all remote refs: {fetch_error}")
1825

1926
# Use CI environment SHA if available, otherwise fall back to current HEAD commit
2027
github_sha = os.getenv('GITHUB_SHA')
@@ -215,8 +222,8 @@ def __init__(self, path: str):
215222
self.changed_files = []
216223
for item in self.show_files:
217224
if item != "":
218-
full_path = f"{self.path}/{item}"
219-
self.changed_files.append(full_path)
225+
# Use relative path for glob matching
226+
self.changed_files.append(item)
220227

221228
# Determine if this commit is on the default branch
222229
# This considers both GitHub Actions detached HEAD and regular branch situations

workflows/github-actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/checkout@v4
3434
with:
3535
# For PRs, fetch one additional commit for proper diff analysis
36-
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
36+
fetch-depth: 0
3737

3838
- name: Run Socket Security Scan
3939
env:

0 commit comments

Comments
 (0)