Skip to content

Commit f06e90d

Browse files
bk2204gitster
authored andcommitted
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>
1 parent ace976b commit f06e90d

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

builtin/merge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,8 +1372,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
13721372
goto done;
13731373
}
13741374

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,
13771377
overwrite_ignore)) {
13781378
ret = 1;
13791379
goto done;

builtin/pull.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static int pull_into_void(const struct object_id *merge_head,
523523
* index/worktree changes that the user already made on the unborn
524524
* branch.
525525
*/
526-
if (checkout_fast_forward(EMPTY_TREE_SHA1_BIN, merge_head->hash, 0))
526+
if (checkout_fast_forward(&empty_tree_oid, merge_head, 0))
527527
return 1;
528528

529529
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)
839839
"fast-forwarding your working tree from\n"
840840
"commit %s."), oid_to_hex(&orig_head));
841841

842-
if (checkout_fast_forward(orig_head.hash, curr_head.hash, 0))
842+
if (checkout_fast_forward(&orig_head, &curr_head, 0))
843843
die(_("Cannot fast-forward your working tree.\n"
844844
"After making sure that you saved anything precious from\n"
845845
"$ git diff %s\n"

cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,8 +2198,8 @@ struct commit_list;
21982198
int try_merge_command(const char *strategy, size_t xopts_nr,
21992199
const char **xopts, struct commit_list *common,
22002200
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,
22032203
int overwrite_ignore);
22042204

22052205

merge.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ int try_merge_command(const char *strategy, size_t xopts_nr,
4444
return ret;
4545
}
4646

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,
4949
int overwrite_ignore)
5050
{
5151
struct tree *trees[MAX_UNPACK_TREES];
@@ -79,10 +79,10 @@ int checkout_fast_forward(const unsigned char *head,
7979
opts.fn = twoway_merge;
8080
setup_unpack_trees_porcelain(&opts, "merge");
8181

82-
trees[nr_trees] = parse_tree_indirect(head);
82+
trees[nr_trees] = parse_tree_indirect(head->hash);
8383
if (!trees[nr_trees++])
8484
return -1;
85-
trees[nr_trees] = parse_tree_indirect(remote);
85+
trees[nr_trees] = parse_tree_indirect(remote->hash);
8686
if (!trees[nr_trees++])
8787
return -1;
8888
for (i = 0; i < nr_trees; i++) {

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ static int fast_forward_to(const struct object_id *to, const struct object_id *f
382382
struct strbuf err = STRBUF_INIT;
383383

384384
read_cache();
385-
if (checkout_fast_forward(from->hash, to->hash, 1))
385+
if (checkout_fast_forward(from, to, 1))
386386
return -1; /* the callee should have complained already */
387387

388388
strbuf_addf(&sb, _("%s: fast-forward"), _(action_name(opts)));

0 commit comments

Comments
 (0)