sequencer: convert fast_forward_to to struct object_id
fast_forward_to is required for checkout_fast_fowrard, which is required for parse_tree_indirect. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
6f37eb7d85
commit
ace976b26c
22
sequencer.c
22
sequencer.c
|
@ -374,7 +374,7 @@ static void update_abort_safety_file(void)
|
||||||
write_file(git_path_abort_safety_file(), "%s", "");
|
write_file(git_path_abort_safety_file(), "%s", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fast_forward_to(const unsigned char *to, const unsigned char *from,
|
static int fast_forward_to(const struct object_id *to, const struct object_id *from,
|
||||||
int unborn, struct replay_opts *opts)
|
int unborn, struct replay_opts *opts)
|
||||||
{
|
{
|
||||||
struct ref_transaction *transaction;
|
struct ref_transaction *transaction;
|
||||||
|
@ -382,7 +382,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,
|
||||||
struct strbuf err = STRBUF_INIT;
|
struct strbuf err = STRBUF_INIT;
|
||||||
|
|
||||||
read_cache();
|
read_cache();
|
||||||
if (checkout_fast_forward(from, to, 1))
|
if (checkout_fast_forward(from->hash, to->hash, 1))
|
||||||
return -1; /* the callee should have complained already */
|
return -1; /* the callee should have complained already */
|
||||||
|
|
||||||
strbuf_addf(&sb, _("%s: fast-forward"), _(action_name(opts)));
|
strbuf_addf(&sb, _("%s: fast-forward"), _(action_name(opts)));
|
||||||
|
@ -390,7 +390,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,
|
||||||
transaction = ref_transaction_begin(&err);
|
transaction = ref_transaction_begin(&err);
|
||||||
if (!transaction ||
|
if (!transaction ||
|
||||||
ref_transaction_update(transaction, "HEAD",
|
ref_transaction_update(transaction, "HEAD",
|
||||||
to, unborn ? null_sha1 : from,
|
to->hash, unborn ? null_sha1 : from->hash,
|
||||||
0, sb.buf, &err) ||
|
0, sb.buf, &err) ||
|
||||||
ref_transaction_commit(transaction, &err)) {
|
ref_transaction_commit(transaction, &err)) {
|
||||||
ref_transaction_free(transaction);
|
ref_transaction_free(transaction);
|
||||||
|
@ -935,7 +935,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
|
||||||
{
|
{
|
||||||
unsigned int flags = opts->edit ? EDIT_MSG : 0;
|
unsigned int flags = opts->edit ? EDIT_MSG : 0;
|
||||||
const char *msg_file = opts->edit ? NULL : git_path_merge_msg();
|
const char *msg_file = opts->edit ? NULL : git_path_merge_msg();
|
||||||
unsigned char head[20];
|
struct object_id head;
|
||||||
struct commit *base, *next, *parent;
|
struct commit *base, *next, *parent;
|
||||||
const char *base_label, *next_label;
|
const char *base_label, *next_label;
|
||||||
struct commit_message msg = { NULL, NULL, NULL, NULL };
|
struct commit_message msg = { NULL, NULL, NULL, NULL };
|
||||||
|
@ -949,12 +949,12 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
|
||||||
* that represents the "current" state for merge-recursive
|
* that represents the "current" state for merge-recursive
|
||||||
* to work on.
|
* to work on.
|
||||||
*/
|
*/
|
||||||
if (write_cache_as_tree(head, 0, NULL))
|
if (write_cache_as_tree(head.hash, 0, NULL))
|
||||||
return error(_("your index file is unmerged."));
|
return error(_("your index file is unmerged."));
|
||||||
} else {
|
} else {
|
||||||
unborn = get_sha1("HEAD", head);
|
unborn = get_oid("HEAD", &head);
|
||||||
if (unborn)
|
if (unborn)
|
||||||
hashcpy(head, EMPTY_TREE_SHA1_BIN);
|
oidcpy(&head, &empty_tree_oid);
|
||||||
if (index_differs_from(unborn ? EMPTY_TREE_SHA1_HEX : "HEAD", 0, 0))
|
if (index_differs_from(unborn ? EMPTY_TREE_SHA1_HEX : "HEAD", 0, 0))
|
||||||
return error_dirty_index(opts);
|
return error_dirty_index(opts);
|
||||||
}
|
}
|
||||||
|
@ -990,11 +990,11 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
|
||||||
oid_to_hex(&commit->object.oid));
|
oid_to_hex(&commit->object.oid));
|
||||||
|
|
||||||
if (opts->allow_ff && !is_fixup(command) &&
|
if (opts->allow_ff && !is_fixup(command) &&
|
||||||
((parent && !hashcmp(parent->object.oid.hash, head)) ||
|
((parent && !oidcmp(&parent->object.oid, &head)) ||
|
||||||
(!parent && unborn))) {
|
(!parent && unborn))) {
|
||||||
if (is_rebase_i(opts))
|
if (is_rebase_i(opts))
|
||||||
write_author_script(msg.message);
|
write_author_script(msg.message);
|
||||||
res = fast_forward_to(commit->object.oid.hash, head, unborn,
|
res = fast_forward_to(&commit->object.oid, &head, unborn,
|
||||||
opts);
|
opts);
|
||||||
if (res || command != TODO_REWORD)
|
if (res || command != TODO_REWORD)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
@ -1081,7 +1081,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
|
||||||
res = -1;
|
res = -1;
|
||||||
else if (!opts->strategy || !strcmp(opts->strategy, "recursive") || command == TODO_REVERT) {
|
else if (!opts->strategy || !strcmp(opts->strategy, "recursive") || command == TODO_REVERT) {
|
||||||
res = do_recursive_merge(base, next, base_label, next_label,
|
res = do_recursive_merge(base, next, base_label, next_label,
|
||||||
head, &msgbuf, opts);
|
head.hash, &msgbuf, opts);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
res |= write_message(msgbuf.buf, msgbuf.len,
|
res |= write_message(msgbuf.buf, msgbuf.len,
|
||||||
|
@ -1097,7 +1097,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
|
||||||
commit_list_insert(next, &remotes);
|
commit_list_insert(next, &remotes);
|
||||||
res |= try_merge_command(opts->strategy,
|
res |= try_merge_command(opts->strategy,
|
||||||
opts->xopts_nr, (const char **)opts->xopts,
|
opts->xopts_nr, (const char **)opts->xopts,
|
||||||
common, sha1_to_hex(head), remotes);
|
common, oid_to_hex(&head), remotes);
|
||||||
free_commit_list(common);
|
free_commit_list(common);
|
||||||
free_commit_list(remotes);
|
free_commit_list(remotes);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue