git: enable sideband progress on subprocess push

The parsing function is adjusted in case stderr contained unparsed progress
messages.
This commit is contained in:
Yuya Nishihara 2025-01-30 17:13:16 +09:00
parent 5396138ed5
commit 1faea485ca

View File

@ -206,6 +206,9 @@ impl<'a> GitSubprocessContext<'a> {
let mut command = self.create_command(); let mut command = self.create_command();
command.stdout(Stdio::piped()); command.stdout(Stdio::piped());
command.args(["push", "--porcelain"]); command.args(["push", "--porcelain"]);
if callbacks.progress.is_some() {
command.arg("--progress");
}
command.args( command.args(
references references
.iter() .iter()
@ -477,7 +480,8 @@ fn parse_git_push_output(output: Output) -> Result<(Vec<String>, Vec<String>), G
if output if output
.stderr .stderr
.starts_with_str("error: failed to push some refs to ") .lines()
.any(|line| line.starts_with(b"error: failed to push some refs to "))
{ {
parse_ref_pushes(&output.stdout) parse_ref_pushes(&output.stdout)
} else { } else {