91
struct commit *last_commit = NULL, *last_picked_commit = NULL;
92
struct object_id head;
93
struct lock_file lock = LOCK_INIT;
94
- int clean = 1;
94
struct strvec rev_walk_args = STRVEC_INIT;
95
struct rev_info revs;
96
struct commit *commit;
175
free((char*)merge_opt.ancestor);
176
merge_opt.ancestor = NULL;
177
if (!result.clean)
179
- die("Aborting: Hit a conflict and restarting is not implemented.");
178
+ break;
179
last_picked_commit = commit;
180
last_commit = create_commit(result.tree, commit, last_commit);
181
}
183
- fprintf(stderr, "\nDone.\n");
182
/* TODO: There should be some kind of rev_info_free(&revs) call... */
183
memset(&revs, 0, sizeof(revs));
184
187
if (result.clean < 0)
188
exit(128);
189
192
- strbuf_addf(&reflog_msg, "finish rebase %s onto %s",
193
- oid_to_hex(&last_picked_commit->object.oid),
194
- oid_to_hex(&last_commit->object.oid));
195
- if (update_ref(reflog_msg.buf, branch_name.buf,
196
- &last_commit->object.oid,
197
- &last_picked_commit->object.oid,
198
- REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR)) {
199
- error(_("could not update %s"), argv[4]);
200
- die("Failed to update %s", argv[4]);
190
+ if (result.clean) {
191
+ fprintf(stderr, "\nDone.\n");
192
+ strbuf_addf(&reflog_msg, "finish rebase %s onto %s",
193
+ oid_to_hex(&last_picked_commit->object.oid),
194
+ oid_to_hex(&last_commit->object.oid));
195
+ if (update_ref(reflog_msg.buf, branch_name.buf,
196
+ &last_commit->object.oid,
197
+ &last_picked_commit->object.oid,
198
+ REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR)) {
199
+ error(_("could not update %s"), argv[4]);
200
+ die("Failed to update %s", argv[4]);
201
+ }
202
+ if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
203
+ die(_("unable to update HEAD"));
204
+ strbuf_release(&reflog_msg);
205
+ strbuf_release(&branch_name);
206
+
207
+ prime_cache_tree(the_repository, the_repository->index,
208
+ result.tree);
209
+ } else {
210
+ fprintf(stderr, "\nAborting: Hit a conflict.\n");
211
+ strbuf_addf(&reflog_msg, "rebase progress up to %s",
212
+ oid_to_hex(&last_picked_commit->object.oid));
213
+ if (update_ref(reflog_msg.buf, "HEAD",
214
+ &last_commit->object.oid,
215
+ &head,
216
+ REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR)) {
217
+ error(_("could not update %s"), argv[4]);
218
+ die("Failed to update %s", argv[4]);
219
+ }
220
}
202
- if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
203
- die(_("unable to update HEAD"));
204
- strbuf_release(&reflog_msg);
205
- strbuf_release(&branch_name);
206
-
207
- prime_cache_tree(the_repository, the_repository->index, result.tree);
221
if (write_locked_index(&the_index, &lock,
222
COMMIT_LOCK | SKIP_IF_UNCHANGED))
223
die(_("unable to write %s"), get_index_file());
211
- return (clean == 0);
224
+ return (result.clean == 0);
225
}