8000 correctly handle `uname-cmd` that doesn't point to an executable file by gcmarx · Pull Request #2026 · gitpython-developers/GitPython · GitHub
[go: up one dir, main page]

Skip to content

correctly handle uname-cmd that doesn't point to an executable file #2026

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

gcmarx
Copy link
Contributor
@gcmarx gcmarx commented May 22, 2025

I also ran into the issue from #1979. My proposed solution is that GitPython should only try to run uname_cmd if it points to an executable file. I also wrote a short test class for the is_cygwin_git function. I don't have a machine with Cygwin, so I can't test that it actually does work, but I trust the Python docs when they say that on Cygwin, sys.platform will be cygwin.

@gcmarx
Copy link
Contributor Author
gcmarx commented May 22, 2025

honestly, after having written this code, I'm not sure why we're not just delegating is_cygwin_git to sys.platform == "cygwin".

@gcmarx
Copy link
Contributor Author
gcmarx commented May 22, 2025

see #2027 for a different implementation of the same basic logic

@Byron Byron requested review from EliahKagan and Copilot May 23, 2025 06:51
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the handling of cases where the uname command (used to detect Cygwin Git) is not an executable file and adds unit tests for verifying the behavior of is_cygwin_git. It also includes an update to the AUTHORS file to add a new contributor.

  • Updated test_util.py to add tests for is_cygwin_git.
  • Revised git/util.py to check if uname_cmd is an executable file before invoking it.
  • Updated AUTHORS list.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/test_util.py Added unit tests for is_cygwin_git functionality
git/util.py Updated uname command executable check and caching logic
AUTHORS Added new contributor

@Byron
Copy link
Member
Byron commented May 23, 2025

Thanks for contributing a fix!

Indeed, I don't know why we are in the current place, but @EliahKagan probably has more information and I hope he can chime in.

Besides that, my apologies, I did click the "copilot" review button out of curiosity, please feel free to completely ignore it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0