-
-
Notifications
You must be signed in to change notification settings - Fork 933
Fix IndexFile.from_tree on Windows #1751
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
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e359718
Revert "Add xfail marks for IndexFile.from_tree failures"
EliahKagan b12fd4a
Let Windows subprocess open or rename onto temp file
EliahKagan 12bbace
Add xfail mark for new test_index_mutation failure
EliahKagan 928ca1e
Minor formatting consistency improvement
EliahKagan 9e5d0aa
Avoid subprocess-writable temp file race condition
EliahKagan 782c062
Add myself to AUTHORS
EliahKagan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add xfail mark for new test_index_mutation failure
The test assumes symlinks are never created on Windows. This often turns out to be correct, because core.symlinks defaults to false on Windows. (On some Windows systems, creating them is a privileged operation; this can be reconfigured, and unprivileged creation of symlinks is often enabled on systems used for development.) However, on a Windows system with core.symlinks set to true, git will create symlinks if it can, when checking out entries committed to a repository as symlinks. GitHub Actions runners for Windows do this ever since actions/runner-images#1186 (the file is now at images/windows/scripts/build/Install-Git.ps1; the `/o:EnableSymlinks=Enabled` option continues to be passed, causing Git for Windows to be installed with core.symlinks set to true in the system scope). For now, this adds an xfail marking to test_index_mutation, for the FileNotFoundError raised when a symlink, which is expected not to be a symlink, is passed to `open`, causing an attempt to open its nonexistent target. (The check itself might bear refinement: as written, it reads the core.symlinks variable from any scope, including the local scope, which at the time of the check will usually be the cloned GitPython directory, where pytest is run.) While adding an import, this commit also improves the grouping and sorting of existing ones.
- Loading branch information
commit 12bbacee90f3810367a2ce986f42c3172c598c58
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if this is the best way for the
xfail
condition to check thecore.symlinks
configuration variable. This will typically run with the CWD as the GitPython repository, thereby including the local scope, and maybe only the system and global scopes should be used. (I had thought to useGitConfigParser
, which I think can omit the local scope since #950, but it looks like its use of the system scope is limited on Windows.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think GitPython has the same problem that
gitoxide
would have: It fails to see the configuration coming with the git installation itself, which has to be discovered by askinggit
itself.That's the configuration file that contains these values, on Windows at least. Maybe Windows will also put that value into the repository-local configuration file, which might be the reason this condition works at all.
And since it works, I suppose it's good enough for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least in the more common
false
case, I've found that it is coped into the local repository's configuration. But usingGit().config(...)
doesn't rely on that. It works outside any repository and finds the system configuration:(This is the same GitPython as when I run it from the
GitPython
directory, since the virtual environment is activated and the package is installed in it usingpip install -e .
.)So I think the condition is working because
config
is not being treated specially--unlike ifGitConfigParser
is used, the command in that condition it really is runninggit config
.