Title: Ask git where its daemon is and use that by EliahKagan · Pull Request #1697 · gitpython-developers/GitPython · GitHub
Open Graph Title: Ask git where its daemon is and use that by EliahKagan · Pull Request #1697 · gitpython-developers/GitPython
X Title: Ask git where its daemon is and use that by EliahKagan · Pull Request #1697 · gitpython-developers/GitPython
Description: This changes the test helpers on Windows to use git --exec-path (with whatever git GitPython is using) to find the directory that contains git-daemon.exe, instead of finding git-daemon.exe in a PATH search. Because it is only on Windows that the tests run git-daemon directly rather than using git daemon, this only affects Windows. Note that this does not affect Cygwin, which like other Unix-like systems uses git daemon for the tests. This change has three benefits: The documentation is shortened and simplified, because the part on how to get git-daemon working on Windows is removed. The effort required to set up GitPython for testing is reduced because that no longer has to be done (but see below). Users will not be tempted to put Git's libexec\git-core directory in their PATH. This directory contains a number of .dll files, which are there for the executables in the directory that use them. But Windows includes all PATH directories when searching for libraries as well as programs, which can create very strange and confusing problems where completely unrelated programs end up using them instead of the versions of the libraries they should use. Note, however, what it does not cover: The tests that use git-daemon are still skipped by default on Windows. These are exactly the tests that are skipped when HIDE_WINDOWS_FREEZE_ERRORS is set to True, which is the case by default on Windows. I temporarily changed its default value to False to test this PR. That change is deliberately not included in this PR and probably should not be made without further accompanying changes. (See this comment, but also the information below about how the tests usually fail, which is not by freezing.) The mechanism to skip them remains to be fixed. The HIDE_WINDOWS_KNOWN_ERRORS and HIDE_WINDOWS_FREEZE_ERRORS variables are intended to be affected by the same-named environment variables, but this does not work properly. They are True by default, but the only way to use environment variables to set them to a false value is to define the environment variable with an empty value (since everything else, as a string, is truthy). In addition to being very unlikely to have been the intended behavior, this is also hard to do on Windows when using typical shells, because in both cmd.exe and PowerShell setting an environment variable as empty actually removes the variable altogether. Rather than attempting to fix that here, I tested by temporarily changing the default value instead of using an environment variable. The tests that use git-daemon still usually fail on Windows. The failure mode is the same as when they are run with git-daemon.exe in a directory in PATH, however. That is, when git-daemon is not found it looks like this, while when it is found by a PATH search it looks like this, and the new way, finding it via git --exec-path, looks similar. Note how all errors of this form occur in the log with-no-git-daemon.txt: git.exc.GitCommandNotFound: Cmd('git-daemon') not found due to: FileNotFoundError('[WinError 2] The system cannot find the file specified') The files can be compared with diff or with this convenient diff tool. I would also be happy to produce diffs using a particular technique, on request. Those diffs were also produced before rebasing this to include the changes from #1693, since I had neglected by merge that on my Windows system before working on this, but I believe none of the changes there are able to affect this. That is to say that this PR is very narrow in its scope of effects--it automates, and at least as reliably achieves, the desired effect of a setup step that had to be done manually before, but it doesn't address any of the other problems related to it. One aspect of the way I did this change deserves special scrutiny; I've made a review comment about it.
Open Graph Description: This changes the test helpers on Windows to use git --exec-path (with whatever git GitPython is using) to find the directory that contains git-daemon.exe, instead of finding git-daemon.exe in a PAT...
X Description: This changes the test helpers on Windows to use git --exec-path (with whatever git GitPython is using) to find the directory that contains git-daemon.exe, instead of finding git-daemon.exe in a PAT...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/1697
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:db57a2db-bc46-ca23-6cd7-90b17d4709b0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8284:6A14:3B4F9FA:3C1711B:696864E4 |
| html-safe-nonce | 183f77e5f1aae91ff8f9c049be4aa446ee7313d7dc711f69cd64b46b411b8a21 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Mjg0OjZBMTQ6M0I0RjlGQTozQzE3MTFCOjY5Njg2NEU0IiwidmlzaXRvcl9pZCI6IjUyMDM3MDcyNDE0NDQxNzMwMjgiLCJyZWdpb25fZWRnZSI6InNlYSIsInJlZ2lvbl9yZW5kZXIiOiJzZWEifQ== |
| visitor-hmac | faed2daf19dea4f774f0f5cbf6d9bfa6a416b5599f756f44117697ea5c82dd25 |
| hovercard-subject-tag | pull_request:1546417061 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/1697/files |
| 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 | This changes the test helpers on Windows to use git --exec-path (with whatever git GitPython is using) to find the directory that contains git-daemon.exe, instead of finding git-daemon.exe in a PAT... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 50f46dc2d6192249fd8ebf20e76c800f4f2596d4a5f3ab63dd63a754df154f54 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fef287f17234b4529a4b112a3d47fe8551e32ddd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width