merge: convert checkout_fast_forward to struct object_id

Converting checkout_fast_forward is required to convert parse_tree_indirect. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 6, 2017 at 22:10 UTC f06e90dac1f63f46d299ca728464fb0a450f6972
5 files changed +11 -11
builtin/merge.c
+2 -2
@@ -1372,8 +1372,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1372 goto done;
1373 }
1374
1375 - if (checkout_fast_forward(head_commit->object.oid.hash,
1376 - commit->object.oid.hash,
1375 + if (checkout_fast_forward(&head_commit->object.oid,
1376 + &commit->object.oid,
1377 overwrite_ignore)) {
1378 ret = 1;
1379 goto done;
builtin/pull.c
+2 -2
@@ -523,7 +523,7 @@ static int pull_into_void(const struct object_id *merge_head,
523 * index/worktree changes that the user already made on the unborn
524 * branch.
525 */
526 - if (checkout_fast_forward(EMPTY_TREE_SHA1_BIN, merge_head->hash, 0))
526 + if (checkout_fast_forward(&empty_tree_oid, merge_head, 0))
527 return 1;
528
529 if (update_ref("initial pull", "HEAD", merge_head->hash, curr_head->hash, 0, UPDATE_REFS_DIE_ON_ERR))
@@ -839,7 +839,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
839 "fast-forwarding your working tree from\n"
840 "commit %s."), oid_to_hex(&orig_head));
841
842 - if (checkout_fast_forward(orig_head.hash, curr_head.hash, 0))
842 + if (checkout_fast_forward(&orig_head, &curr_head, 0))
843 die(_("Cannot fast-forward your working tree.\n"
844 "After making sure that you saved anything precious from\n"
845 "$ git diff %s\n"
cache.h
+2 -2
@@ -2198,8 +2198,8 @@ struct commit_list;
2198 int try_merge_command(const char *strategy, size_t xopts_nr,
2199 const char **xopts, struct commit_list *common,
2200 const char *head_arg, struct commit_list *remotes);
2201 -int checkout_fast_forward(const unsigned char *from,
2202 - const unsigned char *to,
2201 +int checkout_fast_forward(const struct object_id *from,
2202 + const struct object_id *to,
2203 int overwrite_ignore);
2204
2205
merge.c
+4 -4
@@ -44,8 +44,8 @@ int try_merge_command(const char *strategy, size_t xopts_nr,
44 return ret;
45 }
46
47 -int checkout_fast_forward(const unsigned char *head,
48 - const unsigned char *remote,
47 +int checkout_fast_forward(const struct object_id *head,
48 + const struct object_id *remote,
49 int overwrite_ignore)
50 {
51 struct tree *trees[MAX_UNPACK_TREES];
@@ -79,10 +79,10 @@ int checkout_fast_forward(const unsigned char *head,
79 opts.fn = twoway_merge;
80 setup_unpack_trees_porcelain(&opts, "merge");
81
82 - trees[nr_trees] = parse_tree_indirect(head);
82 + trees[nr_trees] = parse_tree_indirect(head->hash);
83 if (!trees[nr_trees++])
84 return -1;
85 - trees[nr_trees] = parse_tree_indirect(remote);
85 + trees[nr_trees] = parse_tree_indirect(remote->hash);
86 if (!trees[nr_trees++])
87 return -1;
88 for (i = 0; i < nr_trees; i++) {
sequencer.c
+1 -1
@@ -382,7 +382,7 @@ static int fast_forward_to(const struct object_id *to, const struct object_id *f
382 struct strbuf err = STRBUF_INIT;
383
384 read_cache();
385 - if (checkout_fast_forward(from->hash, to->hash, 1))
385 + if (checkout_fast_forward(from, to, 1))
386 return -1; /* the callee should have complained already */
387
388 strbuf_addf(&sb, _("%s: fast-forward"), _(action_name(opts)));