Skip to content
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

Backport #10486: Catch exception if git is not installed #10533

Closed
wants to merge 1 commit into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Nov 6, 2024

This is a trivial pr that should fix a bug in cabal init when git is not installed.


QA Notes

cabal init should work correctly even if git is not installed. This can be tested by running the following commands in an empty directory and answering the prompts:

mkdir /tmp/bin
ln -s "$(which ghc)" "$(which cabal)" /tmp/bin/
PATH=/tmp/bin/ cabal init
```<hr>This is an automatic backport of pull request #10486 done by [Mergify](https://mergify.com).

* 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
@mergify mergify bot added the conflicts label Nov 6, 2024
Copy link
Contributor Author

mergify bot commented Nov 6, 2024

Cherry-pick of e7bc62b has failed:

On branch mergify/bp/3.12/pr-10486
Your branch is up to date with 'origin/3.12'.

You are currently cherry-picking commit e7bc62be2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs
	new file:   cabal-testsuite/PackageTests/Init/init-without-git.out
	new file:   cabal-testsuite/PackageTests/Init/init-without-git.test.hs
	new file:   changelog.d/pr-10486

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   cabal-install/src/Distribution/Client/Init/Types.hs

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot mentioned this pull request Nov 6, 2024
5 tasks
@mergify mergify bot added the backport label Nov 6, 2024
@geekosaur
Copy link
Collaborator

mm, right, this one's pretty violent although technically cabal-install API is safe to change. Nemmind

@geekosaur geekosaur closed this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants