Skip to content

Commit 5d3bce3

Browse files
committed
Do not rollback branch state in case of a merge failure
1 parent b2d8dee commit 5d3bce3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/sync.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ This merge was created using https://github.com/rust-lang/josh-sync.
177177

178178
// Merge the fetched commit.
179179
// It is useful to print stdout/stderr here, because it shows the git diff summary
180-
stream_command(
180+
if let Err(error) = stream_command(
181181
&[
182182
"git",
183183
"merge",
@@ -189,7 +189,15 @@ This merge was created using https://github.com/rust-lang/josh-sync.
189189
],
190190
self.verbose,
191191
)
192-
.context("FAILED to merge new commits, something went wrong")?;
192+
.context("FAILED to merge new commits, something went wrong")
193+
{
194+
eprintln!(
195+
r"The merge was unsuccessful (maybe there was a conflict?).
196+
NOT rolling back the branch state, so you can examine it manually."
197+
);
198+
git_reset.disarm();
199+
return Err(RustcPullError::PullFailed(error));
200+
}
193201

194202
// Now detect if something has actually been pulled
195203
let current_sha = get_current_head_sha(self.verbose)?;

0 commit comments

Comments
 (0)