Title: Fix IndexFile.from_tree on Windows by EliahKagan · Pull Request #1751 · gitpython-developers/GitPython · GitHub
Open Graph Title: Fix IndexFile.from_tree on Windows by EliahKagan · Pull Request #1751 · gitpython-developers/GitPython
X Title: Fix IndexFile.from_tree on Windows by EliahKagan · Pull Request #1751 · gitpython-developers/GitPython
Description: Fixes #1630
IndexFile.from_tree uses NamedTemporaryFile to create a temporary file in the repository's .git directory to pass to git read-tree as the operand of --index-output. But on Windows, the command always fails: the git subprocess reports it cannot write to that path. IndexFile.from_tree and everything that uses it are thus broken on Windows. This is the cause of #1630, as IndexFile.reset uses IndexFile.from_tree.
git read-tree does not actually write to the file itself. Instead, it attempts to rename its own separate temporary file to have its name. git read-tree does not require that any file exist there already. The reason we create it is to get a filename that was definitely available, and prevent an unintended race condition on the name. As git-read-tree(1) says:
--index-output=
Open Graph Description: Fixes #1630 IndexFile.from_tree uses NamedTemporaryFile to create a temporary file in the repository's .git directory to pass to git read-tree as the operand of --index-output. But on Windows, ...
X Description: Fixes #1630 IndexFile.from_tree uses NamedTemporaryFile to create a temporary file in the repository's .git directory to pass to git read-tree as the operand of --index-output. But on Windo...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/1751
X: @github
Domain: redirect.github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:d701d2cc-4d31-4b51-5f90-fad91b307455 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 8006:3E5130:105EDBD:16E2779:69726258 |
| html-safe-nonce | 685574190e85e258bd4cceba330bbfc1479a9472332568af22e2b288305719db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDA2OjNFNTEzMDoxMDVFREJEOjE2RTI3Nzk6Njk3MjYyNTgiLCJ2aXNpdG9yX2lkIjoiNDY4OTc4NzE2NTc5NTgzNjUwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 94470c772499dc8ed01e4cbf64b2cd2ceb34291c3f0dec42601d11ffa2a46a70 |
| hovercard-subject-tag | pull_request:1624860318 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/1751/checks |
| twitter:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| og:image:alt | Fixes #1630 IndexFile.from_tree uses NamedTemporaryFile to create a temporary file in the repository's .git directory to pass to git read-tree as the operand of --index-output. But on Windows, ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ab2c8e6ec49d8737f6bf007a86b2c4a2bc434bba562c524e0c76465bc9ed358b |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 52bb8e0c9f4e51b63385b80feac0e6ba25e8dbd5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width