Skip to content

Added logic to Ensure the repo is marked as safe for git (prevents SH… #107

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

Merged
merged 2 commits into from
Jul 29, 2025

Conversation

dacoburn
Copy link
Collaborator

The bug caused GitPython to fail in CI environments due to "dubious ownership" errors when the repository directory was not marked as safe in git config. This resulted in broken pipe and SHA empty errors during CLI execution.

Root Cause

GitPython requires the repository directory to be listed in git's global safe.directory config when running in some CI containers. If not, operations like commit lookup fail with errors. Previously, the code did not check or set this config, leading to failures in certain environments.

Fix

Added a helper function to check if the repository directory is already marked as safe in git config. If not, the function adds it before initializing the Repo object. This prevents the SHA empty/dubious ownership errors and ensures reliable operation in CI and local environments.

Public Changelog

N/A

@dacoburn dacoburn requested a review from a team as a code owner July 29, 2025 15:36
@dacoburn dacoburn requested review from nolanlawson and jfblaa and removed request for a team July 29, 2025 15:36
Copy link

github-actions bot commented Jul 29, 2025

🚀 Preview package published!

Install with:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.1.35.dev1

Docker image: socketdev/cli:pr-107

Copy link

@jonathanStrange0 jonathanStrange0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Let's try it

@dacoburn dacoburn merged commit 095b0cc into main Jul 29, 2025
6 checks passed
@dacoburn dacoburn deleted the doug/fix-git-safe-directory branch July 29, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants