diff_setup_done(&diff_opts);
if (is_null_oid(&origin->commit->object.oid))
- do_diff_cache(&parent->tree->object.oid, &diff_opts);
+ do_diff_cache(&parent->maybe_tree->object.oid, &diff_opts);
else
- diff_tree_oid(&parent->tree->object.oid,
- &origin->commit->tree->object.oid,
+ diff_tree_oid(&parent->maybe_tree->object.oid,
+ &origin->commit->maybe_tree->object.oid,
"", &diff_opts);
diffcore_std(&diff_opts);
diff_setup_done(&diff_opts);
if (is_null_oid(&origin->commit->object.oid))
- do_diff_cache(&parent->tree->object.oid, &diff_opts);
+ do_diff_cache(&parent->maybe_tree->object.oid, &diff_opts);
else
- diff_tree_oid(&parent->tree->object.oid,
- &origin->commit->tree->object.oid,
+ diff_tree_oid(&parent->maybe_tree->object.oid,
+ &origin->commit->maybe_tree->object.oid,
"", &diff_opts);
diffcore_std(&diff_opts);
diff_opts.flags.find_copies_harder = 1;
if (is_null_oid(&target->commit->object.oid))
- do_diff_cache(&parent->tree->object.oid, &diff_opts);
+ do_diff_cache(&parent->maybe_tree->object.oid, &diff_opts);
else
- diff_tree_oid(&parent->tree->object.oid,
- &target->commit->tree->object.oid,
+ diff_tree_oid(&parent->maybe_tree->object.oid,
+ &target->commit->maybe_tree->object.oid,
"", &diff_opts);
if (!diff_opts.flags.find_copies_harder)
resolve_undo_clear();
if (opts->force) {
- ret = reset_tree(new_branch_info->commit->tree, opts, 1, writeout_error);
+ ret = reset_tree(new_branch_info->commit->maybe_tree, opts, 1, writeout_error);
if (ret)
return ret;
} else {
o.verbosity = 0;
work = write_tree_from_memory(&o);
- ret = reset_tree(new_branch_info->commit->tree, opts, 1,
+ ret = reset_tree(new_branch_info->commit->maybe_tree, opts, 1,
writeout_error);
if (ret)
return ret;
o.ancestor = old_branch_info->name;
o.branch1 = new_branch_info->name;
o.branch2 = "local";
- ret = merge_trees(&o, new_branch_info->commit->tree, work,
- old_branch_info->commit->tree, &result);
+ ret = merge_trees(&o, new_branch_info->commit->maybe_tree, work,
+ old_branch_info->commit->maybe_tree, &result);
if (ret < 0)
exit(128);
- ret = reset_tree(new_branch_info->commit->tree, opts, 0,
+ ret = reset_tree(new_branch_info->commit->maybe_tree, opts, 0,
writeout_error);
strbuf_release(&o.obuf);
if (ret)
*source_tree = parse_tree_indirect(rev);
} else {
parse_commit_or_die(new_branch_info->commit);
- *source_tree = new_branch_info->commit->tree;
+ *source_tree = new_branch_info->commit->maybe_tree;
}
if (!*source_tree) /* case (1): want a tree */
if (!obj)
die(_("invalid object '%s' given."), name);
if (obj->type == OBJ_COMMIT)
- obj = &((struct commit *)obj)->tree->object;
+ obj = &((struct commit *)obj)->maybe_tree->object;
if (obj->type == OBJ_TREE) {
obj->flags |= flags;
get_object_mark(&commit->parents->item->object) != 0 &&
!full_tree) {
parse_commit_or_die(commit->parents->item);
- diff_tree_oid(&commit->parents->item->tree->object.oid,
- &commit->tree->object.oid, "", &rev->diffopt);
+ diff_tree_oid(&commit->parents->item->maybe_tree->object.oid,
+ &commit->maybe_tree->object.oid, "", &rev->diffopt);
}
else
- diff_root_tree_oid(&commit->tree->object.oid,
+ diff_root_tree_oid(&commit->maybe_tree->object.oid,
"", &rev->diffopt);
/* Export the referenced blobs, and remember the marks. */
diff_setup_done(&opts);
- diff_tree_oid(&origin->tree->object.oid,
- &head->tree->object.oid,
+ diff_tree_oid(&origin->maybe_tree->object.oid,
+ &head->maybe_tree->object.oid,
"", &opts);
diffcore_std(&opts);
diff_flush(&opts);
for (i = 0; i < found.nr; i++) {
struct commit *c =
(struct commit *)found.objects[i].item;
- if (!tree_is_complete(&c->tree->object.oid)) {
+ if (!tree_is_complete(&c->maybe_tree->object.oid)) {
is_incomplete = 1;
c->object.flags |= INCOMPLETE;
}
item->graph_pos = pos;
hashcpy(oid.hash, commit_data);
- item->tree = lookup_tree(&oid);
+ item->maybe_tree = lookup_tree(&oid);
date_high = get_be32(commit_data + g->hash_len + 8) & 0x3;
date_low = get_be32(commit_data + g->hash_len + 12);
uint32_t packedDate[2];
parse_commit(*list);
- hashwrite(f, (*list)->tree->object.oid.hash, hash_len);
+ hashwrite(f, (*list)->maybe_tree->object.oid.hash, hash_len);
parent = (*list)->parents;
if (get_sha1_hex(bufptr + 5, parent.hash) < 0)
return error("bad tree pointer in commit %s",
oid_to_hex(&item->object.oid));
- item->tree = lookup_tree(&parent);
+ item->maybe_tree = lookup_tree(&parent);
bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
pptr = &item->parents;
unsigned int index;
timestamp_t date;
struct commit_list *parents;
- struct tree *tree;
+ struct tree *maybe_tree;
uint32_t graph_pos;
};
name = get_object_name(options, &commit->object);
if (name)
- put_object_name(options, &commit->tree->object, "%s:", name);
+ put_object_name(options, &commit->maybe_tree->object, "%s:", name);
- result = options->walk((struct object *)commit->tree, OBJ_TREE, data, options);
+ result = options->walk((struct object *)commit->maybe_tree, OBJ_TREE, data, options);
if (result < 0)
return result;
res = result;
err = fsck_ident(&buffer, &commit->object, options);
if (err)
return err;
- if (!commit->tree) {
+ if (!commit->maybe_tree) {
err = report(options, &commit->object, FSCK_MSG_BAD_TREE, "could not load commit's tree %s", sha1_to_hex(tree_sha1));
if (err)
return err;
int count = 0;
while ((commit = get_revision(revs)) != NULL) {
- p = process_tree(commit->tree, p);
+ p = process_tree(commit->maybe_tree, p);
commit->object.flags |= LOCAL;
if (!(commit->object.flags & UNINTERESTING))
count += add_send_request(&commit->object, lock);
assert(commit);
DIFF_QUEUE_CLEAR(&diff_queued_diff);
- diff_tree_oid(parent ? &parent->tree->object.oid : NULL,
- &commit->tree->object.oid, "", opt);
+ diff_tree_oid(parent ? &parent->maybe_tree->object.oid : NULL,
+ &commit->maybe_tree->object.oid, "", opt);
if (opt->detect_rename) {
filter_diffs_for_paths(range, 1);
if (diff_might_be_rename())
struct commit *parent = parents->item;
if (!(parent->object.flags & UNINTERESTING))
continue;
- mark_tree_uninteresting(parent->tree);
+ mark_tree_uninteresting(parent->maybe_tree);
if (revs->edge_hint && !(parent->object.flags & SHOWN)) {
parent->object.flags |= SHOWN;
show_edge(parent);
struct commit *commit = list->item;
if (commit->object.flags & UNINTERESTING) {
- mark_tree_uninteresting(commit->tree);
+ mark_tree_uninteresting(commit->maybe_tree);
if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {
commit->object.flags |= SHOWN;
show_edge(commit);
struct commit *commit = (struct commit *)obj;
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
continue;
- mark_tree_uninteresting(commit->tree);
+ mark_tree_uninteresting(commit->maybe_tree);
if (!(obj->flags & SHOWN)) {
obj->flags |= SHOWN;
show_edge(commit);
* an uninteresting boundary commit may not have its tree
* parsed yet, but we are not going to show them anyway
*/
- if (commit->tree)
- add_pending_tree(revs, commit->tree);
+ if (commit->maybe_tree)
+ add_pending_tree(revs, commit->maybe_tree);
show_commit(commit, show_data);
if (revs->tree_blobs_in_commit_order)
return 0;
parse_commit_or_die(commit);
- oid = &commit->tree->object.oid;
+ oid = &commit->maybe_tree->object.oid;
/* Root commit? */
parents = get_saved_parents(opt, commit);
* we merged _in_.
*/
parse_commit_or_die(parents->item);
- diff_tree_oid(&parents->item->tree->object.oid,
+ diff_tree_oid(&parents->item->maybe_tree->object.oid,
oid, "", &opt->diffopt);
log_tree_diff_flush(opt);
return !opt->loginfo;
struct commit *parent = parents->item;
parse_commit_or_die(parent);
- diff_tree_oid(&parent->tree->object.oid,
+ diff_tree_oid(&parent->maybe_tree->object.oid,
oid, "", &opt->diffopt);
log_tree_diff_flush(opt);
struct commit *commit = alloc_commit_node();
set_merge_remote_desc(commit, comment, (struct object *)commit);
- commit->tree = tree;
+ commit->maybe_tree = tree;
commit->object.parsed = 1;
return commit;
}
read_cache();
o->ancestor = "merged common ancestors";
- clean = merge_trees(o, h1->tree, h2->tree, merged_common_ancestors->tree,
+ clean = merge_trees(o, h1->maybe_tree, h2->maybe_tree,
+ merged_common_ancestors->maybe_tree,
&mrtree);
if (clean < 0) {
flush_output(o);
printf("No merge base found; doing history-less merge\n");
} else if (!bases->next) {
base_oid = &bases->item->object.oid;
- base_tree_oid = &bases->item->tree->object.oid;
+ base_tree_oid = &bases->item->maybe_tree->object.oid;
if (o->verbosity >= 4)
printf("One merge base found (%.7s)\n",
oid_to_hex(base_oid));
} else {
/* TODO: How to handle multiple merge-bases? */
base_oid = &bases->item->object.oid;
- base_tree_oid = &bases->item->tree->object.oid;
+ base_tree_oid = &bases->item->maybe_tree->object.oid;
if (o->verbosity >= 3)
printf("Multiple merge bases found. Using the first "
"(%.7s)\n", oid_to_hex(base_oid));
goto found_result;
}
- result = merge_from_diffs(o, base_tree_oid, &local->tree->object.oid,
- &remote->tree->object.oid, local_tree);
+ result = merge_from_diffs(o, base_tree_oid, &local->maybe_tree->object.oid,
+ &remote->maybe_tree->object.oid, local_tree);
if (result != 0) { /* non-trivial merge (with or without conflicts) */
/* Commit (partial) result */
struct commit *commit = (struct commit *) obj;
struct commit_list *parents = commit->parents;
- oidset_insert(set, &commit->tree->object.oid);
+ oidset_insert(set, &commit->maybe_tree->object.oid);
for (; parents; parents = parents->next)
oidset_insert(set, &parents->item->object.oid);
} else if (obj->type == OBJ_TAG) {
strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET));
return 1;
case 'T': /* tree hash */
- strbuf_addstr(sb, oid_to_hex(&commit->tree->object.oid));
+ strbuf_addstr(sb, oid_to_hex(&commit->maybe_tree->object.oid));
return 1;
case 't': /* abbreviated tree hash */
- strbuf_add_unique_abbrev(sb, commit->tree->object.oid.hash,
+ strbuf_add_unique_abbrev(sb, commit->maybe_tree->object.oid.hash,
c->pretty_ctx->abbrev);
return 1;
case 'P': /* parent hashes */
if (deref)
name++;
if (!strcmp(name, "tree")) {
- v->s = xstrdup(oid_to_hex(&commit->tree->object.oid));
+ v->s = xstrdup(oid_to_hex(&commit->maybe_tree->object.oid));
}
else if (!strcmp(name, "numparent")) {
v->value = commit_list_count(commit->parents);
static int rev_compare_tree(struct rev_info *revs,
struct commit *parent, struct commit *commit)
{
- struct tree *t1 = parent->tree;
- struct tree *t2 = commit->tree;
+ struct tree *t1 = parent->maybe_tree;
+ struct tree *t2 = commit->maybe_tree;
if (!t1)
return REV_TREE_NEW;
static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
{
int retval;
- struct tree *t1 = commit->tree;
+ struct tree *t1 = commit->maybe_tree;
if (!t1)
return 0;
if (!revs->prune)
return;
- if (!commit->tree)
+ if (!commit->maybe_tree)
return;
if (!commit->parents) {
o.show_rename_progress = 1;
head_tree = parse_tree_indirect(head);
- next_tree = next ? next->tree : empty_tree();
- base_tree = base ? base->tree : empty_tree();
+ next_tree = next ? next->maybe_tree : empty_tree();
+ base_tree = base ? base->maybe_tree : empty_tree();
for (xopt = opts->xopts; xopt != opts->xopts + opts->xopts_nr; xopt++)
parse_merge_opt(&o, *xopt);
return error(_("unable to update cache tree"));
return !oidcmp(&active_cache_tree->oid,
- &head_commit->tree->object.oid);
+ &head_commit->maybe_tree->object.oid);
}
static int write_author_script(const char *message)
}
if (!(flags & ALLOW_EMPTY) && !oidcmp(current_head ?
- ¤t_head->tree->object.oid :
+ ¤t_head->maybe_tree->object.oid :
&empty_tree_oid, &tree)) {
res = 1; /* run 'git commit' to display error message */
goto out;
if (parse_commit(parent))
return error(_("could not parse parent commit %s"),
oid_to_hex(&parent->object.oid));
- ptree_oid = &parent->tree->object.oid;
+ ptree_oid = &parent->maybe_tree->object.oid;
} else {
ptree_oid = the_hash_algo->empty_tree; /* commit is root */
}
- return !oidcmp(ptree_oid, &commit->tree->object.oid);
+ return !oidcmp(ptree_oid, &commit->maybe_tree->object.oid);
}
/*
if (o->type == OBJ_TAG)
o = ((struct tag*) o)->tagged;
else if (o->type == OBJ_COMMIT)
- o = &(((struct commit *) o)->tree->object);
+ o = &(((struct commit *) o)->maybe_tree->object);
else {
if (name)
error("%.*s: expected %s type, but the object "
oid_to_hex(entry.oid),
base->buf, entry.path);
- oidcpy(&oid, &commit->tree->object.oid);
+ oidcpy(&oid, &commit->maybe_tree->object.oid);
}
else
continue;
if (obj->type == OBJ_TREE)
return (struct tree *) obj;
else if (obj->type == OBJ_COMMIT)
- obj = &(((struct commit *) obj)->tree->object);
+ obj = &(((struct commit *) obj)->maybe_tree->object);
else if (obj->type == OBJ_TAG)
obj = ((struct tag *) obj)->tagged;
else
walker_say(walker, "walk %s\n", oid_to_hex(&commit->object.oid));
if (walker->get_tree) {
- if (process(walker, &commit->tree->object))
+ if (process(walker, &commit->maybe_tree->object))
return -1;
if (!walker->get_all)
walker->get_tree = 0;