From cba87025f8c0e831a9195ad43d038ce72a69225f Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Mon, 4 Mar 2024 06:01:09 +0100 Subject: [PATCH] Merge pull request #9445 from NixOS/allow-input-in-git-commit Allow user input in `git commit` (cherry picked from commit 43fb39ca29a0b054a4c18623520c496d27c57192) Change-Id: I13bd4c007234ee2133289c68ef8ab2eae4def78a --- src/libfetchers/git.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc index f8d89ab2f..321950e63 100644 --- a/src/libfetchers/git.cc +++ b/src/libfetchers/git.cc @@ -7,6 +7,8 @@ #include "pathlocks.hh" #include "util.hh" #include "git.hh" +#include "logging.hh" +#include "finally.hh" #include "fetch-settings.hh" @@ -378,6 +380,9 @@ struct GitInputScheme : InputScheme runProgram("git", true, { "-C", *sourcePath, "--git-dir", gitDir, "add", "--intent-to-add", "--", std::string(file) }); + // Pause the logger to allow for user input (such as a gpg passphrase) in `git commit` + logger->pause(); + Finally restoreLogger([]() { logger->resume(); }); if (commitMsg) runProgram("git", true, { "-C", *sourcePath, "--git-dir", gitDir, "commit", std::string(file), "-m", *commitMsg });