Skip to content

Commit 28a012f

Browse files
authored
Merge pull request #21 from rust-lang/merge-conflict
Do not rollback branch state in case of a merge failure
2 parents b2d8dee + e3dea37 commit 28a012f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/sync.rs

Lines changed: 11 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,16 @@ 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+
After you fix the conflicts, `git add` the changes and run `git merge --continue`."
198+
);
199+
git_reset.disarm();
200+
return Err(RustcPullError::PullFailed(error));
201+
}
193202

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

0 commit comments

Comments
 (0)