Ask git where its daemon is and use that by EliahKagan · Pull Request #1697 · gitpython-developers/GitPython
Repository navigation
Ask git where its daemon is and use that - #1697
Merged
Byron merged 1 commit into gitpython-developers:main from EliahKagan:find-daemon Oct 8, 2023
Merged
Ask git where its daemon is and use that #1697 Byron merged 1 commit into gitpython-developers:main from EliahKagan:find-daemon
Conversation
EliahKagan commented Oct 7, 2023 · edited Loading
Copy link Copy Markdown
Member
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-daemonworking 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-coredirectory in theirPATH. This directory contains a number of.dllfiles, which are there for the executables in the directory that use them. But Windows includes allPATHdirectories 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-daemonare still skipped by default on Windows. These are exactly the tests that are skipped whenHIDE_WINDOWS_FREEZE_ERRORSis set toTrue, which is the case by default on Windows. I temporarily changed its default value toFalseto 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_ERRORSandHIDE_WINDOWS_FREEZE_ERRORSvariables are intended to be affected by the same-named environment variables, but this does not work properly. They areTrueby 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 bothcmd.exeand 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-daemonstill usually fail on Windows. The failure mode is the same as when they are run withgit-daemon.exein a directory inPATH, however. That is, whengit-daemonis not found it looks like this , while when it is found by aPATHsearch it looks like this , and the new way, finding it viagit --exec-path, looks similar . Note how all errors of this form occur in the logwith-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
diffor 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.
Ask git where its daemon is and use that
04f3200
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 it in a PATH search.EliahKagan force-pushed the find-daemon branch from
8f5f65d to
04f3200
Compare
October 7, 2023 16:28 EliahKagan commented Oct 7, 2023
View reviewed changes
Comment thread test/lib/helper.py
| # So, invoke it as a single command. | ||
| daemon_cmd = [ | ||
| " git-daemon", | ||
| osp.join(Git()._call_process("--exec-path"), " git-daemon" ) , |
View reviewed changes
Byron left a comment
Copy link Copy Markdown
Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Thanks so much for your help! Despite a small improvement, it's much appreciated and I see how it will help to get the tests on windows to work.
Since gitoxide also has tests that rely on git daemon to run which work on Windows, I'd believe that getting these to work should generally possible.
Regarding the implementation of Windows- and test-specific environment variables, I hope their implementation can be adjusted to be usable on Windows as well.
Thanks for everything.
Comment thread test/lib/helper.py| # So, invoke it as a single command. | ||
| daemon_cmd = [ | ||
| " git-daemon", | ||
| osp.join(Git()._call_process("--exec-path"), " git-daemon" ) , |
8107cbf
into
gitpython-developers : main
Oct 8, 2023
EliahKagan
deleted the
find-daemon
branch
October 8, 2023 07:03
EliahKagan
mentioned this pull request
Oct 9, 2023
HIDE_WINDOWS_*_ERRORS environment variables are interpreted strangely
#1698
Closed
EliahKagan commented Oct 9, 2023 · edited Loading
Copy link Copy Markdown
Member
Author
I've described this in #1698 and proposed a fix as part of #1700 . (In the longer term, I hope these can be eliminated or at least moved, along with all associated test-specific logic , out of the |
Bot
referenced this pull request in allenporter/flux-local Oct 20, 2023
Update dependency GitPython to v3.1.40 (#361)
23eac62
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [GitPython](https://togithub.com/gitpython-developers/GitPython) | `==3.1.37` -> `==3.1.40` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>gitpython-developers/GitPython (GitPython)</summary> ### [`v3.1.40`](https://togithub.com/gitpython-developers/GitPython/compare/3.1.38...3.1.40) [Compare Source](https://togithub.com/gitpython-developers/GitPython/compare/3.1.38...3.1.40) ### [`v3.1.38`](https://togithub.com/gitpython-developers/GitPython/releases/tag/3.1.38) [Compare Source](https://togithub.com/gitpython-developers/GitPython/compare/3.1.37...3.1.38) #### What's Changed - Add missing assert keywords by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1678](https://togithub.com/gitpython-developers/GitPython/pull/1678) - Make clear every test's status in every CI run by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1679](https://togithub.com/gitpython-developers/GitPython/pull/1679) - Fix new link to license in readme by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1680](https://togithub.com/gitpython-developers/GitPython/pull/1680) - Drop unneeded flake8 suppressions by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1681](https://togithub.com/gitpython-developers/GitPython/pull/1681) - Update instructions and test helpers for git-daemon by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1684](https://togithub.com/gitpython-developers/GitPython/pull/1684) - Fix Git.execute shell use and reporting bugs by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1687](https://togithub.com/gitpython-developers/GitPython/pull/1687) - No longer allow CI to select a prerelease for 3.12 by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1689](https://togithub.com/gitpython-developers/GitPython/pull/1689) - Clarify Git.execute and Popen arguments by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1688](https://togithub.com/gitpython-developers/GitPython/pull/1688) - Ask git where its daemon is and use that by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1697](https://togithub.com/gitpython-developers/GitPython/pull/1697) - Fix bugs affecting exception wrapping in rmtree callback by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1700](https://togithub.com/gitpython-developers/GitPython/pull/1700) - Fix dynamically-set **all** variable by [@​DeflateAwning](https://togithub.com/DeflateAwning) in [https://github.com/gitpython-developers/GitPython/pull/1659](https://togithub.com/gitpython-developers/GitPython/pull/1659) - Fix small [#​1662](https://togithub.com/gitpython-developers/GitPython/issues/1662) regression due to [#​1659](https://togithub.com/gitpython-developers/GitPython/issues/1659) by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1701](https://togithub.com/gitpython-developers/GitPython/pull/1701) - Drop obsolete info on yanking from security policy by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1703](https://togithub.com/gitpython-developers/GitPython/pull/1703) - Have Dependabot offer submodule updates by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1702](https://togithub.com/gitpython-developers/GitPython/pull/1702) - Bump git/ext/gitdb from `49c3178` to `8ec2390` by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/gitpython-developers/GitPython/pull/1704](https://togithub.com/gitpython-developers/GitPython/pull/1704) - Bump git/ext/gitdb from `8ec2390` to `6a22706` by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/gitpython-developers/GitPython/pull/1705](https://togithub.com/gitpython-developers/GitPython/pull/1705) - Update readme for milestone-less releasing by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1707](https://togithub.com/gitpython-developers/GitPython/pull/1707) - Run Cygwin CI workflow commands in login shells by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1709](https://togithub.com/gitpython-developers/GitPython/pull/1709) #### New Contributors - [@​DeflateAwning](https://togithub.com/DeflateAwning) made their first contribution in [https://github.com/gitpython-developers/GitPython/pull/1659](https://togithub.com/gitpython-developers/GitPython/pull/1659) **Full Changelog**: gitpython-developers/GitPython@3.1.37...3.1.38 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/allenporter/flux-local). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xOS4yIiwidXBkYXRlZEluVmVyIjoiMzcuMTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 24, 2023
Remove outdated git_daemon_launched Windows info
c4fc79a
This removes the Windows-specific information in the warning message in git_daemon_launched. After the associated functionality was updated in gitpython-developers#1684 and the warning message was abridged accordingly, the functionality was updated again in gitpython-developers#1697, causing the message to be outdated and no longer helpeful (since having git-daemon.exe in a PATH directory is no longer necessary or useful), without any corresponding change to the message.EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 24, 2023
Remove outdated git_daemon_launched Windows info
ccddf7a
This removes the Windows-specific information in the warning message in git_daemon_launched. After the associated functionality was updated in gitpython-developers#1684 and the warning message was abridged accordingly, the functionality was updated again in gitpython-developers#1697, causing the message to be outdated and no longer helpeful (since having git-daemon.exe in a PATH directory is no longer necessary or useful), without any corresponding change to the message.EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 24, 2023
Remove outdated git_daemon_launched Windows info
faa19ac
This removes the Windows-specific information in the warning message in git_daemon_launched. After the associated functionality was updated in gitpython-developers#1684 and the warning message was abridged accordingly, the functionality was updated again in gitpython-developers#1697, causing the message to be outdated and no longer helpeful (since having git-daemon.exe in a PATH directory is no longer necessary or useful), without any corresponding change to the message.EliahKagan mentioned this pull request Jan 19, 2024 Override bash executable, defaulting to Git for Windows git bash over WSL bash #1791 Closed EliahKagan mentioned this pull request Feb 23, 2024 Fix version_info cache invalidation, typing, parsing, and serialization #1838 Merged EliahKagan mentioned this pull request Mar 30, 2024 Issue and test deprecation warnings #1886 Merged Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment