tree: convert parse_tree_indirect to struct object_id

Convert parse_tree_indirect to take a pointer to struct object_id.
Update all the callers.  This transformation was achieved using the
following semantic patch and manual updates to the declaration and
definition.  Update builtin/checkout.c manually as well, since it uses a
ternary expression not handled by the semantic patch.

@@
expression E1;
@@
- parse_tree_indirect(E1.hash)
+ parse_tree_indirect(&E1)

@@
expression E1;
@@
- parse_tree_indirect(E1->hash)
+ parse_tree_indirect(E1)

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2017-05-06 22:10:37 +00:00
committed by Junio C Hamano
parent 48be4c625b
commit a9dbc17910
16 changed files with 28 additions and 28 deletions

View File

@ -527,10 +527,10 @@ static int merge_working_tree(const struct checkout_opts *opts,
setup_standard_excludes(topts.dir);
}
tree = parse_tree_indirect(old->commit ?
old->commit->object.oid.hash :
EMPTY_TREE_SHA1_BIN);
&old->commit->object.oid :
&empty_tree_oid);
init_tree_desc(&trees[0], tree->buffer, tree->size);
tree = parse_tree_indirect(new->commit->object.oid.hash);
tree = parse_tree_indirect(&new->commit->object.oid);
init_tree_desc(&trees[1], tree->buffer, tree->size);
ret = unpack_trees(2, trees, &topts);
@ -1050,7 +1050,7 @@ static int parse_branchname_arg(int argc, const char **argv,
new->commit = lookup_commit_reference_gently(rev, 1);
if (!new->commit) {
/* not a commit */
*source_tree = parse_tree_indirect(rev->hash);
*source_tree = parse_tree_indirect(rev);
} else {
parse_commit_or_die(new->commit);
*source_tree = new->commit->tree;