diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-12-05 23:09:49 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-12-05 23:09:49 +0300 |
commit | 1884110885479abb7977b8d43024aa7a38d2e628 (patch) | |
tree | 318ad07dc5726e5e5b395a94248b10a895d6fdf4 | |
parent | 46f9d7673a464273f815aa9ec1e74bfef24398c9 (diff) |
Prevent git-reset from messing up pkg-{build,checkout} output
-rw-r--r-- | bpkg/fetch-git.cxx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx index 733c8fe..3986e1d 100644 --- a/bpkg/fetch-git.cxx +++ b/bpkg/fetch-git.cxx @@ -1704,14 +1704,21 @@ namespace bpkg // if we produce any untracked files in the tree between checkouts down // the road. // - if (!run_git ( - co, - co.git_option (), - "-C", dir, - "reset", - "--hard", - verb < 2 ? opt ("-q") : nullopt, - commit)) + // Note that the `git reset --hard` command running non-quiet prints the + // `HEAD is now at...` message to stdout (which is a deliberate behavior; + // see reply to the 631ae70d-9b5f-613d-5b6f-5064d548a894@codesynthesis.com + // issue report for details). To avoid messing up bpkg output we will + // redirect git stdout to stderr. + // + process pr (start_git (co, + 2 /* stdout */, 2 /* stderr */, + co.git_option (), + "-C", dir, + "reset", + "--hard", + verb < 2 ? opt ("-q") : nullopt, + commit)); + if (!pr.wait ()) fail << "unable to reset to " << commit << endg; if (!run_git ( |