-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10531 from haskell/mergify/bp/3.14/pr-10486
Backport #10486: Catch exception if git is not installed
- Loading branch information
Showing
5 changed files
with
50 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# cabal init |
22 changes: 22 additions & 0 deletions
22
cabal-testsuite/PackageTests/Init/init-without-git.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Test.Cabal.Prelude | ||
import System.Directory | ||
import System.FilePath | ||
import Distribution.Simple.Utils | ||
import Distribution.Verbosity | ||
|
||
-- Test cabal init when git is not installed | ||
main = do | ||
skipIfWindows "Might fail on windows." | ||
tmp <- getTemporaryDirectory | ||
withTempDirectory normal tmp "bin" $ | ||
\bin -> cabalTest $ | ||
do | ||
ghc_path <- programPathM ghcProgram | ||
cabal_path <- programPathM cabalProgram | ||
withSymlink ghc_path (bin </> "ghc") . withSymlink cabal_path (bin </> "cabal") . | ||
withEnv [("PATH", Just bin)] $ do | ||
cwd <- fmap testSourceCopyDir getTestEnv | ||
|
||
void . withDirectory cwd $ do | ||
cabalWithStdin "init" ["-i"] | ||
"2\n\n5\n\n\n2\n\n\n\n\n\n\n\n\n\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
synopsis: Fix a bug that causes `cabal init` to crash if `git` is not installed | ||
packages: cabal-install | ||
prs: #10486 | ||
issues: #10484 #8478 | ||
significance: | ||
|
||
description: { | ||
|
||
- `cabal init` tries to use `git config` to guess the user's name and email. | ||
It no longer crashes if there is no executable named `git` on $PATH. | ||
|
||
} |