aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schwaighofer <mschwaig@users.noreply.github.com>2022-02-07 20:36:39 +0100
committerMartin Schwaighofer <mschwaig@users.noreply.github.com>2022-02-19 22:58:23 +0100
commit53523c0ab834416e38a15cf7be6f71d8f68d1c99 (patch)
tree24419a7718d55af13ec7c75f051dbb45499172fa /src
parent9504445cab095fe3869c5a68342fb2cf23ac0f28 (diff)
git fetcher: set locale for rev-parse
Diffstat (limited to 'src')
-rw-r--r--src/libfetchers/git.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc
index ad877eacc..6571a9d02 100644
--- a/src/libfetchers/git.cc
+++ b/src/libfetchers/git.cc
@@ -220,11 +220,17 @@ struct GitInputScheme : InputScheme
if (!input.getRef() && !input.getRev() && isLocal) {
bool clean = false;
+ auto env = getEnv();
+ // Set LC_ALL to C: because we rely on the error messages from git rev-parse to determine what went wrong
+ // that way unknown errors can lead to a failure instead of continuing through the wrong code path
+ env["LC_ALL"] = "C";
+
/* Check whether HEAD points to something that looks like a commit,
since that is the refrence we want to use later on. */
auto result = runProgram(RunOptions {
.program = "git",
.args = { "-C", actualUrl, "--git-dir=.git", "rev-parse", "--verify", "--no-revs", "HEAD^{commit}" },
+ .environment = env,
.mergeStderrToStdout = true
});
auto exitCode = WEXITSTATUS(result.first);