-
Notifications
You must be signed in to change notification settings - Fork 697
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
Catch exception if git is not installed #10486
Conversation
Could you fill out one of the templates, please? I don't think this needs a changelog fragment, though. |
I wonder if there is a way to test this automatically (if not, just user testing will do). |
Yes, I think for this one we want (very simple) manual QA notes. I wouldn't trust trying to hide or remove git from a runner environment. |
Yes, do you have a link to the templates? I can't find them. |
Hm, building is failing https://github.com/haskell/cabal/actions/runs/11562678296/job/32184393856?pr=10486#step:6:1363 |
That's not going to work because |
Right, I don't think it's possible to define a |
Why not? It should be as simple as the description of this PR shows: "simply" resetting the PATH. I think the testsuite might have a combinator for manipulating PATH. I don't want to block it for this reason, but having a regression test would be very valuable in this case. |
Added tests to the checklist. I'm not sure how or where to add the test though. |
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.
Thanks for reporting and taking this on!
An integration test manipulating PATH can be found here: https://github.com/haskell/cabal/blob/63c486a1a65de599fa435c0cbf11ad85725f3c6c/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs
General setup for integration tests is described here: https://github.com/haskell/cabal/blob/63c486a1a65de599fa435c0cbf11ad85725f3c6c/cabal-testsuite/README.md
Good luck!
My worry with |
@geekosaur that's fair. Since it's very local (ideally, just for a single test), it might work. |
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.
Brilliant!
Have you tried to run the test without your patch? That would be a good sanity check to see that it fails since it's a somewhat non-trivial test.
I ran it without the patch on a different branch (forked from 3.10) since I couldn't build |
Uh, what happened? Is this something likely to affect other people? |
I assume the While failing to build |
Assigning myself for manual QA once this lands on |
I think it might be because I was using cabal 3.10.3.0.
Yes, it's the same error. |
Older |
@mergify backport 3.14 |
✅ Backports have been created
|
* Catch exception if git is not installed * fix formatting * change type from IO to m * add maybeReadProcessWithExitCode * use maybeReadProcessWithExitCode * disambiguate P.catch * add TypeApplications pragma * add missing arguments * Add changelog entry * Add test for `cabal init` when `git` is not installed * Remove withSourceCopyDir from test * Remove withSourceCopyDir from test * Remove configure and build from test * Remove assert * Skip test on windows --------- Co-authored-by: noiioiu <[email protected]> (cherry picked from commit e7bc62b)
Backport #10486: Catch exception if git is not installed
@mergify backport 3.12 |
✅ Backports have been created
|
* Catch exception if git is not installed * fix formatting * change type from IO to m * add maybeReadProcessWithExitCode * use maybeReadProcessWithExitCode * disambiguate P.catch * add TypeApplications pragma * add missing arguments * Add changelog entry * Add test for `cabal init` when `git` is not installed * Remove withSourceCopyDir from test * Remove withSourceCopyDir from test * Remove configure and build from test * Remove assert * Skip test on windows --------- Co-authored-by: noiioiu <[email protected]> (cherry picked from commit e7bc62b) # Conflicts: # cabal-install/src/Distribution/Client/Init/Types.hs
This is a trivial pr that should fix a bug in
cabal init
whengit
is not installed.QA Notes
cabal init
should work correctly even ifgit
is not installed. This can be tested by running the following commands in an empty directory and answering the prompts: