Remove get_object_hash.
Convert all instances of get_object_hash to use an appropriate reference to the hash member of the oid member of struct object. This provides no functional change, as it is essentially a macro substitution. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
This commit is contained in:
parent
f2fd0760f6
commit
ed1c9977cb
@ -241,7 +241,7 @@ int write_archive_entries(struct archiver_args *args,
|
|||||||
len--;
|
len--;
|
||||||
if (args->verbose)
|
if (args->verbose)
|
||||||
fprintf(stderr, "%.*s\n", (int)len, args->base);
|
fprintf(stderr, "%.*s\n", (int)len, args->base);
|
||||||
err = write_entry(args, get_object_hash(args->tree->object), args->base,
|
err = write_entry(args, args->tree->object.oid.hash, args->base,
|
||||||
len, 040777);
|
len, 040777);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
@ -374,7 +374,7 @@ static void parse_treeish_arg(const char **argv,
|
|||||||
|
|
||||||
commit = lookup_commit_reference_gently(oid.hash, 1);
|
commit = lookup_commit_reference_gently(oid.hash, 1);
|
||||||
if (commit) {
|
if (commit) {
|
||||||
commit_sha1 = get_object_hash(commit->object);
|
commit_sha1 = commit->object.oid.hash;
|
||||||
archive_time = commit->date;
|
archive_time = commit->date;
|
||||||
} else {
|
} else {
|
||||||
commit_sha1 = NULL;
|
commit_sha1 = NULL;
|
||||||
@ -390,7 +390,7 @@ static void parse_treeish_arg(const char **argv,
|
|||||||
unsigned int mode;
|
unsigned int mode;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = get_tree_entry(get_object_hash(tree->object), prefix,
|
err = get_tree_entry(tree->object.oid.hash, prefix,
|
||||||
tree_oid.hash, &mode);
|
tree_oid.hash, &mode);
|
||||||
if (err || !S_ISDIR(mode))
|
if (err || !S_ISDIR(mode))
|
||||||
die("current working directory is untracked");
|
die("current working directory is untracked");
|
||||||
|
6
bisect.c
6
bisect.c
@ -500,7 +500,7 @@ struct commit_list *filter_skipped(struct commit_list *list,
|
|||||||
struct commit_list *next = list->next;
|
struct commit_list *next = list->next;
|
||||||
list->next = NULL;
|
list->next = NULL;
|
||||||
if (0 <= sha1_array_lookup(&skipped_revs,
|
if (0 <= sha1_array_lookup(&skipped_revs,
|
||||||
get_object_hash(list->item->object))) {
|
list->item->object.oid.hash)) {
|
||||||
if (skipped_first && !*skipped_first)
|
if (skipped_first && !*skipped_first)
|
||||||
*skipped_first = 1;
|
*skipped_first = 1;
|
||||||
/* Move current to tried list */
|
/* Move current to tried list */
|
||||||
@ -784,7 +784,7 @@ static void check_merge_bases(int no_checkout)
|
|||||||
result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);
|
result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);
|
||||||
|
|
||||||
for (; result; result = result->next) {
|
for (; result; result = result->next) {
|
||||||
const unsigned char *mb = get_object_hash(result->item->object);
|
const unsigned char *mb = result->item->object.oid.hash;
|
||||||
if (!hashcmp(mb, current_bad_oid->hash)) {
|
if (!hashcmp(mb, current_bad_oid->hash)) {
|
||||||
handle_bad_merge_base();
|
handle_bad_merge_base();
|
||||||
} else if (0 <= sha1_array_lookup(&good_revs, mb)) {
|
} else if (0 <= sha1_array_lookup(&good_revs, mb)) {
|
||||||
@ -973,7 +973,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
|
|||||||
exit(4);
|
exit(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bisect_rev = get_object_hash(revs.commits->item->object);
|
bisect_rev = revs.commits->item->object.oid.hash;
|
||||||
|
|
||||||
if (!hashcmp(bisect_rev, current_bad_oid->hash)) {
|
if (!hashcmp(bisect_rev, current_bad_oid->hash)) {
|
||||||
exit_if_skipped_commits(tried, current_bad_oid);
|
exit_if_skipped_commits(tried, current_bad_oid);
|
||||||
|
2
branch.c
2
branch.c
@ -267,7 +267,7 @@ void create_branch(const char *head,
|
|||||||
|
|
||||||
if ((commit = lookup_commit_reference(sha1)) == NULL)
|
if ((commit = lookup_commit_reference(sha1)) == NULL)
|
||||||
die(_("Not a valid branch point: '%s'."), start_name);
|
die(_("Not a valid branch point: '%s'."), start_name);
|
||||||
hashcpy(sha1, get_object_hash(commit->object));
|
hashcpy(sha1, commit->object.oid.hash);
|
||||||
|
|
||||||
if (forcing)
|
if (forcing)
|
||||||
snprintf(msg, sizeof msg, "branch: Reset to %s",
|
snprintf(msg, sizeof msg, "branch: Reset to %s",
|
||||||
|
@ -506,7 +506,7 @@ static int fill_blob_sha1_and_mode(struct origin *origin)
|
|||||||
{
|
{
|
||||||
if (!is_null_sha1(origin->blob_sha1))
|
if (!is_null_sha1(origin->blob_sha1))
|
||||||
return 0;
|
return 0;
|
||||||
if (get_tree_entry(get_object_hash(origin->commit->object),
|
if (get_tree_entry(origin->commit->object.oid.hash,
|
||||||
origin->path,
|
origin->path,
|
||||||
origin->blob_sha1, &origin->mode))
|
origin->blob_sha1, &origin->mode))
|
||||||
goto error_out;
|
goto error_out;
|
||||||
@ -558,10 +558,10 @@ static struct origin *find_origin(struct scoreboard *sb,
|
|||||||
diff_setup_done(&diff_opts);
|
diff_setup_done(&diff_opts);
|
||||||
|
|
||||||
if (is_null_oid(&origin->commit->object.oid))
|
if (is_null_oid(&origin->commit->object.oid))
|
||||||
do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
|
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
|
||||||
else
|
else
|
||||||
diff_tree_sha1(get_object_hash(parent->tree->object),
|
diff_tree_sha1(parent->tree->object.oid.hash,
|
||||||
get_object_hash(origin->commit->tree->object),
|
origin->commit->tree->object.oid.hash,
|
||||||
"", &diff_opts);
|
"", &diff_opts);
|
||||||
diffcore_std(&diff_opts);
|
diffcore_std(&diff_opts);
|
||||||
|
|
||||||
@ -628,10 +628,10 @@ static struct origin *find_rename(struct scoreboard *sb,
|
|||||||
diff_setup_done(&diff_opts);
|
diff_setup_done(&diff_opts);
|
||||||
|
|
||||||
if (is_null_oid(&origin->commit->object.oid))
|
if (is_null_oid(&origin->commit->object.oid))
|
||||||
do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
|
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
|
||||||
else
|
else
|
||||||
diff_tree_sha1(get_object_hash(parent->tree->object),
|
diff_tree_sha1(parent->tree->object.oid.hash,
|
||||||
get_object_hash(origin->commit->tree->object),
|
origin->commit->tree->object.oid.hash,
|
||||||
"", &diff_opts);
|
"", &diff_opts);
|
||||||
diffcore_std(&diff_opts);
|
diffcore_std(&diff_opts);
|
||||||
|
|
||||||
@ -1276,10 +1276,10 @@ static void find_copy_in_parent(struct scoreboard *sb,
|
|||||||
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
|
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
|
||||||
|
|
||||||
if (is_null_oid(&target->commit->object.oid))
|
if (is_null_oid(&target->commit->object.oid))
|
||||||
do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
|
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
|
||||||
else
|
else
|
||||||
diff_tree_sha1(get_object_hash(parent->tree->object),
|
diff_tree_sha1(parent->tree->object.oid.hash,
|
||||||
get_object_hash(target->commit->tree->object),
|
target->commit->tree->object.oid.hash,
|
||||||
"", &diff_opts);
|
"", &diff_opts);
|
||||||
|
|
||||||
if (!DIFF_OPT_TST(&diff_opts, FIND_COPIES_HARDER))
|
if (!DIFF_OPT_TST(&diff_opts, FIND_COPIES_HARDER))
|
||||||
@ -2077,7 +2077,7 @@ static int read_ancestry(const char *graft_file)
|
|||||||
|
|
||||||
static int update_auto_abbrev(int auto_abbrev, struct origin *suspect)
|
static int update_auto_abbrev(int auto_abbrev, struct origin *suspect)
|
||||||
{
|
{
|
||||||
const char *uniq = find_unique_abbrev(get_object_hash(suspect->commit->object),
|
const char *uniq = find_unique_abbrev(suspect->commit->object.oid.hash,
|
||||||
auto_abbrev);
|
auto_abbrev);
|
||||||
int len = strlen(uniq);
|
int len = strlen(uniq);
|
||||||
if (auto_abbrev < len)
|
if (auto_abbrev < len)
|
||||||
@ -2216,7 +2216,7 @@ static void verify_working_tree_path(struct commit *work_tree, const char *path)
|
|||||||
struct commit_list *parents;
|
struct commit_list *parents;
|
||||||
|
|
||||||
for (parents = work_tree->parents; parents; parents = parents->next) {
|
for (parents = work_tree->parents; parents; parents = parents->next) {
|
||||||
const unsigned char *commit_sha1 = get_object_hash(parents->item->object);
|
const unsigned char *commit_sha1 = parents->item->object.oid.hash;
|
||||||
unsigned char blob_sha1[20];
|
unsigned char blob_sha1[20];
|
||||||
unsigned mode;
|
unsigned mode;
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_array_item *item,
|
|||||||
fill_tracking_info(&stat, refname, filter->verbose > 1);
|
fill_tracking_info(&stat, refname, filter->verbose > 1);
|
||||||
|
|
||||||
strbuf_addf(out, " %s %s%s",
|
strbuf_addf(out, " %s %s%s",
|
||||||
find_unique_abbrev(get_object_hash(item->commit->object), filter->abbrev),
|
find_unique_abbrev(item->commit->object.oid.hash, filter->abbrev),
|
||||||
stat.buf, sub);
|
stat.buf, sub);
|
||||||
strbuf_release(&stat);
|
strbuf_release(&stat);
|
||||||
strbuf_release(&subject);
|
strbuf_release(&subject);
|
||||||
|
@ -401,7 +401,7 @@ static void describe_detached_head(const char *msg, struct commit *commit)
|
|||||||
if (!parse_commit(commit))
|
if (!parse_commit(commit))
|
||||||
pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);
|
pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);
|
||||||
fprintf(stderr, "%s %s... %s\n", msg,
|
fprintf(stderr, "%s %s... %s\n", msg,
|
||||||
find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV), sb.buf);
|
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf);
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
|
|||||||
setup_standard_excludes(topts.dir);
|
setup_standard_excludes(topts.dir);
|
||||||
}
|
}
|
||||||
tree = parse_tree_indirect(old->commit ?
|
tree = parse_tree_indirect(old->commit ?
|
||||||
get_object_hash(old->commit->object) :
|
old->commit->object.oid.hash :
|
||||||
EMPTY_TREE_SHA1_BIN);
|
EMPTY_TREE_SHA1_BIN);
|
||||||
init_tree_desc(&trees[0], tree->buffer, tree->size);
|
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.hash);
|
||||||
@ -653,7 +653,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
|
|||||||
if (!strcmp(new->name, "HEAD") && !new->path && !opts->force_detach) {
|
if (!strcmp(new->name, "HEAD") && !new->path && !opts->force_detach) {
|
||||||
/* Nothing to do. */
|
/* Nothing to do. */
|
||||||
} else if (opts->force_detach || !new->path) { /* No longer on any branch. */
|
} else if (opts->force_detach || !new->path) { /* No longer on any branch. */
|
||||||
update_ref(msg.buf, "HEAD", get_object_hash(new->commit->object), NULL,
|
update_ref(msg.buf, "HEAD", new->commit->object.oid.hash, NULL,
|
||||||
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
||||||
if (!opts->quiet) {
|
if (!opts->quiet) {
|
||||||
if (old->path && advice_detached_head)
|
if (old->path && advice_detached_head)
|
||||||
@ -704,7 +704,7 @@ static void describe_one_orphan(struct strbuf *sb, struct commit *commit)
|
|||||||
{
|
{
|
||||||
strbuf_addstr(sb, " ");
|
strbuf_addstr(sb, " ");
|
||||||
strbuf_addstr(sb,
|
strbuf_addstr(sb,
|
||||||
find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV));
|
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
|
||||||
strbuf_addch(sb, ' ');
|
strbuf_addch(sb, ' ');
|
||||||
if (!parse_commit(commit))
|
if (!parse_commit(commit))
|
||||||
pp_commit_easy(CMIT_FMT_ONELINE, commit, sb);
|
pp_commit_easy(CMIT_FMT_ONELINE, commit, sb);
|
||||||
@ -762,7 +762,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
|
|||||||
" git branch <new-branch-name> %s\n\n",
|
" git branch <new-branch-name> %s\n\n",
|
||||||
/* Give ngettext() the count */
|
/* Give ngettext() the count */
|
||||||
lost),
|
lost),
|
||||||
find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV));
|
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -657,7 +657,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
|
|||||||
} else if (our) {
|
} else if (our) {
|
||||||
struct commit *c = lookup_commit_reference(our->old_oid.hash);
|
struct commit *c = lookup_commit_reference(our->old_oid.hash);
|
||||||
/* --branch specifies a non-branch (i.e. tags), detach HEAD */
|
/* --branch specifies a non-branch (i.e. tags), detach HEAD */
|
||||||
update_ref(msg, "HEAD", get_object_hash(c->object),
|
update_ref(msg, "HEAD", c->object.oid.hash,
|
||||||
NULL, REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
NULL, REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
||||||
} else if (remote) {
|
} else if (remote) {
|
||||||
/*
|
/*
|
||||||
|
@ -299,7 +299,7 @@ static void create_base_index(const struct commit *current_head)
|
|||||||
opts.dst_index = &the_index;
|
opts.dst_index = &the_index;
|
||||||
|
|
||||||
opts.fn = oneway_merge;
|
opts.fn = oneway_merge;
|
||||||
tree = parse_tree_indirect(get_object_hash(current_head->object));
|
tree = parse_tree_indirect(current_head->object.oid.hash);
|
||||||
if (!tree)
|
if (!tree)
|
||||||
die(_("failed to unpack HEAD tree object"));
|
die(_("failed to unpack HEAD tree object"));
|
||||||
parse_tree(tree);
|
parse_tree(tree);
|
||||||
@ -1766,7 +1766,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
|||||||
if (!transaction ||
|
if (!transaction ||
|
||||||
ref_transaction_update(transaction, "HEAD", sha1,
|
ref_transaction_update(transaction, "HEAD", sha1,
|
||||||
current_head
|
current_head
|
||||||
? get_object_hash(current_head->object) : null_sha1,
|
? current_head->object.oid.hash : null_sha1,
|
||||||
0, sb.buf, &err) ||
|
0, sb.buf, &err) ||
|
||||||
ref_transaction_commit(transaction, &err)) {
|
ref_transaction_commit(transaction, &err)) {
|
||||||
rollback_index_files();
|
rollback_index_files();
|
||||||
@ -1793,10 +1793,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
|||||||
cfg = init_copy_notes_for_rewrite("amend");
|
cfg = init_copy_notes_for_rewrite("amend");
|
||||||
if (cfg) {
|
if (cfg) {
|
||||||
/* we are amending, so current_head is not NULL */
|
/* we are amending, so current_head is not NULL */
|
||||||
copy_note_for_rewrite(cfg, get_object_hash(current_head->object), sha1);
|
copy_note_for_rewrite(cfg, current_head->object.oid.hash, sha1);
|
||||||
finish_copy_notes_for_rewrite(cfg, "Notes added by 'git commit --amend'");
|
finish_copy_notes_for_rewrite(cfg, "Notes added by 'git commit --amend'");
|
||||||
}
|
}
|
||||||
run_rewrite_hook(get_object_hash(current_head->object), sha1);
|
run_rewrite_hook(current_head->object.oid.hash, sha1);
|
||||||
}
|
}
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
print_summary(prefix, sha1, !current_head);
|
print_summary(prefix, sha1, !current_head);
|
||||||
|
@ -252,14 +252,14 @@ static void describe(const char *arg, int last_one)
|
|||||||
if (!cmit)
|
if (!cmit)
|
||||||
die(_("%s is not a valid '%s' object"), arg, commit_type);
|
die(_("%s is not a valid '%s' object"), arg, commit_type);
|
||||||
|
|
||||||
n = find_commit_name(get_object_hash(cmit->object));
|
n = find_commit_name(cmit->object.oid.hash);
|
||||||
if (n && (tags || all || n->prio == 2)) {
|
if (n && (tags || all || n->prio == 2)) {
|
||||||
/*
|
/*
|
||||||
* Exact match to an existing ref.
|
* Exact match to an existing ref.
|
||||||
*/
|
*/
|
||||||
display_name(n);
|
display_name(n);
|
||||||
if (longformat)
|
if (longformat)
|
||||||
show_suffix(0, n->tag ? get_object_hash(*n->tag->tagged) : sha1);
|
show_suffix(0, n->tag ? n->tag->tagged->oid.hash : sha1);
|
||||||
if (dirty)
|
if (dirty)
|
||||||
printf("%s", dirty);
|
printf("%s", dirty);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -380,7 +380,7 @@ static void describe(const char *arg, int last_one)
|
|||||||
|
|
||||||
display_name(all_matches[0].name);
|
display_name(all_matches[0].name);
|
||||||
if (abbrev)
|
if (abbrev)
|
||||||
show_suffix(all_matches[0].depth, get_object_hash(cmit->object));
|
show_suffix(all_matches[0].depth, cmit->object.oid.hash);
|
||||||
if (dirty)
|
if (dirty)
|
||||||
printf("%s", dirty);
|
printf("%s", dirty);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -51,7 +51,7 @@ static int stdin_diff_trees(struct tree *tree1, char *line, int len)
|
|||||||
return -1;
|
return -1;
|
||||||
printf("%s %s\n", oid_to_hex(&tree1->object.oid),
|
printf("%s %s\n", oid_to_hex(&tree1->object.oid),
|
||||||
oid_to_hex(&tree2->object.oid));
|
oid_to_hex(&tree2->object.oid));
|
||||||
diff_tree_sha1(get_object_hash(tree1->object), get_object_hash(tree2->object),
|
diff_tree_sha1(tree1->object.oid.hash, tree2->object.oid.hash,
|
||||||
"", &log_tree_opt.diffopt);
|
"", &log_tree_opt.diffopt);
|
||||||
log_tree_diff_flush(&log_tree_opt);
|
log_tree_diff_flush(&log_tree_opt);
|
||||||
return 0;
|
return 0;
|
||||||
@ -139,7 +139,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
tree1 = opt->pending.objects[0].item;
|
tree1 = opt->pending.objects[0].item;
|
||||||
diff_tree_commit_sha1(get_object_hash(*tree1));
|
diff_tree_commit_sha1(tree1->oid.hash);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
tree1 = opt->pending.objects[0].item;
|
tree1 = opt->pending.objects[0].item;
|
||||||
@ -149,8 +149,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
|
|||||||
tree2 = tree1;
|
tree2 = tree1;
|
||||||
tree1 = tmp;
|
tree1 = tmp;
|
||||||
}
|
}
|
||||||
diff_tree_sha1(get_object_hash(*tree1),
|
diff_tree_sha1(tree1->oid.hash,
|
||||||
get_object_hash(*tree2),
|
tree2->oid.hash,
|
||||||
"", &opt->diffopt);
|
"", &opt->diffopt);
|
||||||
log_tree_diff_flush(opt);
|
log_tree_diff_flush(opt);
|
||||||
break;
|
break;
|
||||||
|
@ -175,8 +175,8 @@ static int builtin_diff_tree(struct rev_info *revs,
|
|||||||
*/
|
*/
|
||||||
if (ent1->item->flags & UNINTERESTING)
|
if (ent1->item->flags & UNINTERESTING)
|
||||||
swap = 1;
|
swap = 1;
|
||||||
sha1[swap] = get_object_hash(*ent0->item);
|
sha1[swap] = ent0->item->oid.hash;
|
||||||
sha1[1 - swap] = get_object_hash(*ent1->item);
|
sha1[1 - swap] = ent1->item->oid.hash;
|
||||||
diff_tree_sha1(sha1[0], sha1[1], "", &revs->diffopt);
|
diff_tree_sha1(sha1[0], sha1[1], "", &revs->diffopt);
|
||||||
log_tree_diff_flush(revs);
|
log_tree_diff_flush(revs);
|
||||||
return 0;
|
return 0;
|
||||||
@ -196,8 +196,8 @@ static int builtin_diff_combined(struct rev_info *revs,
|
|||||||
if (!revs->dense_combined_merges && !revs->combine_merges)
|
if (!revs->dense_combined_merges && !revs->combine_merges)
|
||||||
revs->dense_combined_merges = revs->combine_merges = 1;
|
revs->dense_combined_merges = revs->combine_merges = 1;
|
||||||
for (i = 1; i < ents; i++)
|
for (i = 1; i < ents; i++)
|
||||||
sha1_array_append(&parents, get_object_hash(*ent[i].item));
|
sha1_array_append(&parents, ent[i].item->oid.hash);
|
||||||
diff_tree_combined(get_object_hash(*ent[0].item), &parents,
|
diff_tree_combined(ent[0].item->oid.hash, &parents,
|
||||||
revs->dense_combined_merges, revs);
|
revs->dense_combined_merges, revs);
|
||||||
sha1_array_clear(&parents);
|
sha1_array_clear(&parents);
|
||||||
return 0;
|
return 0;
|
||||||
@ -395,7 +395,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
|||||||
const char *name = entry->name;
|
const char *name = entry->name;
|
||||||
int flags = (obj->flags & UNINTERESTING);
|
int flags = (obj->flags & UNINTERESTING);
|
||||||
if (!obj->parsed)
|
if (!obj->parsed)
|
||||||
obj = parse_object(get_object_hash(*obj));
|
obj = parse_object(obj->oid.hash);
|
||||||
obj = deref_tag(obj, NULL, 0);
|
obj = deref_tag(obj, NULL, 0);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
die(_("invalid object '%s' given."), name);
|
die(_("invalid object '%s' given."), name);
|
||||||
@ -408,7 +408,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
|||||||
} else if (obj->type == OBJ_BLOB) {
|
} else if (obj->type == OBJ_BLOB) {
|
||||||
if (2 <= blobs)
|
if (2 <= blobs)
|
||||||
die(_("more than two blobs given: '%s'"), name);
|
die(_("more than two blobs given: '%s'"), name);
|
||||||
hashcpy(blob[blobs].sha1, get_object_hash(*obj));
|
hashcpy(blob[blobs].sha1, obj->oid.hash);
|
||||||
blob[blobs].name = name;
|
blob[blobs].name = name;
|
||||||
blob[blobs].mode = entry->mode;
|
blob[blobs].mode = entry->mode;
|
||||||
blobs++;
|
blobs++;
|
||||||
|
@ -562,11 +562,11 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
|
|||||||
get_object_mark(&commit->parents->item->object) != 0 &&
|
get_object_mark(&commit->parents->item->object) != 0 &&
|
||||||
!full_tree) {
|
!full_tree) {
|
||||||
parse_commit_or_die(commit->parents->item);
|
parse_commit_or_die(commit->parents->item);
|
||||||
diff_tree_sha1(get_object_hash(commit->parents->item->tree->object),
|
diff_tree_sha1(commit->parents->item->tree->object.oid.hash,
|
||||||
get_object_hash(commit->tree->object), "", &rev->diffopt);
|
commit->tree->object.oid.hash, "", &rev->diffopt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
diff_root_tree_sha1(get_object_hash(commit->tree->object),
|
diff_root_tree_sha1(commit->tree->object.oid.hash,
|
||||||
"", &rev->diffopt);
|
"", &rev->diffopt);
|
||||||
|
|
||||||
/* Export the referenced blobs, and remember the marks. */
|
/* Export the referenced blobs, and remember the marks. */
|
||||||
@ -665,7 +665,7 @@ static void handle_tag(const char *name, struct tag *tag)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = read_sha1_file(get_object_hash(tag->object), &type, &size);
|
buf = read_sha1_file(tag->object.oid.hash, &type, &size);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
die ("Could not read tag %s", oid_to_hex(&tag->object.oid));
|
die ("Could not read tag %s", oid_to_hex(&tag->object.oid));
|
||||||
message = memmem(buf, size, "\n\n", 2);
|
message = memmem(buf, size, "\n\n", 2);
|
||||||
@ -777,7 +777,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
|
|||||||
|
|
||||||
/* handle nested tags */
|
/* handle nested tags */
|
||||||
while (tag && tag->object.type == OBJ_TAG) {
|
while (tag && tag->object.type == OBJ_TAG) {
|
||||||
parse_object(get_object_hash(tag->object));
|
parse_object(tag->object.oid.hash);
|
||||||
string_list_append(&extra_refs, full_name)->util = tag;
|
string_list_append(&extra_refs, full_name)->util = tag;
|
||||||
tag = (struct tag *)tag->tagged;
|
tag = (struct tag *)tag->tagged;
|
||||||
}
|
}
|
||||||
@ -828,7 +828,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
|
|||||||
case OBJ_COMMIT:
|
case OBJ_COMMIT:
|
||||||
break;
|
break;
|
||||||
case OBJ_BLOB:
|
case OBJ_BLOB:
|
||||||
export_blob(get_object_hash(commit->object));
|
export_blob(commit->object.oid.hash);
|
||||||
continue;
|
continue;
|
||||||
default: /* OBJ_TAG (nested tags) is already handled */
|
default: /* OBJ_TAG (nested tags) is already handled */
|
||||||
warning("Tag points to object of unexpected type %s, skipping.",
|
warning("Tag points to object of unexpected type %s, skipping.",
|
||||||
|
@ -530,7 +530,7 @@ static int update_local_ref(struct ref *ref,
|
|||||||
if (in_merge_bases(current, updated)) {
|
if (in_merge_bases(current, updated)) {
|
||||||
struct strbuf quickref = STRBUF_INIT;
|
struct strbuf quickref = STRBUF_INIT;
|
||||||
int r;
|
int r;
|
||||||
strbuf_add_unique_abbrev(&quickref, get_object_hash(current->object), DEFAULT_ABBREV);
|
strbuf_add_unique_abbrev(&quickref, current->object.oid.hash, DEFAULT_ABBREV);
|
||||||
strbuf_addstr(&quickref, "..");
|
strbuf_addstr(&quickref, "..");
|
||||||
strbuf_add_unique_abbrev(&quickref, ref->new_oid.hash, DEFAULT_ABBREV);
|
strbuf_add_unique_abbrev(&quickref, ref->new_oid.hash, DEFAULT_ABBREV);
|
||||||
if ((recurse_submodules != RECURSE_SUBMODULES_OFF) &&
|
if ((recurse_submodules != RECURSE_SUBMODULES_OFF) &&
|
||||||
@ -547,7 +547,7 @@ static int update_local_ref(struct ref *ref,
|
|||||||
} else if (force || ref->force) {
|
} else if (force || ref->force) {
|
||||||
struct strbuf quickref = STRBUF_INIT;
|
struct strbuf quickref = STRBUF_INIT;
|
||||||
int r;
|
int r;
|
||||||
strbuf_add_unique_abbrev(&quickref, get_object_hash(current->object), DEFAULT_ABBREV);
|
strbuf_add_unique_abbrev(&quickref, current->object.oid.hash, DEFAULT_ABBREV);
|
||||||
strbuf_addstr(&quickref, "...");
|
strbuf_addstr(&quickref, "...");
|
||||||
strbuf_add_unique_abbrev(&quickref, ref->new_oid.hash, DEFAULT_ABBREV);
|
strbuf_add_unique_abbrev(&quickref, ref->new_oid.hash, DEFAULT_ABBREV);
|
||||||
if ((recurse_submodules != RECURSE_SUBMODULES_OFF) &&
|
if ((recurse_submodules != RECURSE_SUBMODULES_OFF) &&
|
||||||
|
@ -568,7 +568,7 @@ static void find_merge_parents(struct merge_parents *result,
|
|||||||
if (!parent)
|
if (!parent)
|
||||||
continue;
|
continue;
|
||||||
commit_list_insert(parent, &parents);
|
commit_list_insert(parent, &parents);
|
||||||
add_merge_parent(result, get_object_hash(*obj), get_object_hash(parent->object));
|
add_merge_parent(result, obj->oid.hash, parent->object.oid.hash);
|
||||||
}
|
}
|
||||||
head_commit = lookup_commit(head);
|
head_commit = lookup_commit(head);
|
||||||
if (head_commit)
|
if (head_commit)
|
||||||
@ -578,7 +578,7 @@ static void find_merge_parents(struct merge_parents *result,
|
|||||||
while (parents) {
|
while (parents) {
|
||||||
struct commit *cmit = pop_commit(&parents);
|
struct commit *cmit = pop_commit(&parents);
|
||||||
for (i = 0; i < result->nr; i++)
|
for (i = 0; i < result->nr; i++)
|
||||||
if (!hashcmp(result->item[i].commit, get_object_hash(cmit->object)))
|
if (!hashcmp(result->item[i].commit, cmit->object.oid.hash))
|
||||||
result->item[i].used = 1;
|
result->item[i].used = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ static void check_reachable_object(struct object *obj)
|
|||||||
* do a full fsck
|
* do a full fsck
|
||||||
*/
|
*/
|
||||||
if (!(obj->flags & HAS_OBJ)) {
|
if (!(obj->flags & HAS_OBJ)) {
|
||||||
if (has_sha1_pack(get_object_hash(*obj)))
|
if (has_sha1_pack(obj->oid.hash))
|
||||||
return; /* it is in pack - forget about it */
|
return; /* it is in pack - forget about it */
|
||||||
if (connectivity_only && has_object_file(&obj->oid))
|
if (connectivity_only && has_object_file(&obj->oid))
|
||||||
return;
|
return;
|
||||||
@ -249,7 +249,7 @@ static void check_unreachable_object(struct object *obj)
|
|||||||
if (!(f = fopen(filename, "w")))
|
if (!(f = fopen(filename, "w")))
|
||||||
die_errno("Could not open '%s'", filename);
|
die_errno("Could not open '%s'", filename);
|
||||||
if (obj->type == OBJ_BLOB) {
|
if (obj->type == OBJ_BLOB) {
|
||||||
if (stream_blob_to_fd(fileno(f), get_object_hash(*obj), NULL, 1))
|
if (stream_blob_to_fd(fileno(f), obj->oid.hash, NULL, 1))
|
||||||
die_errno("Could not write '%s'", filename);
|
die_errno("Could not write '%s'", filename);
|
||||||
} else
|
} else
|
||||||
fprintf(f, "%s\n", oid_to_hex(&obj->oid));
|
fprintf(f, "%s\n", oid_to_hex(&obj->oid));
|
||||||
|
@ -459,7 +459,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
|
|||||||
struct object *obj, const char *name, const char *path)
|
struct object *obj, const char *name, const char *path)
|
||||||
{
|
{
|
||||||
if (obj->type == OBJ_BLOB)
|
if (obj->type == OBJ_BLOB)
|
||||||
return grep_sha1(opt, get_object_hash(*obj), name, 0, path);
|
return grep_sha1(opt, obj->oid.hash, name, 0, path);
|
||||||
if (obj->type == OBJ_COMMIT || obj->type == OBJ_TREE) {
|
if (obj->type == OBJ_COMMIT || obj->type == OBJ_TREE) {
|
||||||
struct tree_desc tree;
|
struct tree_desc tree;
|
||||||
void *data;
|
void *data;
|
||||||
|
@ -217,7 +217,7 @@ static unsigned check_object(struct object *obj)
|
|||||||
|
|
||||||
if (!(obj->flags & FLAG_CHECKED)) {
|
if (!(obj->flags & FLAG_CHECKED)) {
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
int type = sha1_object_info(get_object_hash(*obj), &size);
|
int type = sha1_object_info(obj->oid.hash, &size);
|
||||||
if (type <= 0)
|
if (type <= 0)
|
||||||
die(_("did not receive expected object %s"),
|
die(_("did not receive expected object %s"),
|
||||||
oid_to_hex(&obj->oid));
|
oid_to_hex(&obj->oid));
|
||||||
|
@ -552,7 +552,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
|||||||
const char *name = objects[i].name;
|
const char *name = objects[i].name;
|
||||||
switch (o->type) {
|
switch (o->type) {
|
||||||
case OBJ_BLOB:
|
case OBJ_BLOB:
|
||||||
ret = show_blob_object(get_object_hash(*o), &rev, name);
|
ret = show_blob_object(o->oid.hash, &rev, name);
|
||||||
break;
|
break;
|
||||||
case OBJ_TAG: {
|
case OBJ_TAG: {
|
||||||
struct tag *t = (struct tag *)o;
|
struct tag *t = (struct tag *)o;
|
||||||
@ -563,11 +563,11 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
|||||||
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
|
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
|
||||||
t->tag,
|
t->tag,
|
||||||
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
|
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
|
||||||
ret = show_tag_object(get_object_hash(*o), &rev);
|
ret = show_tag_object(o->oid.hash, &rev);
|
||||||
rev.shown_one = 1;
|
rev.shown_one = 1;
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
o = parse_object(get_object_hash(*t->tagged));
|
o = parse_object(t->tagged->oid.hash);
|
||||||
if (!o)
|
if (!o)
|
||||||
ret = error(_("Could not read object %s"),
|
ret = error(_("Could not read object %s"),
|
||||||
oid_to_hex(&t->tagged->oid));
|
oid_to_hex(&t->tagged->oid));
|
||||||
@ -830,8 +830,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
|
|||||||
o2 = rev->pending.objects[1].item;
|
o2 = rev->pending.objects[1].item;
|
||||||
flags1 = o1->flags;
|
flags1 = o1->flags;
|
||||||
flags2 = o2->flags;
|
flags2 = o2->flags;
|
||||||
c1 = lookup_commit_reference(get_object_hash(*o1));
|
c1 = lookup_commit_reference(o1->oid.hash);
|
||||||
c2 = lookup_commit_reference(get_object_hash(*o2));
|
c2 = lookup_commit_reference(o2->oid.hash);
|
||||||
|
|
||||||
if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
|
if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
|
||||||
die(_("Not a range."));
|
die(_("Not a range."));
|
||||||
@ -993,8 +993,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
|
|||||||
|
|
||||||
diff_setup_done(&opts);
|
diff_setup_done(&opts);
|
||||||
|
|
||||||
diff_tree_sha1(get_object_hash(origin->tree->object),
|
diff_tree_sha1(origin->tree->object.oid.hash,
|
||||||
get_object_hash(head->tree->object),
|
head->tree->object.oid.hash,
|
||||||
"", &opts);
|
"", &opts);
|
||||||
diffcore_std(&opts);
|
diffcore_std(&opts);
|
||||||
diff_flush(&opts);
|
diff_flush(&opts);
|
||||||
@ -1612,12 +1612,12 @@ static void print_commit(char sign, struct commit *commit, int verbose,
|
|||||||
{
|
{
|
||||||
if (!verbose) {
|
if (!verbose) {
|
||||||
printf("%c %s\n", sign,
|
printf("%c %s\n", sign,
|
||||||
find_unique_abbrev(get_object_hash(commit->object), abbrev));
|
find_unique_abbrev(commit->object.oid.hash, abbrev));
|
||||||
} else {
|
} else {
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
|
pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
|
||||||
printf("%c %s %s\n", sign,
|
printf("%c %s %s\n", sign,
|
||||||
find_unique_abbrev(get_object_hash(commit->object), abbrev),
|
find_unique_abbrev(commit->object.oid.hash, abbrev),
|
||||||
buf.buf);
|
buf.buf);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
|
|||||||
const char *path = entry->path;
|
const char *path = entry->path;
|
||||||
|
|
||||||
if (!entry->stage)
|
if (!entry->stage)
|
||||||
return read_sha1_file(get_object_hash(entry->blob->object), &type, size);
|
return read_sha1_file(entry->blob->object.oid.hash, &type, size);
|
||||||
base = NULL;
|
base = NULL;
|
||||||
if (entry->stage == 1) {
|
if (entry->stage == 1) {
|
||||||
base = entry->blob;
|
base = entry->blob;
|
||||||
@ -82,7 +82,7 @@ static void *origin(struct merge_list *entry, unsigned long *size)
|
|||||||
enum object_type type;
|
enum object_type type;
|
||||||
while (entry) {
|
while (entry) {
|
||||||
if (entry->stage == 2)
|
if (entry->stage == 2)
|
||||||
return read_sha1_file(get_object_hash(entry->blob->object), &type, size);
|
return read_sha1_file(entry->blob->object.oid.hash, &type, size);
|
||||||
entry = entry->link;
|
entry = entry->link;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -380,7 +380,7 @@ static void finish(struct commit *head_commit,
|
|||||||
const unsigned char *new_head, const char *msg)
|
const unsigned char *new_head, const char *msg)
|
||||||
{
|
{
|
||||||
struct strbuf reflog_message = STRBUF_INIT;
|
struct strbuf reflog_message = STRBUF_INIT;
|
||||||
const unsigned char *head = get_object_hash(head_commit->object);
|
const unsigned char *head = head_commit->object.oid.hash;
|
||||||
|
|
||||||
if (!msg)
|
if (!msg)
|
||||||
strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
|
strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
|
||||||
@ -497,7 +497,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
|
|||||||
if (ref_exists(truname.buf)) {
|
if (ref_exists(truname.buf)) {
|
||||||
strbuf_addf(msg,
|
strbuf_addf(msg,
|
||||||
"%s\t\tbranch '%s'%s of .\n",
|
"%s\t\tbranch '%s'%s of .\n",
|
||||||
sha1_to_hex(get_object_hash(remote_head->object)),
|
sha1_to_hex(remote_head->object.oid.hash),
|
||||||
truname.buf + 11,
|
truname.buf + 11,
|
||||||
(early ? " (early part)" : ""));
|
(early ? " (early part)" : ""));
|
||||||
strbuf_release(&truname);
|
strbuf_release(&truname);
|
||||||
@ -511,7 +511,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
|
|||||||
desc = merge_remote_util(remote_head);
|
desc = merge_remote_util(remote_head);
|
||||||
if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
|
if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
|
||||||
strbuf_addf(msg, "%s\t\t%s '%s'\n",
|
strbuf_addf(msg, "%s\t\t%s '%s'\n",
|
||||||
sha1_to_hex(get_object_hash(*desc->obj)),
|
sha1_to_hex(desc->obj->oid.hash),
|
||||||
typename(desc->obj->type),
|
typename(desc->obj->type),
|
||||||
remote);
|
remote);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -519,7 +519,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addf(msg, "%s\t\tcommit '%s'\n",
|
strbuf_addf(msg, "%s\t\tcommit '%s'\n",
|
||||||
sha1_to_hex(get_object_hash(remote_head->object)), remote);
|
sha1_to_hex(remote_head->object.oid.hash), remote);
|
||||||
cleanup:
|
cleanup:
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
strbuf_release(&bname);
|
strbuf_release(&bname);
|
||||||
@ -892,7 +892,7 @@ static struct commit *is_old_style_invocation(int argc, const char **argv,
|
|||||||
second_token = lookup_commit_reference_gently(second_sha1, 0);
|
second_token = lookup_commit_reference_gently(second_sha1, 0);
|
||||||
if (!second_token)
|
if (!second_token)
|
||||||
die(_("'%s' is not a commit"), argv[1]);
|
die(_("'%s' is not a commit"), argv[1]);
|
||||||
if (hashcmp(get_object_hash(second_token->object), head))
|
if (hashcmp(second_token->object.oid.hash, head))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return second_token;
|
return second_token;
|
||||||
@ -1274,8 +1274,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
die(_("%s - not something we can merge"), argv[0]);
|
die(_("%s - not something we can merge"), argv[0]);
|
||||||
if (remoteheads->next)
|
if (remoteheads->next)
|
||||||
die(_("Can merge only exactly one commit into empty head"));
|
die(_("Can merge only exactly one commit into empty head"));
|
||||||
read_empty(get_object_hash(remote_head->object), 0);
|
read_empty(remote_head->object.oid.hash, 0);
|
||||||
update_ref("initial pull", "HEAD", get_object_hash(remote_head->object),
|
update_ref("initial pull", "HEAD", remote_head->object.oid.hash,
|
||||||
NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -1289,7 +1289,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
* additional safety measure to check for it.
|
* additional safety measure to check for it.
|
||||||
*/
|
*/
|
||||||
if (!have_message &&
|
if (!have_message &&
|
||||||
is_old_style_invocation(argc, argv, get_object_hash(head_commit->object))) {
|
is_old_style_invocation(argc, argv, head_commit->object.oid.hash)) {
|
||||||
warning("old-style 'git merge <msg> HEAD <commit>' is deprecated.");
|
warning("old-style 'git merge <msg> HEAD <commit>' is deprecated.");
|
||||||
strbuf_addstr(&merge_msg, argv[0]);
|
strbuf_addstr(&merge_msg, argv[0]);
|
||||||
head_arg = argv[1];
|
head_arg = argv[1];
|
||||||
@ -1323,7 +1323,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
check_commit_signature(commit, &signature_check);
|
check_commit_signature(commit, &signature_check);
|
||||||
|
|
||||||
find_unique_abbrev_r(hex, get_object_hash(commit->object), DEFAULT_ABBREV);
|
find_unique_abbrev_r(hex, commit->object.oid.hash, DEFAULT_ABBREV);
|
||||||
switch (signature_check.result) {
|
switch (signature_check.result) {
|
||||||
case 'G':
|
case 'G':
|
||||||
break;
|
break;
|
||||||
@ -1353,7 +1353,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
for (p = remoteheads; p; p = p->next) {
|
for (p = remoteheads; p; p = p->next) {
|
||||||
struct commit *commit = p->item;
|
struct commit *commit = p->item;
|
||||||
strbuf_addf(&buf, "GITHEAD_%s",
|
strbuf_addf(&buf, "GITHEAD_%s",
|
||||||
sha1_to_hex(get_object_hash(commit->object)));
|
sha1_to_hex(commit->object.oid.hash));
|
||||||
setenv(buf.buf, merge_remote_util(commit)->name, 1);
|
setenv(buf.buf, merge_remote_util(commit)->name, 1);
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
if (fast_forward != FF_ONLY &&
|
if (fast_forward != FF_ONLY &&
|
||||||
@ -1393,7 +1393,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
free(list);
|
free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_ref("updating ORIG_HEAD", "ORIG_HEAD", get_object_hash(head_commit->object),
|
update_ref("updating ORIG_HEAD", "ORIG_HEAD", head_commit->object.oid.hash,
|
||||||
NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
||||||
|
|
||||||
if (remoteheads && !common)
|
if (remoteheads && !common)
|
||||||
@ -1409,16 +1409,16 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
goto done;
|
goto done;
|
||||||
} else if (fast_forward != FF_NO && !remoteheads->next &&
|
} else if (fast_forward != FF_NO && !remoteheads->next &&
|
||||||
!common->next &&
|
!common->next &&
|
||||||
!hashcmp(get_object_hash(common->item->object), get_object_hash(head_commit->object))) {
|
!hashcmp(common->item->object.oid.hash, head_commit->object.oid.hash)) {
|
||||||
/* Again the most common case of merging one remote. */
|
/* Again the most common case of merging one remote. */
|
||||||
struct strbuf msg = STRBUF_INIT;
|
struct strbuf msg = STRBUF_INIT;
|
||||||
struct commit *commit;
|
struct commit *commit;
|
||||||
|
|
||||||
if (verbosity >= 0) {
|
if (verbosity >= 0) {
|
||||||
char from[GIT_SHA1_HEXSZ + 1], to[GIT_SHA1_HEXSZ + 1];
|
char from[GIT_SHA1_HEXSZ + 1], to[GIT_SHA1_HEXSZ + 1];
|
||||||
find_unique_abbrev_r(from, get_object_hash(head_commit->object),
|
find_unique_abbrev_r(from, head_commit->object.oid.hash,
|
||||||
DEFAULT_ABBREV);
|
DEFAULT_ABBREV);
|
||||||
find_unique_abbrev_r(to, get_object_hash(remoteheads->item->object),
|
find_unique_abbrev_r(to, remoteheads->item->object.oid.hash,
|
||||||
DEFAULT_ABBREV);
|
DEFAULT_ABBREV);
|
||||||
printf(_("Updating %s..%s\n"), from, to);
|
printf(_("Updating %s..%s\n"), from, to);
|
||||||
}
|
}
|
||||||
@ -1432,14 +1432,14 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkout_fast_forward(get_object_hash(head_commit->object),
|
if (checkout_fast_forward(head_commit->object.oid.hash,
|
||||||
get_object_hash(commit->object),
|
commit->object.oid.hash,
|
||||||
overwrite_ignore)) {
|
overwrite_ignore)) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
finish(head_commit, remoteheads, get_object_hash(commit->object), msg.buf);
|
finish(head_commit, remoteheads, commit->object.oid.hash, msg.buf);
|
||||||
drop_save();
|
drop_save();
|
||||||
goto done;
|
goto done;
|
||||||
} else if (!remoteheads->next && common->next)
|
} else if (!remoteheads->next && common->next)
|
||||||
@ -1458,9 +1458,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
/* See if it is really trivial. */
|
/* See if it is really trivial. */
|
||||||
git_committer_info(IDENT_STRICT);
|
git_committer_info(IDENT_STRICT);
|
||||||
printf(_("Trying really trivial in-index merge...\n"));
|
printf(_("Trying really trivial in-index merge...\n"));
|
||||||
if (!read_tree_trivial(get_object_hash(common->item->object),
|
if (!read_tree_trivial(common->item->object.oid.hash,
|
||||||
get_object_hash(head_commit->object),
|
head_commit->object.oid.hash,
|
||||||
get_object_hash(remoteheads->item->object))) {
|
remoteheads->item->object.oid.hash)) {
|
||||||
ret = merge_trivial(head_commit, remoteheads);
|
ret = merge_trivial(head_commit, remoteheads);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -1483,8 +1483,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
* HEAD^^" would be missed.
|
* HEAD^^" would be missed.
|
||||||
*/
|
*/
|
||||||
common_one = get_merge_bases(head_commit, j->item);
|
common_one = get_merge_bases(head_commit, j->item);
|
||||||
if (hashcmp(get_object_hash(common_one->item->object),
|
if (hashcmp(common_one->item->object.oid.hash,
|
||||||
get_object_hash(j->item->object))) {
|
j->item->object.oid.hash)) {
|
||||||
up_to_date = 0;
|
up_to_date = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1520,7 +1520,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
int ret;
|
int ret;
|
||||||
if (i) {
|
if (i) {
|
||||||
printf(_("Rewinding the tree to pristine...\n"));
|
printf(_("Rewinding the tree to pristine...\n"));
|
||||||
restore_state(get_object_hash(head_commit->object), stash);
|
restore_state(head_commit->object.oid.hash, stash);
|
||||||
}
|
}
|
||||||
if (use_strategies_nr != 1)
|
if (use_strategies_nr != 1)
|
||||||
printf(_("Trying merge strategy %s...\n"),
|
printf(_("Trying merge strategy %s...\n"),
|
||||||
@ -1586,7 +1586,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
* it up.
|
* it up.
|
||||||
*/
|
*/
|
||||||
if (!best_strategy) {
|
if (!best_strategy) {
|
||||||
restore_state(get_object_hash(head_commit->object), stash);
|
restore_state(head_commit->object.oid.hash, stash);
|
||||||
if (use_strategies_nr > 1)
|
if (use_strategies_nr > 1)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("No merge strategy handled the merge.\n"));
|
_("No merge strategy handled the merge.\n"));
|
||||||
@ -1599,7 +1599,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
; /* We already have its result in the working tree. */
|
; /* We already have its result in the working tree. */
|
||||||
else {
|
else {
|
||||||
printf(_("Rewinding the tree to pristine...\n"));
|
printf(_("Rewinding the tree to pristine...\n"));
|
||||||
restore_state(get_object_hash(head_commit->object), stash);
|
restore_state(head_commit->object.oid.hash, stash);
|
||||||
printf(_("Using the %s to prepare resolving by hand.\n"),
|
printf(_("Using the %s to prepare resolving by hand.\n"),
|
||||||
best_strategy);
|
best_strategy);
|
||||||
try_merge_strategy(best_strategy, common, remoteheads,
|
try_merge_strategy(best_strategy, common, remoteheads,
|
||||||
|
@ -162,7 +162,7 @@ static int name_ref(const char *path, const struct object_id *oid, int flags, vo
|
|||||||
struct tag *t = (struct tag *) o;
|
struct tag *t = (struct tag *) o;
|
||||||
if (!t->tagged)
|
if (!t->tagged)
|
||||||
break; /* broken repository */
|
break; /* broken repository */
|
||||||
o = parse_object(get_object_hash(*t->tagged));
|
o = parse_object(t->tagged->oid.hash);
|
||||||
deref = 1;
|
deref = 1;
|
||||||
}
|
}
|
||||||
if (o && o->type == OBJ_COMMIT) {
|
if (o && o->type == OBJ_COMMIT) {
|
||||||
@ -193,7 +193,7 @@ static const char *get_exact_ref_match(const struct object *o)
|
|||||||
tip_table.sorted = 1;
|
tip_table.sorted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
found = sha1_pos(get_object_hash(*o), tip_table.table, tip_table.nr,
|
found = sha1_pos(o->oid.hash, tip_table.table, tip_table.nr,
|
||||||
nth_tip_table_ent);
|
nth_tip_table_ent);
|
||||||
if (0 <= found)
|
if (0 <= found)
|
||||||
return tip_table.table[found].refname;
|
return tip_table.table[found].refname;
|
||||||
|
@ -707,7 +707,7 @@ static int merge_commit(struct notes_merge_options *o)
|
|||||||
die("Could not parse commit from NOTES_MERGE_PARTIAL.");
|
die("Could not parse commit from NOTES_MERGE_PARTIAL.");
|
||||||
|
|
||||||
if (partial->parents)
|
if (partial->parents)
|
||||||
hashcpy(parent_sha1, get_object_hash(partial->parents->item->object));
|
hashcpy(parent_sha1, partial->parents->item->object.oid.hash);
|
||||||
else
|
else
|
||||||
hashclr(parent_sha1);
|
hashclr(parent_sha1);
|
||||||
|
|
||||||
|
@ -2277,7 +2277,7 @@ static void read_object_list_from_stdin(void)
|
|||||||
|
|
||||||
static void show_commit(struct commit *commit, void *data)
|
static void show_commit(struct commit *commit, void *data)
|
||||||
{
|
{
|
||||||
add_object_entry(get_object_hash(commit->object), OBJ_COMMIT, NULL, 0);
|
add_object_entry(commit->object.oid.hash, OBJ_COMMIT, NULL, 0);
|
||||||
commit->object.flags |= OBJECT_ADDED;
|
commit->object.flags |= OBJECT_ADDED;
|
||||||
|
|
||||||
if (write_bitmap_index)
|
if (write_bitmap_index)
|
||||||
@ -2291,7 +2291,7 @@ static void show_object(struct object *obj,
|
|||||||
char *name = path_name(path, last);
|
char *name = path_name(path, last);
|
||||||
|
|
||||||
add_preferred_base_object(name);
|
add_preferred_base_object(name);
|
||||||
add_object_entry(get_object_hash(*obj), obj->type, name, 0);
|
add_object_entry(obj->oid.hash, obj->type, name, 0);
|
||||||
obj->flags |= OBJECT_ADDED;
|
obj->flags |= OBJECT_ADDED;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2303,7 +2303,7 @@ static void show_object(struct object *obj,
|
|||||||
|
|
||||||
static void show_edge(struct commit *commit)
|
static void show_edge(struct commit *commit)
|
||||||
{
|
{
|
||||||
add_preferred_base(get_object_hash(commit->object));
|
add_preferred_base(commit->object.oid.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct in_pack_object {
|
struct in_pack_object {
|
||||||
@ -2319,7 +2319,7 @@ struct in_pack {
|
|||||||
|
|
||||||
static void mark_in_pack_object(struct object *object, struct packed_git *p, struct in_pack *in_pack)
|
static void mark_in_pack_object(struct object *object, struct packed_git *p, struct in_pack *in_pack)
|
||||||
{
|
{
|
||||||
in_pack->array[in_pack->nr].offset = find_pack_entry_one(get_object_hash(*object), p);
|
in_pack->array[in_pack->nr].offset = find_pack_entry_one(object->oid.hash, p);
|
||||||
in_pack->array[in_pack->nr].object = object;
|
in_pack->array[in_pack->nr].object = object;
|
||||||
in_pack->nr++;
|
in_pack->nr++;
|
||||||
}
|
}
|
||||||
@ -2376,7 +2376,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
|
|||||||
ofscmp);
|
ofscmp);
|
||||||
for (i = 0; i < in_pack.nr; i++) {
|
for (i = 0; i < in_pack.nr; i++) {
|
||||||
struct object *o = in_pack.array[i].object;
|
struct object *o = in_pack.array[i].object;
|
||||||
add_object_entry(get_object_hash(*o), o->type, "", 0);
|
add_object_entry(o->oid.hash, o->type, "", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(in_pack.array);
|
free(in_pack.array);
|
||||||
@ -2484,12 +2484,12 @@ static void record_recent_object(struct object *obj,
|
|||||||
const char *last,
|
const char *last,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
sha1_array_append(&recent_objects, get_object_hash(*obj));
|
sha1_array_append(&recent_objects, obj->oid.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void record_recent_commit(struct commit *commit, void *data)
|
static void record_recent_commit(struct commit *commit, void *data)
|
||||||
{
|
{
|
||||||
sha1_array_append(&recent_objects, get_object_hash(commit->object));
|
sha1_array_append(&recent_objects, commit->object.oid.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_object_list(int ac, const char **av)
|
static void get_object_list(int ac, const char **av)
|
||||||
|
@ -743,7 +743,7 @@ static int get_octopus_merge_base(unsigned char *merge_base,
|
|||||||
if (!result)
|
if (!result)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
hashcpy(merge_base, get_object_hash(result->item->object));
|
hashcpy(merge_base, result->item->object.oid.hash);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ static int commit_is_complete(struct commit *commit)
|
|||||||
struct commit_list *parent;
|
struct commit_list *parent;
|
||||||
|
|
||||||
c = (struct commit *)study.objects[--study.nr].item;
|
c = (struct commit *)study.objects[--study.nr].item;
|
||||||
if (!c->object.parsed && !parse_object(get_object_hash(c->object)))
|
if (!c->object.parsed && !parse_object(c->object.oid.hash))
|
||||||
c->object.flags |= INCOMPLETE;
|
c->object.flags |= INCOMPLETE;
|
||||||
|
|
||||||
if (c->object.flags & INCOMPLETE) {
|
if (c->object.flags & INCOMPLETE) {
|
||||||
@ -152,7 +152,7 @@ static int commit_is_complete(struct commit *commit)
|
|||||||
for (i = 0; i < found.nr; i++) {
|
for (i = 0; i < found.nr; i++) {
|
||||||
struct commit *c =
|
struct commit *c =
|
||||||
(struct commit *)found.objects[i].item;
|
(struct commit *)found.objects[i].item;
|
||||||
if (!tree_is_complete(get_object_hash(c->tree->object))) {
|
if (!tree_is_complete(c->tree->object.oid.hash)) {
|
||||||
is_incomplete = 1;
|
is_incomplete = 1;
|
||||||
c->object.flags |= INCOMPLETE;
|
c->object.flags |= INCOMPLETE;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ static void print_new_head_line(struct commit *commit)
|
|||||||
const char *hex, *body;
|
const char *hex, *body;
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
|
||||||
hex = find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV);
|
hex = find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV);
|
||||||
printf(_("HEAD is now at %s"), hex);
|
printf(_("HEAD is now at %s"), hex);
|
||||||
msg = logmsg_reencode(commit, NULL, get_log_output_encoding());
|
msg = logmsg_reencode(commit, NULL, get_log_output_encoding());
|
||||||
body = strstr(msg, "\n\n");
|
body = strstr(msg, "\n\n");
|
||||||
|
@ -81,7 +81,7 @@ static void show_commit(struct commit *commit, void *data)
|
|||||||
if (!revs->graph)
|
if (!revs->graph)
|
||||||
fputs(get_revision_mark(revs, commit), stdout);
|
fputs(get_revision_mark(revs, commit), stdout);
|
||||||
if (revs->abbrev_commit && revs->abbrev)
|
if (revs->abbrev_commit && revs->abbrev)
|
||||||
fputs(find_unique_abbrev(get_object_hash(commit->object), revs->abbrev),
|
fputs(find_unique_abbrev(commit->object.oid.hash, revs->abbrev),
|
||||||
stdout);
|
stdout);
|
||||||
else
|
else
|
||||||
fputs(oid_to_hex(&commit->object.oid), stdout);
|
fputs(oid_to_hex(&commit->object.oid), stdout);
|
||||||
@ -185,7 +185,7 @@ static void finish_object(struct object *obj,
|
|||||||
if (obj->type == OBJ_BLOB && !has_object_file(&obj->oid))
|
if (obj->type == OBJ_BLOB && !has_object_file(&obj->oid))
|
||||||
die("missing blob object '%s'", oid_to_hex(&obj->oid));
|
die("missing blob object '%s'", oid_to_hex(&obj->oid));
|
||||||
if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
|
if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
|
||||||
parse_object(get_object_hash(*obj));
|
parse_object(obj->oid.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_object(struct object *obj,
|
static void show_object(struct object *obj,
|
||||||
|
@ -282,7 +282,7 @@ static int try_difference(const char *arg)
|
|||||||
exclude = get_merge_bases(a, b);
|
exclude = get_merge_bases(a, b);
|
||||||
while (exclude) {
|
while (exclude) {
|
||||||
struct commit *commit = pop_commit(&exclude);
|
struct commit *commit = pop_commit(&exclude);
|
||||||
show_rev(REVERSED, get_object_hash(commit->object), NULL);
|
show_rev(REVERSED, commit->object.oid.hash, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*dotdot = '.';
|
*dotdot = '.';
|
||||||
@ -319,7 +319,7 @@ static int try_parent_shorthands(const char *arg)
|
|||||||
commit = lookup_commit_reference(sha1);
|
commit = lookup_commit_reference(sha1);
|
||||||
for (parents = commit->parents; parents; parents = parents->next)
|
for (parents = commit->parents; parents; parents = parents->next)
|
||||||
show_rev(parents_only ? NORMAL : REVERSED,
|
show_rev(parents_only ? NORMAL : REVERSED,
|
||||||
get_object_hash(parents->item->object), arg);
|
parents->item->object.oid.hash, arg);
|
||||||
|
|
||||||
*dotdot = '^';
|
*dotdot = '^';
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -291,7 +291,7 @@ static void show_one_commit(struct commit *commit, int no_name)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("[%s] ",
|
printf("[%s] ",
|
||||||
find_unique_abbrev(get_object_hash(commit->object),
|
find_unique_abbrev(commit->object.oid.hash,
|
||||||
DEFAULT_ABBREV));
|
DEFAULT_ABBREV));
|
||||||
}
|
}
|
||||||
puts(pretty_str);
|
puts(pretty_str);
|
||||||
@ -867,7 +867,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
|
|||||||
head_len,
|
head_len,
|
||||||
ref_name[i],
|
ref_name[i],
|
||||||
head_oid.hash,
|
head_oid.hash,
|
||||||
get_object_hash(rev[i]->object));
|
rev[i]->object.oid.hash);
|
||||||
if (extra < 0)
|
if (extra < 0)
|
||||||
printf("%c [%s] ",
|
printf("%c [%s] ",
|
||||||
is_head ? '*' : ' ', ref_name[i]);
|
is_head ? '*' : ' ', ref_name[i]);
|
||||||
|
@ -194,7 +194,7 @@ static int check_object(struct object *obj, int type, void *data, struct fsck_op
|
|||||||
|
|
||||||
if (!(obj->flags & FLAG_OPEN)) {
|
if (!(obj->flags & FLAG_OPEN)) {
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
int type = sha1_object_info(get_object_hash(*obj), &size);
|
int type = sha1_object_info(obj->oid.hash, &size);
|
||||||
if (type != obj->type || type <= 0)
|
if (type != obj->type || type <= 0)
|
||||||
die("object of unexpected type");
|
die("object of unexpected type");
|
||||||
obj->flags |= FLAG_WRITTEN;
|
obj->flags |= FLAG_WRITTEN;
|
||||||
|
2
bundle.c
2
bundle.c
@ -217,7 +217,7 @@ static int is_tag_in_date_range(struct object *tag, struct rev_info *revs)
|
|||||||
if (revs->max_age == -1 && revs->min_age == -1)
|
if (revs->max_age == -1 && revs->min_age == -1)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
buf = read_sha1_file(get_object_hash(*tag), &type, &size);
|
buf = read_sha1_file(tag->oid.hash, &type, &size);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
goto out;
|
goto out;
|
||||||
line = memmem(buf, size, "\ntagger ", 8);
|
line = memmem(buf, size, "\ntagger ", 8);
|
||||||
|
@ -657,7 +657,7 @@ static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
|
|||||||
struct name_entry entry;
|
struct name_entry entry;
|
||||||
int cnt;
|
int cnt;
|
||||||
|
|
||||||
hashcpy(it->sha1, get_object_hash(tree->object));
|
hashcpy(it->sha1, tree->object.oid.hash);
|
||||||
init_tree_desc(&desc, tree->buffer, tree->size);
|
init_tree_desc(&desc, tree->buffer, tree->size);
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
while (tree_entry(&desc, &entry)) {
|
while (tree_entry(&desc, &entry)) {
|
||||||
|
@ -1540,9 +1540,9 @@ void diff_tree_combined_merge(const struct commit *commit, int dense,
|
|||||||
struct sha1_array parents = SHA1_ARRAY_INIT;
|
struct sha1_array parents = SHA1_ARRAY_INIT;
|
||||||
|
|
||||||
while (parent) {
|
while (parent) {
|
||||||
sha1_array_append(&parents, get_object_hash(parent->item->object));
|
sha1_array_append(&parents, parent->item->object.oid.hash);
|
||||||
parent = parent->next;
|
parent = parent->next;
|
||||||
}
|
}
|
||||||
diff_tree_combined(get_object_hash(commit->object), &parents, dense, rev);
|
diff_tree_combined(commit->object.oid.hash, &parents, dense, rev);
|
||||||
sha1_array_clear(&parents);
|
sha1_array_clear(&parents);
|
||||||
}
|
}
|
||||||
|
12
commit.c
12
commit.c
@ -38,7 +38,7 @@ struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_n
|
|||||||
struct commit *c = lookup_commit_reference(sha1);
|
struct commit *c = lookup_commit_reference(sha1);
|
||||||
if (!c)
|
if (!c)
|
||||||
die(_("could not parse %s"), ref_name);
|
die(_("could not parse %s"), ref_name);
|
||||||
if (hashcmp(sha1, get_object_hash(c->object))) {
|
if (hashcmp(sha1, c->object.oid.hash)) {
|
||||||
warning(_("%s %s is not a commit!"),
|
warning(_("%s %s is not a commit!"),
|
||||||
ref_name, sha1_to_hex(sha1));
|
ref_name, sha1_to_hex(sha1));
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
ret = read_sha1_file(get_object_hash(commit->object), &type, &size);
|
ret = read_sha1_file(commit->object.oid.hash, &type, &size);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
die("cannot read commit object %s",
|
die("cannot read commit object %s",
|
||||||
oid_to_hex(&commit->object.oid));
|
oid_to_hex(&commit->object.oid));
|
||||||
@ -335,7 +335,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
|
|||||||
bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
|
bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
|
||||||
pptr = &item->parents;
|
pptr = &item->parents;
|
||||||
|
|
||||||
graft = lookup_commit_graft(get_object_hash(item->object));
|
graft = lookup_commit_graft(item->object.oid.hash);
|
||||||
while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
|
while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
|
||||||
struct commit *new_parent;
|
struct commit *new_parent;
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ int parse_commit_gently(struct commit *item, int quiet_on_missing)
|
|||||||
return -1;
|
return -1;
|
||||||
if (item->object.parsed)
|
if (item->object.parsed)
|
||||||
return 0;
|
return 0;
|
||||||
buffer = read_sha1_file(get_object_hash(item->object), &type, &size);
|
buffer = read_sha1_file(item->object.oid.hash, &type, &size);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return quiet_on_missing ? -1 :
|
return quiet_on_missing ? -1 :
|
||||||
error("Could not read %s",
|
error("Could not read %s",
|
||||||
@ -563,7 +563,7 @@ void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark)
|
|||||||
|
|
||||||
for (i = 0; i < a->nr; i++) {
|
for (i = 0; i < a->nr; i++) {
|
||||||
object = a->objects[i].item;
|
object = a->objects[i].item;
|
||||||
commit = lookup_commit_reference_gently(get_object_hash(*object), 1);
|
commit = lookup_commit_reference_gently(object->oid.hash, 1);
|
||||||
if (commit)
|
if (commit)
|
||||||
clear_commit_marks(commit, mark);
|
clear_commit_marks(commit, mark);
|
||||||
}
|
}
|
||||||
@ -1206,7 +1206,7 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
|
|||||||
desc = merge_remote_util(parent);
|
desc = merge_remote_util(parent);
|
||||||
if (!desc || !desc->obj)
|
if (!desc || !desc->obj)
|
||||||
return;
|
return;
|
||||||
buf = read_sha1_file(get_object_hash(*desc->obj), &type, &size);
|
buf = read_sha1_file(desc->obj->oid.hash, &type, &size);
|
||||||
if (!buf || type != OBJ_TAG)
|
if (!buf || type != OBJ_TAG)
|
||||||
goto free_return;
|
goto free_return;
|
||||||
len = parse_signature(buf, size);
|
len = parse_signature(buf, size);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
static unsigned int hash_obj(const struct object *obj, unsigned int n)
|
static unsigned int hash_obj(const struct object *obj, unsigned int n)
|
||||||
{
|
{
|
||||||
return sha1hash(get_object_hash(*obj)) % n;
|
return sha1hash(obj->oid.hash) % n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *insert_decoration(struct decoration *n, const struct object *base, void *decoration)
|
static void *insert_decoration(struct decoration *n, const struct object *base, void *decoration)
|
||||||
|
@ -493,7 +493,7 @@ int run_diff_index(struct rev_info *revs, int cached)
|
|||||||
struct object_array_entry *ent;
|
struct object_array_entry *ent;
|
||||||
|
|
||||||
ent = revs->pending.objects;
|
ent = revs->pending.objects;
|
||||||
if (diff_cache(revs, get_object_hash(*ent->item), ent->name, cached))
|
if (diff_cache(revs, ent->item->oid.hash, ent->name, cached))
|
||||||
exit(128);
|
exit(128);
|
||||||
|
|
||||||
diff_set_mnemonic_prefix(&revs->diffopt, "c/", cached ? "i/" : "w/");
|
diff_set_mnemonic_prefix(&revs->diffopt, "c/", cached ? "i/" : "w/");
|
||||||
|
@ -169,7 +169,7 @@ static const unsigned char *get_rev(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_object_hash(commit->object);
|
return commit->object.oid.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ack_type {
|
enum ack_type {
|
||||||
@ -487,7 +487,7 @@ static int mark_complete(const unsigned char *sha1)
|
|||||||
if (!t->tagged)
|
if (!t->tagged)
|
||||||
break; /* broken repository */
|
break; /* broken repository */
|
||||||
o->flags |= COMPLETE;
|
o->flags |= COMPLETE;
|
||||||
o = parse_object(get_object_hash(*t->tagged));
|
o = parse_object(t->tagged->oid.hash);
|
||||||
}
|
}
|
||||||
if (o && o->type == OBJ_COMMIT) {
|
if (o && o->type == OBJ_COMMIT) {
|
||||||
struct commit *commit = (struct commit *)o;
|
struct commit *commit = (struct commit *)o;
|
||||||
|
6
fsck.c
6
fsck.c
@ -276,7 +276,7 @@ static int report(struct fsck_options *options, struct object *object,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (options->skiplist && object &&
|
if (options->skiplist && object &&
|
||||||
sha1_array_lookup(options->skiplist, get_object_hash(*object)) >= 0)
|
sha1_array_lookup(options->skiplist, object->oid.hash) >= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (msg_type == FSCK_FATAL)
|
if (msg_type == FSCK_FATAL)
|
||||||
@ -630,7 +630,7 @@ static int fsck_commit_buffer(struct commit *commit, const char *buffer,
|
|||||||
buffer += 41;
|
buffer += 41;
|
||||||
parent_line_count++;
|
parent_line_count++;
|
||||||
}
|
}
|
||||||
graft = lookup_commit_graft(get_object_hash(commit->object));
|
graft = lookup_commit_graft(commit->object.oid.hash);
|
||||||
parent_count = commit_list_count(commit->parents);
|
parent_count = commit_list_count(commit->parents);
|
||||||
if (graft) {
|
if (graft) {
|
||||||
if (graft->nr_parent == -1 && !parent_count)
|
if (graft->nr_parent == -1 && !parent_count)
|
||||||
@ -696,7 +696,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
|
|||||||
enum object_type type;
|
enum object_type type;
|
||||||
|
|
||||||
buffer = to_free =
|
buffer = to_free =
|
||||||
read_sha1_file(get_object_hash(tag->object), &type, &size);
|
read_sha1_file(tag->object.oid.hash, &type, &size);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return report(options, &tag->object,
|
return report(options, &tag->object,
|
||||||
FSCK_MSG_MISSING_TAG_OBJECT,
|
FSCK_MSG_MISSING_TAG_OBJECT,
|
||||||
|
20
http-push.c
20
http-push.c
@ -251,7 +251,7 @@ static void start_fetch_loose(struct transfer_request *request)
|
|||||||
struct active_request_slot *slot;
|
struct active_request_slot *slot;
|
||||||
struct http_object_request *obj_req;
|
struct http_object_request *obj_req;
|
||||||
|
|
||||||
obj_req = new_http_object_request(repo->url, get_object_hash(*request->obj));
|
obj_req = new_http_object_request(repo->url, request->obj->oid.hash);
|
||||||
if (obj_req == NULL) {
|
if (obj_req == NULL) {
|
||||||
request->state = ABORTED;
|
request->state = ABORTED;
|
||||||
return;
|
return;
|
||||||
@ -304,7 +304,7 @@ static void start_fetch_packed(struct transfer_request *request)
|
|||||||
struct transfer_request *check_request = request_queue_head;
|
struct transfer_request *check_request = request_queue_head;
|
||||||
struct http_pack_request *preq;
|
struct http_pack_request *preq;
|
||||||
|
|
||||||
target = find_sha1_pack(get_object_hash(*request->obj), repo->packs);
|
target = find_sha1_pack(request->obj->oid.hash, repo->packs);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
fprintf(stderr, "Unable to fetch %s, will not be able to update server info refs\n", oid_to_hex(&request->obj->oid));
|
fprintf(stderr, "Unable to fetch %s, will not be able to update server info refs\n", oid_to_hex(&request->obj->oid));
|
||||||
repo->can_update_info_refs = 0;
|
repo->can_update_info_refs = 0;
|
||||||
@ -361,7 +361,7 @@ static void start_put(struct transfer_request *request)
|
|||||||
ssize_t size;
|
ssize_t size;
|
||||||
git_zstream stream;
|
git_zstream stream;
|
||||||
|
|
||||||
unpacked = read_sha1_file(get_object_hash(*request->obj), &type, &len);
|
unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
|
||||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
|
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
|
||||||
|
|
||||||
/* Set it up */
|
/* Set it up */
|
||||||
@ -533,7 +533,7 @@ static void finish_request(struct transfer_request *request)
|
|||||||
if (request->state == RUN_MKCOL) {
|
if (request->state == RUN_MKCOL) {
|
||||||
if (request->curl_result == CURLE_OK ||
|
if (request->curl_result == CURLE_OK ||
|
||||||
request->http_code == 405) {
|
request->http_code == 405) {
|
||||||
remote_dir_exists[get_object_hash(*request->obj)[0]] = 1;
|
remote_dir_exists[request->obj->oid.hash[0]] = 1;
|
||||||
start_put(request);
|
start_put(request);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "MKCOL %s failed, aborting (%d/%ld)\n",
|
fprintf(stderr, "MKCOL %s failed, aborting (%d/%ld)\n",
|
||||||
@ -614,7 +614,7 @@ static int fill_active_slot(void *unused)
|
|||||||
start_fetch_loose(request);
|
start_fetch_loose(request);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (pushing && request->state == NEED_PUSH) {
|
} else if (pushing && request->state == NEED_PUSH) {
|
||||||
if (remote_dir_exists[get_object_hash(*request->obj)[0]] == 1) {
|
if (remote_dir_exists[request->obj->oid.hash[0]] == 1) {
|
||||||
start_put(request);
|
start_put(request);
|
||||||
} else {
|
} else {
|
||||||
start_mkcol(request);
|
start_mkcol(request);
|
||||||
@ -638,8 +638,8 @@ static void add_fetch_request(struct object *obj)
|
|||||||
* Don't fetch the object if it's known to exist locally
|
* Don't fetch the object if it's known to exist locally
|
||||||
* or is already in the request queue
|
* or is already in the request queue
|
||||||
*/
|
*/
|
||||||
if (remote_dir_exists[get_object_hash(*obj)[0]] == -1)
|
if (remote_dir_exists[obj->oid.hash[0]] == -1)
|
||||||
get_remote_object_list(get_object_hash(*obj)[0]);
|
get_remote_object_list(obj->oid.hash[0]);
|
||||||
if (obj->flags & (LOCAL | FETCHING))
|
if (obj->flags & (LOCAL | FETCHING))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -671,11 +671,11 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
|
|||||||
* Don't push the object if it's known to exist on the remote
|
* Don't push the object if it's known to exist on the remote
|
||||||
* or is already in the request queue
|
* or is already in the request queue
|
||||||
*/
|
*/
|
||||||
if (remote_dir_exists[get_object_hash(*obj)[0]] == -1)
|
if (remote_dir_exists[obj->oid.hash[0]] == -1)
|
||||||
get_remote_object_list(get_object_hash(*obj)[0]);
|
get_remote_object_list(obj->oid.hash[0]);
|
||||||
if (obj->flags & (REMOTE | PUSHING))
|
if (obj->flags & (REMOTE | PUSHING))
|
||||||
return 0;
|
return 0;
|
||||||
target = find_sha1_pack(get_object_hash(*obj), repo->packs);
|
target = find_sha1_pack(obj->oid.hash, repo->packs);
|
||||||
if (target) {
|
if (target) {
|
||||||
obj->flags |= REMOTE;
|
obj->flags |= REMOTE;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -502,7 +502,7 @@ static void fill_blob_sha1(struct commit *commit, struct diff_filespec *spec)
|
|||||||
unsigned mode;
|
unsigned mode;
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
|
|
||||||
if (get_tree_entry(get_object_hash(commit->object), spec->path,
|
if (get_tree_entry(commit->object.oid.hash, spec->path,
|
||||||
sha1, &mode))
|
sha1, &mode))
|
||||||
die("There is no path %s in the commit", spec->path);
|
die("There is no path %s in the commit", spec->path);
|
||||||
fill_filespec(spec, sha1, 1, mode);
|
fill_filespec(spec, sha1, 1, mode);
|
||||||
@ -824,8 +824,8 @@ static void queue_diffs(struct line_log_data *range,
|
|||||||
assert(commit);
|
assert(commit);
|
||||||
|
|
||||||
DIFF_QUEUE_CLEAR(&diff_queued_diff);
|
DIFF_QUEUE_CLEAR(&diff_queued_diff);
|
||||||
diff_tree_sha1(parent ? get_object_hash(parent->tree->object) : NULL,
|
diff_tree_sha1(parent ? parent->tree->object.oid.hash : NULL,
|
||||||
get_object_hash(commit->tree->object), "", opt);
|
commit->tree->object.oid.hash, "", opt);
|
||||||
if (opt->detect_rename) {
|
if (opt->detect_rename) {
|
||||||
filter_diffs_for_paths(range, 1);
|
filter_diffs_for_paths(range, 1);
|
||||||
if (diff_might_be_rename())
|
if (diff_might_be_rename())
|
||||||
|
20
log-tree.c
20
log-tree.c
@ -133,7 +133,7 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,
|
|||||||
if (!obj)
|
if (!obj)
|
||||||
break;
|
break;
|
||||||
if (!obj->parsed)
|
if (!obj->parsed)
|
||||||
parse_object(get_object_hash(*obj));
|
parse_object(obj->oid.hash);
|
||||||
add_name_decoration(DECORATION_REF_TAG, refname, obj);
|
add_name_decoration(DECORATION_REF_TAG, refname, obj);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -165,7 +165,7 @@ static void show_parents(struct commit *commit, int abbrev)
|
|||||||
struct commit_list *p;
|
struct commit_list *p;
|
||||||
for (p = commit->parents; p ; p = p->next) {
|
for (p = commit->parents; p ; p = p->next) {
|
||||||
struct commit *parent = p->item;
|
struct commit *parent = p->item;
|
||||||
printf(" %s", find_unique_abbrev(get_object_hash(parent->object), abbrev));
|
printf(" %s", find_unique_abbrev(parent->object.oid.hash, abbrev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre
|
|||||||
{
|
{
|
||||||
struct commit_list *p = lookup_decoration(&opt->children, &commit->object);
|
struct commit_list *p = lookup_decoration(&opt->children, &commit->object);
|
||||||
for ( ; p; p = p->next) {
|
for ( ; p; p = p->next) {
|
||||||
printf(" %s", find_unique_abbrev(get_object_hash(p->item->object), abbrev));
|
printf(" %s", find_unique_abbrev(p->item->object.oid.hash, abbrev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ static int which_parent(const unsigned char *sha1, const struct commit *commit)
|
|||||||
const struct commit_list *parent;
|
const struct commit_list *parent;
|
||||||
|
|
||||||
for (nth = 0, parent = commit->parents; parent; parent = parent->next) {
|
for (nth = 0, parent = commit->parents; parent; parent = parent->next) {
|
||||||
if (!hashcmp(get_object_hash(parent->item->object), sha1))
|
if (!hashcmp(parent->item->object.oid.hash, sha1))
|
||||||
return nth;
|
return nth;
|
||||||
nth++;
|
nth++;
|
||||||
}
|
}
|
||||||
@ -507,9 +507,9 @@ static void show_one_mergetag(struct commit *commit,
|
|||||||
&commit->parents->next->item->object.oid))
|
&commit->parents->next->item->object.oid))
|
||||||
strbuf_addf(&verify_message,
|
strbuf_addf(&verify_message,
|
||||||
"merged tag '%s'\n", tag->tag);
|
"merged tag '%s'\n", tag->tag);
|
||||||
else if ((nth = which_parent(get_object_hash(*tag->tagged), commit)) < 0)
|
else if ((nth = which_parent(tag->tagged->oid.hash, commit)) < 0)
|
||||||
strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
|
strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
|
||||||
tag->tag, get_object_hash(*tag->tagged));
|
tag->tag, tag->tagged->oid.hash);
|
||||||
else
|
else
|
||||||
strbuf_addf(&verify_message,
|
strbuf_addf(&verify_message,
|
||||||
"parent #%d, tagged '%s'\n", nth + 1, tag->tag);
|
"parent #%d, tagged '%s'\n", nth + 1, tag->tag);
|
||||||
@ -553,7 +553,7 @@ void show_log(struct rev_info *opt)
|
|||||||
|
|
||||||
if (!opt->graph)
|
if (!opt->graph)
|
||||||
put_revision_mark(opt, commit);
|
put_revision_mark(opt, commit);
|
||||||
fputs(find_unique_abbrev(get_object_hash(commit->object), abbrev_commit), stdout);
|
fputs(find_unique_abbrev(commit->object.oid.hash, abbrev_commit), stdout);
|
||||||
if (opt->print_parents)
|
if (opt->print_parents)
|
||||||
show_parents(commit, abbrev_commit);
|
show_parents(commit, abbrev_commit);
|
||||||
if (opt->children.name)
|
if (opt->children.name)
|
||||||
@ -613,7 +613,7 @@ void show_log(struct rev_info *opt)
|
|||||||
|
|
||||||
if (!opt->graph)
|
if (!opt->graph)
|
||||||
put_revision_mark(opt, commit);
|
put_revision_mark(opt, commit);
|
||||||
fputs(find_unique_abbrev(get_object_hash(commit->object), abbrev_commit),
|
fputs(find_unique_abbrev(commit->object.oid.hash, abbrev_commit),
|
||||||
stdout);
|
stdout);
|
||||||
if (opt->print_parents)
|
if (opt->print_parents)
|
||||||
show_parents(commit, abbrev_commit);
|
show_parents(commit, abbrev_commit);
|
||||||
@ -621,7 +621,7 @@ void show_log(struct rev_info *opt)
|
|||||||
show_children(opt, commit, abbrev_commit);
|
show_children(opt, commit, abbrev_commit);
|
||||||
if (parent)
|
if (parent)
|
||||||
printf(" (from %s)",
|
printf(" (from %s)",
|
||||||
find_unique_abbrev(get_object_hash(parent->object),
|
find_unique_abbrev(parent->object.oid.hash,
|
||||||
abbrev_commit));
|
abbrev_commit));
|
||||||
fputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), stdout);
|
fputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), stdout);
|
||||||
show_decorations(opt, commit);
|
show_decorations(opt, commit);
|
||||||
@ -660,7 +660,7 @@ void show_log(struct rev_info *opt)
|
|||||||
struct strbuf notebuf = STRBUF_INIT;
|
struct strbuf notebuf = STRBUF_INIT;
|
||||||
|
|
||||||
raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
|
raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
|
||||||
format_display_notes(get_object_hash(commit->object), ¬ebuf,
|
format_display_notes(commit->object.oid.hash, ¬ebuf,
|
||||||
get_log_output_encoding(), raw);
|
get_log_output_encoding(), raw);
|
||||||
ctx.notes_message = notebuf.len
|
ctx.notes_message = notebuf.len
|
||||||
? strbuf_detach(¬ebuf, NULL)
|
? strbuf_detach(¬ebuf, NULL)
|
||||||
|
@ -11,7 +11,7 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
|
|||||||
unsigned long size;
|
unsigned long size;
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
|
|
||||||
buf = read_sha1_file(get_object_hash(obj->object), &type, &size);
|
buf = read_sha1_file(obj->object.oid.hash, &type, &size);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return -1;
|
return -1;
|
||||||
if (type != OBJ_BLOB) {
|
if (type != OBJ_BLOB) {
|
||||||
@ -100,7 +100,7 @@ void *merge_blobs(const char *path, struct blob *base, struct blob *our, struct
|
|||||||
return NULL;
|
return NULL;
|
||||||
if (!our)
|
if (!our)
|
||||||
our = their;
|
our = their;
|
||||||
return read_sha1_file(get_object_hash(our->object), &type, size);
|
return read_sha1_file(our->object.oid.hash, &type, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fill_mmfile_blob(&f1, our) < 0)
|
if (fill_mmfile_blob(&f1, our) < 0)
|
||||||
|
@ -29,9 +29,9 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two,
|
|||||||
struct object_id shifted;
|
struct object_id shifted;
|
||||||
|
|
||||||
if (!*subtree_shift) {
|
if (!*subtree_shift) {
|
||||||
shift_tree(get_object_hash(one->object), get_object_hash(two->object), shifted.hash, 0);
|
shift_tree(one->object.oid.hash, two->object.oid.hash, shifted.hash, 0);
|
||||||
} else {
|
} else {
|
||||||
shift_tree_by(get_object_hash(one->object), get_object_hash(two->object), shifted.hash,
|
shift_tree_by(one->object.oid.hash, two->object.oid.hash, shifted.hash,
|
||||||
subtree_shift);
|
subtree_shift);
|
||||||
}
|
}
|
||||||
if (!oidcmp(&two->object.oid, &shifted))
|
if (!oidcmp(&two->object.oid, &shifted))
|
||||||
@ -184,7 +184,7 @@ static void output_commit_title(struct merge_options *o, struct commit *commit)
|
|||||||
if (commit->util)
|
if (commit->util)
|
||||||
printf("virtual %s\n", merge_remote_util(commit)->name);
|
printf("virtual %s\n", merge_remote_util(commit)->name);
|
||||||
else {
|
else {
|
||||||
printf("%s ", find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV));
|
printf("%s ", find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
|
||||||
if (parse_commit(commit) != 0)
|
if (parse_commit(commit) != 0)
|
||||||
printf(_("(bad commit)\n"));
|
printf(_("(bad commit)\n"));
|
||||||
else {
|
else {
|
||||||
@ -313,11 +313,11 @@ static struct stage_data *insert_stage_data(const char *path,
|
|||||||
{
|
{
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
struct stage_data *e = xcalloc(1, sizeof(struct stage_data));
|
struct stage_data *e = xcalloc(1, sizeof(struct stage_data));
|
||||||
get_tree_entry(get_object_hash(o->object), path,
|
get_tree_entry(o->object.oid.hash, path,
|
||||||
e->stages[1].sha, &e->stages[1].mode);
|
e->stages[1].sha, &e->stages[1].mode);
|
||||||
get_tree_entry(get_object_hash(a->object), path,
|
get_tree_entry(a->object.oid.hash, path,
|
||||||
e->stages[2].sha, &e->stages[2].mode);
|
e->stages[2].sha, &e->stages[2].mode);
|
||||||
get_tree_entry(get_object_hash(b->object), path,
|
get_tree_entry(b->object.oid.hash, path,
|
||||||
e->stages[3].sha, &e->stages[3].mode);
|
e->stages[3].sha, &e->stages[3].mode);
|
||||||
item = string_list_insert(entries, path);
|
item = string_list_insert(entries, path);
|
||||||
item->util = e;
|
item->util = e;
|
||||||
@ -493,7 +493,7 @@ static struct string_list *get_renames(struct merge_options *o,
|
|||||||
opts.show_rename_progress = o->show_rename_progress;
|
opts.show_rename_progress = o->show_rename_progress;
|
||||||
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
diff_setup_done(&opts);
|
diff_setup_done(&opts);
|
||||||
diff_tree_sha1(get_object_hash(o_tree->object), get_object_hash(tree->object), "", &opts);
|
diff_tree_sha1(o_tree->object.oid.hash, tree->object.oid.hash, "", &opts);
|
||||||
diffcore_std(&opts);
|
diffcore_std(&opts);
|
||||||
if (opts.needed_rename_limit > o->needed_rename_limit)
|
if (opts.needed_rename_limit > o->needed_rename_limit)
|
||||||
o->needed_rename_limit = opts.needed_rename_limit;
|
o->needed_rename_limit = opts.needed_rename_limit;
|
||||||
@ -1812,7 +1812,7 @@ int merge_trees(struct merge_options *o,
|
|||||||
common = shift_tree_object(head, common, o->subtree_shift);
|
common = shift_tree_object(head, common, o->subtree_shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sha_eq(get_object_hash(common->object), get_object_hash(merge->object))) {
|
if (sha_eq(common->object.oid.hash, merge->object.oid.hash)) {
|
||||||
output(o, 0, _("Already up-to-date!"));
|
output(o, 0, _("Already up-to-date!"));
|
||||||
*result = head;
|
*result = head;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -602,15 +602,15 @@ int notes_merge(struct notes_merge_options *o,
|
|||||||
if (o->verbosity >= 4)
|
if (o->verbosity >= 4)
|
||||||
printf("No merge base found; doing history-less merge\n");
|
printf("No merge base found; doing history-less merge\n");
|
||||||
} else if (!bases->next) {
|
} else if (!bases->next) {
|
||||||
base_sha1 = get_object_hash(bases->item->object);
|
base_sha1 = bases->item->object.oid.hash;
|
||||||
base_tree_sha1 = get_object_hash(bases->item->tree->object);
|
base_tree_sha1 = bases->item->tree->object.oid.hash;
|
||||||
if (o->verbosity >= 4)
|
if (o->verbosity >= 4)
|
||||||
printf("One merge base found (%.7s)\n",
|
printf("One merge base found (%.7s)\n",
|
||||||
sha1_to_hex(base_sha1));
|
sha1_to_hex(base_sha1));
|
||||||
} else {
|
} else {
|
||||||
/* TODO: How to handle multiple merge-bases? */
|
/* TODO: How to handle multiple merge-bases? */
|
||||||
base_sha1 = get_object_hash(bases->item->object);
|
base_sha1 = bases->item->object.oid.hash;
|
||||||
base_tree_sha1 = get_object_hash(bases->item->tree->object);
|
base_tree_sha1 = bases->item->tree->object.oid.hash;
|
||||||
if (o->verbosity >= 3)
|
if (o->verbosity >= 3)
|
||||||
printf("Multiple merge bases found. Using the first "
|
printf("Multiple merge bases found. Using the first "
|
||||||
"(%.7s)\n", sha1_to_hex(base_sha1));
|
"(%.7s)\n", sha1_to_hex(base_sha1));
|
||||||
@ -622,23 +622,23 @@ int notes_merge(struct notes_merge_options *o,
|
|||||||
oid_to_hex(&local->object.oid),
|
oid_to_hex(&local->object.oid),
|
||||||
sha1_to_hex(base_sha1));
|
sha1_to_hex(base_sha1));
|
||||||
|
|
||||||
if (!hashcmp(get_object_hash(remote->object), base_sha1)) {
|
if (!hashcmp(remote->object.oid.hash, base_sha1)) {
|
||||||
/* Already merged; result == local commit */
|
/* Already merged; result == local commit */
|
||||||
if (o->verbosity >= 2)
|
if (o->verbosity >= 2)
|
||||||
printf("Already up-to-date!\n");
|
printf("Already up-to-date!\n");
|
||||||
hashcpy(result_sha1, get_object_hash(local->object));
|
hashcpy(result_sha1, local->object.oid.hash);
|
||||||
goto found_result;
|
goto found_result;
|
||||||
}
|
}
|
||||||
if (!hashcmp(get_object_hash(local->object), base_sha1)) {
|
if (!hashcmp(local->object.oid.hash, base_sha1)) {
|
||||||
/* Fast-forward; result == remote commit */
|
/* Fast-forward; result == remote commit */
|
||||||
if (o->verbosity >= 2)
|
if (o->verbosity >= 2)
|
||||||
printf("Fast-forward\n");
|
printf("Fast-forward\n");
|
||||||
hashcpy(result_sha1, get_object_hash(remote->object));
|
hashcpy(result_sha1, remote->object.oid.hash);
|
||||||
goto found_result;
|
goto found_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = merge_from_diffs(o, base_tree_sha1, get_object_hash(local->tree->object),
|
result = merge_from_diffs(o, base_tree_sha1, local->tree->object.oid.hash,
|
||||||
get_object_hash(remote->tree->object), local_tree);
|
remote->tree->object.oid.hash, local_tree);
|
||||||
|
|
||||||
if (result != 0) { /* non-trivial merge (with or without conflicts) */
|
if (result != 0) { /* non-trivial merge (with or without conflicts) */
|
||||||
/* Commit (partial) result */
|
/* Commit (partial) result */
|
||||||
|
6
object.c
6
object.c
@ -68,7 +68,7 @@ static unsigned int hash_obj(const unsigned char *sha1, unsigned int n)
|
|||||||
*/
|
*/
|
||||||
static void insert_obj_hash(struct object *obj, struct object **hash, unsigned int size)
|
static void insert_obj_hash(struct object *obj, struct object **hash, unsigned int size)
|
||||||
{
|
{
|
||||||
unsigned int j = hash_obj(get_object_hash(*obj), size);
|
unsigned int j = hash_obj(obj->oid.hash, size);
|
||||||
|
|
||||||
while (hash[j]) {
|
while (hash[j]) {
|
||||||
j++;
|
j++;
|
||||||
@ -92,7 +92,7 @@ struct object *lookup_object(const unsigned char *sha1)
|
|||||||
|
|
||||||
first = i = hash_obj(sha1, obj_hash_size);
|
first = i = hash_obj(sha1, obj_hash_size);
|
||||||
while ((obj = obj_hash[i]) != NULL) {
|
while ((obj = obj_hash[i]) != NULL) {
|
||||||
if (!hashcmp(sha1, get_object_hash(*obj)))
|
if (!hashcmp(sha1, obj->oid.hash))
|
||||||
break;
|
break;
|
||||||
i++;
|
i++;
|
||||||
if (i == obj_hash_size)
|
if (i == obj_hash_size)
|
||||||
@ -145,7 +145,7 @@ void *create_object(const unsigned char *sha1, void *o)
|
|||||||
obj->parsed = 0;
|
obj->parsed = 0;
|
||||||
obj->used = 0;
|
obj->used = 0;
|
||||||
obj->flags = 0;
|
obj->flags = 0;
|
||||||
hashcpy(get_object_hash(*obj), sha1);
|
hashcpy(obj->oid.hash, sha1);
|
||||||
|
|
||||||
if (obj_hash_size - 1 <= nr_objs * 2)
|
if (obj_hash_size - 1 <= nr_objs * 2)
|
||||||
grow_object_hash();
|
grow_object_hash();
|
||||||
|
2
object.h
2
object.h
@ -52,8 +52,6 @@ struct object {
|
|||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define get_object_hash(x) ((x).oid.hash)
|
|
||||||
|
|
||||||
extern const char *typename(unsigned int type);
|
extern const char *typename(unsigned int type);
|
||||||
extern int type_from_string_gently(const char *str, ssize_t, int gentle);
|
extern int type_from_string_gently(const char *str, ssize_t, int gentle);
|
||||||
#define type_from_string(str) type_from_string_gently(str, -1, 0)
|
#define type_from_string(str) type_from_string_gently(str, -1, 0)
|
||||||
|
@ -152,7 +152,7 @@ static void show_object(struct object *object, const struct name_path *path,
|
|||||||
const char *last, void *data)
|
const char *last, void *data)
|
||||||
{
|
{
|
||||||
struct bitmap *base = data;
|
struct bitmap *base = data;
|
||||||
bitmap_set(base, find_object_pos(get_object_hash(*object)));
|
bitmap_set(base, find_object_pos(object->oid.hash));
|
||||||
mark_as_seen(object);
|
mark_as_seen(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,12 +165,12 @@ static int
|
|||||||
add_to_include_set(struct bitmap *base, struct commit *commit)
|
add_to_include_set(struct bitmap *base, struct commit *commit)
|
||||||
{
|
{
|
||||||
khiter_t hash_pos;
|
khiter_t hash_pos;
|
||||||
uint32_t bitmap_pos = find_object_pos(get_object_hash(commit->object));
|
uint32_t bitmap_pos = find_object_pos(commit->object.oid.hash);
|
||||||
|
|
||||||
if (bitmap_get(base, bitmap_pos))
|
if (bitmap_get(base, bitmap_pos))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hash_pos = kh_get_sha1(writer.bitmaps, get_object_hash(commit->object));
|
hash_pos = kh_get_sha1(writer.bitmaps, commit->object.oid.hash);
|
||||||
if (hash_pos < kh_end(writer.bitmaps)) {
|
if (hash_pos < kh_end(writer.bitmaps)) {
|
||||||
struct bitmapped_commit *bc = kh_value(writer.bitmaps, hash_pos);
|
struct bitmapped_commit *bc = kh_value(writer.bitmaps, hash_pos);
|
||||||
bitmap_or_ewah(base, bc->bitmap);
|
bitmap_or_ewah(base, bc->bitmap);
|
||||||
@ -308,7 +308,7 @@ void bitmap_writer_build(struct packing_data *to_pack)
|
|||||||
if (i >= reuse_after)
|
if (i >= reuse_after)
|
||||||
stored->flags |= BITMAP_FLAG_REUSE;
|
stored->flags |= BITMAP_FLAG_REUSE;
|
||||||
|
|
||||||
hash_pos = kh_put_sha1(writer.bitmaps, get_object_hash(*object), &hash_ret);
|
hash_pos = kh_put_sha1(writer.bitmaps, object->oid.hash, &hash_ret);
|
||||||
if (hash_ret == 0)
|
if (hash_ret == 0)
|
||||||
die("Duplicate entry when writing index: %s",
|
die("Duplicate entry when writing index: %s",
|
||||||
oid_to_hex(&object->oid));
|
oid_to_hex(&object->oid));
|
||||||
@ -414,14 +414,14 @@ void bitmap_writer_select_commits(struct commit **indexed_commits,
|
|||||||
|
|
||||||
if (next == 0) {
|
if (next == 0) {
|
||||||
chosen = indexed_commits[i];
|
chosen = indexed_commits[i];
|
||||||
reused_bitmap = find_reused_bitmap(get_object_hash(chosen->object));
|
reused_bitmap = find_reused_bitmap(chosen->object.oid.hash);
|
||||||
} else {
|
} else {
|
||||||
chosen = indexed_commits[i + next];
|
chosen = indexed_commits[i + next];
|
||||||
|
|
||||||
for (j = 0; j <= next; ++j) {
|
for (j = 0; j <= next; ++j) {
|
||||||
struct commit *cm = indexed_commits[i + j];
|
struct commit *cm = indexed_commits[i + j];
|
||||||
|
|
||||||
reused_bitmap = find_reused_bitmap(get_object_hash(cm->object));
|
reused_bitmap = find_reused_bitmap(cm->object.oid.hash);
|
||||||
if (reused_bitmap || (cm->object.flags & NEEDS_BITMAP) != 0) {
|
if (reused_bitmap || (cm->object.flags & NEEDS_BITMAP) != 0) {
|
||||||
chosen = cm;
|
chosen = cm;
|
||||||
break;
|
break;
|
||||||
@ -474,7 +474,7 @@ static void write_selected_commits_v1(struct sha1file *f,
|
|||||||
struct bitmapped_commit *stored = &writer.selected[i];
|
struct bitmapped_commit *stored = &writer.selected[i];
|
||||||
|
|
||||||
int commit_pos =
|
int commit_pos =
|
||||||
sha1_pos(get_object_hash(stored->commit->object), index, index_nr, sha1_access);
|
sha1_pos(stored->commit->object.oid.hash, index, index_nr, sha1_access);
|
||||||
|
|
||||||
if (commit_pos < 0)
|
if (commit_pos < 0)
|
||||||
die("BUG: trying to write commit not in index");
|
die("BUG: trying to write commit not in index");
|
||||||
|
@ -397,7 +397,7 @@ static int ext_index_add_object(struct object *object, const char *name)
|
|||||||
int hash_ret;
|
int hash_ret;
|
||||||
int bitmap_pos;
|
int bitmap_pos;
|
||||||
|
|
||||||
hash_pos = kh_put_sha1_pos(eindex->positions, get_object_hash(*object), &hash_ret);
|
hash_pos = kh_put_sha1_pos(eindex->positions, object->oid.hash, &hash_ret);
|
||||||
if (hash_ret > 0) {
|
if (hash_ret > 0) {
|
||||||
if (eindex->count >= eindex->alloc) {
|
if (eindex->count >= eindex->alloc) {
|
||||||
eindex->alloc = (eindex->alloc + 16) * 3 / 2;
|
eindex->alloc = (eindex->alloc + 16) * 3 / 2;
|
||||||
@ -423,7 +423,7 @@ static void show_object(struct object *object, const struct name_path *path,
|
|||||||
struct bitmap *base = data;
|
struct bitmap *base = data;
|
||||||
int bitmap_pos;
|
int bitmap_pos;
|
||||||
|
|
||||||
bitmap_pos = bitmap_position(get_object_hash(*object));
|
bitmap_pos = bitmap_position(object->oid.hash);
|
||||||
|
|
||||||
if (bitmap_pos < 0) {
|
if (bitmap_pos < 0) {
|
||||||
char *name = path_name(path, last);
|
char *name = path_name(path, last);
|
||||||
@ -466,11 +466,11 @@ static int should_include(struct commit *commit, void *_data)
|
|||||||
struct include_data *data = _data;
|
struct include_data *data = _data;
|
||||||
int bitmap_pos;
|
int bitmap_pos;
|
||||||
|
|
||||||
bitmap_pos = bitmap_position(get_object_hash(commit->object));
|
bitmap_pos = bitmap_position(commit->object.oid.hash);
|
||||||
if (bitmap_pos < 0)
|
if (bitmap_pos < 0)
|
||||||
bitmap_pos = ext_index_add_object((struct object *)commit, NULL);
|
bitmap_pos = ext_index_add_object((struct object *)commit, NULL);
|
||||||
|
|
||||||
if (!add_to_include_set(data, get_object_hash(commit->object), bitmap_pos)) {
|
if (!add_to_include_set(data, commit->object.oid.hash, bitmap_pos)) {
|
||||||
struct commit_list *parent = commit->parents;
|
struct commit_list *parent = commit->parents;
|
||||||
|
|
||||||
while (parent) {
|
while (parent) {
|
||||||
@ -506,7 +506,7 @@ static struct bitmap *find_objects(struct rev_info *revs,
|
|||||||
roots = roots->next;
|
roots = roots->next;
|
||||||
|
|
||||||
if (object->type == OBJ_COMMIT) {
|
if (object->type == OBJ_COMMIT) {
|
||||||
khiter_t pos = kh_get_sha1(bitmap_git.bitmaps, get_object_hash(*object));
|
khiter_t pos = kh_get_sha1(bitmap_git.bitmaps, object->oid.hash);
|
||||||
|
|
||||||
if (pos < kh_end(bitmap_git.bitmaps)) {
|
if (pos < kh_end(bitmap_git.bitmaps)) {
|
||||||
struct stored_bitmap *st = kh_value(bitmap_git.bitmaps, pos);
|
struct stored_bitmap *st = kh_value(bitmap_git.bitmaps, pos);
|
||||||
@ -548,7 +548,7 @@ static struct bitmap *find_objects(struct rev_info *revs,
|
|||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
roots = roots->next;
|
roots = roots->next;
|
||||||
pos = bitmap_position(get_object_hash(*object));
|
pos = bitmap_position(object->oid.hash);
|
||||||
|
|
||||||
if (pos < 0 || base == NULL || !bitmap_get(base, pos)) {
|
if (pos < 0 || base == NULL || !bitmap_get(base, pos)) {
|
||||||
object->flags &= ~UNINTERESTING;
|
object->flags &= ~UNINTERESTING;
|
||||||
@ -593,7 +593,7 @@ static void show_extended_objects(struct bitmap *objects,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
obj = eindex->objects[i];
|
obj = eindex->objects[i];
|
||||||
show_reach(get_object_hash(*obj), obj->type, 0, eindex->hashes[i], NULL, 0);
|
show_reach(obj->oid.hash, obj->type, 0, eindex->hashes[i], NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,7 +650,7 @@ static int in_bitmapped_pack(struct object_list *roots)
|
|||||||
struct object *object = roots->item;
|
struct object *object = roots->item;
|
||||||
roots = roots->next;
|
roots = roots->next;
|
||||||
|
|
||||||
if (find_pack_entry_one(get_object_hash(*object), bitmap_git.pack) > 0)
|
if (find_pack_entry_one(object->oid.hash, bitmap_git.pack) > 0)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,7 +680,7 @@ int prepare_bitmap_walk(struct rev_info *revs)
|
|||||||
struct object *object = pending_e[i].item;
|
struct object *object = pending_e[i].item;
|
||||||
|
|
||||||
if (object->type == OBJ_NONE)
|
if (object->type == OBJ_NONE)
|
||||||
parse_object_or_die(get_object_hash(*object), NULL);
|
parse_object_or_die(object->oid.hash, NULL);
|
||||||
|
|
||||||
while (object->type == OBJ_TAG) {
|
while (object->type == OBJ_TAG) {
|
||||||
struct tag *tag = (struct tag *) object;
|
struct tag *tag = (struct tag *) object;
|
||||||
@ -692,7 +692,7 @@ int prepare_bitmap_walk(struct rev_info *revs)
|
|||||||
|
|
||||||
if (!tag->tagged)
|
if (!tag->tagged)
|
||||||
die("bad tag");
|
die("bad tag");
|
||||||
object = parse_object_or_die(get_object_hash(*tag->tagged), NULL);
|
object = parse_object_or_die(tag->tagged->oid.hash, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object->flags & UNINTERESTING)
|
if (object->flags & UNINTERESTING)
|
||||||
@ -904,7 +904,7 @@ static void test_show_object(struct object *object,
|
|||||||
struct bitmap_test_data *tdata = data;
|
struct bitmap_test_data *tdata = data;
|
||||||
int bitmap_pos;
|
int bitmap_pos;
|
||||||
|
|
||||||
bitmap_pos = bitmap_position(get_object_hash(*object));
|
bitmap_pos = bitmap_position(object->oid.hash);
|
||||||
if (bitmap_pos < 0)
|
if (bitmap_pos < 0)
|
||||||
die("Object not in bitmap: %s\n", oid_to_hex(&object->oid));
|
die("Object not in bitmap: %s\n", oid_to_hex(&object->oid));
|
||||||
|
|
||||||
@ -917,7 +917,7 @@ static void test_show_commit(struct commit *commit, void *data)
|
|||||||
struct bitmap_test_data *tdata = data;
|
struct bitmap_test_data *tdata = data;
|
||||||
int bitmap_pos;
|
int bitmap_pos;
|
||||||
|
|
||||||
bitmap_pos = bitmap_position(get_object_hash(commit->object));
|
bitmap_pos = bitmap_position(commit->object.oid.hash);
|
||||||
if (bitmap_pos < 0)
|
if (bitmap_pos < 0)
|
||||||
die("Object not in bitmap: %s\n", oid_to_hex(&commit->object.oid));
|
die("Object not in bitmap: %s\n", oid_to_hex(&commit->object.oid));
|
||||||
|
|
||||||
@ -943,7 +943,7 @@ void test_bitmap_walk(struct rev_info *revs)
|
|||||||
bitmap_git.version, bitmap_git.entry_count);
|
bitmap_git.version, bitmap_git.entry_count);
|
||||||
|
|
||||||
root = revs->pending.objects[0].item;
|
root = revs->pending.objects[0].item;
|
||||||
pos = kh_get_sha1(bitmap_git.bitmaps, get_object_hash(*root));
|
pos = kh_get_sha1(bitmap_git.bitmaps, root->oid.hash);
|
||||||
|
|
||||||
if (pos < kh_end(bitmap_git.bitmaps)) {
|
if (pos < kh_end(bitmap_git.bitmaps)) {
|
||||||
struct stored_bitmap *st = kh_value(bitmap_git.bitmaps, pos);
|
struct stored_bitmap *st = kh_value(bitmap_git.bitmaps, pos);
|
||||||
|
@ -8,10 +8,10 @@ static int commit_patch_id(struct commit *commit, struct diff_options *options,
|
|||||||
unsigned char *sha1)
|
unsigned char *sha1)
|
||||||
{
|
{
|
||||||
if (commit->parents)
|
if (commit->parents)
|
||||||
diff_tree_sha1(get_object_hash(commit->parents->item->object),
|
diff_tree_sha1(commit->parents->item->object.oid.hash,
|
||||||
get_object_hash(commit->object), "", options);
|
commit->object.oid.hash, "", options);
|
||||||
else
|
else
|
||||||
diff_root_tree_sha1(get_object_hash(commit->object), "", options);
|
diff_root_tree_sha1(commit->object.oid.hash, "", options);
|
||||||
diffcore_std(options);
|
diffcore_std(options);
|
||||||
return diff_flush_patch_id(options, sha1);
|
return diff_flush_patch_id(options, sha1);
|
||||||
}
|
}
|
||||||
|
8
pretty.c
8
pretty.c
@ -543,7 +543,7 @@ static void add_merge_info(const struct pretty_print_context *pp,
|
|||||||
struct commit *p = parent->item;
|
struct commit *p = parent->item;
|
||||||
const char *hex = NULL;
|
const char *hex = NULL;
|
||||||
if (pp->abbrev)
|
if (pp->abbrev)
|
||||||
hex = find_unique_abbrev(get_object_hash(p->object), pp->abbrev);
|
hex = find_unique_abbrev(p->object.oid.hash, pp->abbrev);
|
||||||
if (!hex)
|
if (!hex)
|
||||||
hex = oid_to_hex(&p->object.oid);
|
hex = oid_to_hex(&p->object.oid);
|
||||||
parent = parent->next;
|
parent = parent->next;
|
||||||
@ -1119,7 +1119,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
|
|||||||
|
|
||||||
/* these depend on the commit */
|
/* these depend on the commit */
|
||||||
if (!commit->object.parsed)
|
if (!commit->object.parsed)
|
||||||
parse_object(get_object_hash(commit->object));
|
parse_object(commit->object.oid.hash);
|
||||||
|
|
||||||
switch (placeholder[0]) {
|
switch (placeholder[0]) {
|
||||||
case 'H': /* commit hash */
|
case 'H': /* commit hash */
|
||||||
@ -1133,7 +1133,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
|
|||||||
strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET));
|
strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strbuf_addstr(sb, find_unique_abbrev(get_object_hash(commit->object),
|
strbuf_addstr(sb, find_unique_abbrev(commit->object.oid.hash,
|
||||||
c->pretty_ctx->abbrev));
|
c->pretty_ctx->abbrev));
|
||||||
strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET));
|
strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET));
|
||||||
c->abbrev_commit_hash.len = sb->len - c->abbrev_commit_hash.off;
|
c->abbrev_commit_hash.len = sb->len - c->abbrev_commit_hash.off;
|
||||||
@ -1162,7 +1162,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
|
|||||||
if (p != commit->parents)
|
if (p != commit->parents)
|
||||||
strbuf_addch(sb, ' ');
|
strbuf_addch(sb, ' ');
|
||||||
strbuf_addstr(sb, find_unique_abbrev(
|
strbuf_addstr(sb, find_unique_abbrev(
|
||||||
get_object_hash(p->item->object),
|
p->item->object.oid.hash,
|
||||||
c->pretty_ctx->abbrev));
|
c->pretty_ctx->abbrev));
|
||||||
}
|
}
|
||||||
c->abbrev_parent_hashes.len = sb->len -
|
c->abbrev_parent_hashes.len = sb->len -
|
||||||
|
@ -372,7 +372,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
|
|||||||
v->s = xstrfmt("%lu", sz);
|
v->s = xstrfmt("%lu", sz);
|
||||||
}
|
}
|
||||||
else if (deref)
|
else if (deref)
|
||||||
grab_objectname(name, get_object_hash(*obj), v);
|
grab_objectname(name, obj->oid.hash, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,7 +992,7 @@ static void populate_value(struct ref_array_item *ref)
|
|||||||
* If it is a tag object, see if we use a value that derefs
|
* If it is a tag object, see if we use a value that derefs
|
||||||
* the object, and if we do grab the object it refers to.
|
* the object, and if we do grab the object it refers to.
|
||||||
*/
|
*/
|
||||||
tagged = get_object_hash(*((struct tag *)obj)->tagged);
|
tagged = ((struct tag *)obj)->tagged->oid.hash;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NEEDSWORK: This derefs tag only once, which
|
* NEEDSWORK: This derefs tag only once, which
|
||||||
@ -1218,7 +1218,7 @@ static const unsigned char *match_points_at(struct sha1_array *points_at,
|
|||||||
if (!obj)
|
if (!obj)
|
||||||
die(_("malformed object at '%s'"), refname);
|
die(_("malformed object at '%s'"), refname);
|
||||||
if (obj->type == OBJ_TAG)
|
if (obj->type == OBJ_TAG)
|
||||||
tagged_sha1 = get_object_hash(*((struct tag *)obj)->tagged);
|
tagged_sha1 = ((struct tag *)obj)->tagged->oid.hash;
|
||||||
if (tagged_sha1 && sha1_array_lookup(points_at, tagged_sha1) >= 0)
|
if (tagged_sha1 && sha1_array_lookup(points_at, tagged_sha1) >= 0)
|
||||||
return tagged_sha1;
|
return tagged_sha1;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
2
refs.c
2
refs.c
@ -1880,7 +1880,7 @@ static enum peel_status peel_object(const unsigned char *name, unsigned char *sh
|
|||||||
if (!o)
|
if (!o)
|
||||||
return PEEL_INVALID;
|
return PEEL_INVALID;
|
||||||
|
|
||||||
hashcpy(sha1, get_object_hash(*o));
|
hashcpy(sha1, o->oid.hash);
|
||||||
return PEEL_PEELED;
|
return PEEL_PEELED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
revision.c
16
revision.c
@ -282,7 +282,7 @@ static struct commit *handle_commit(struct rev_info *revs,
|
|||||||
add_pending_object(revs, object, tag->tag);
|
add_pending_object(revs, object, tag->tag);
|
||||||
if (!tag->tagged)
|
if (!tag->tagged)
|
||||||
die("bad tag");
|
die("bad tag");
|
||||||
object = parse_object(get_object_hash(*tag->tagged));
|
object = parse_object(tag->tagged->oid.hash);
|
||||||
if (!object) {
|
if (!object) {
|
||||||
if (flags & UNINTERESTING)
|
if (flags & UNINTERESTING)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -510,7 +510,7 @@ static int rev_compare_tree(struct rev_info *revs,
|
|||||||
|
|
||||||
tree_difference = REV_TREE_SAME;
|
tree_difference = REV_TREE_SAME;
|
||||||
DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
|
DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
|
||||||
if (diff_tree_sha1(get_object_hash(t1->object), get_object_hash(t2->object), "",
|
if (diff_tree_sha1(t1->object.oid.hash, t2->object.oid.hash, "",
|
||||||
&revs->pruning) < 0)
|
&revs->pruning) < 0)
|
||||||
return REV_TREE_DIFFERENT;
|
return REV_TREE_DIFFERENT;
|
||||||
return tree_difference;
|
return tree_difference;
|
||||||
@ -526,7 +526,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
|
|||||||
|
|
||||||
tree_difference = REV_TREE_SAME;
|
tree_difference = REV_TREE_SAME;
|
||||||
DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
|
DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
|
||||||
retval = diff_tree_sha1(NULL, get_object_hash(t1->object), "", &revs->pruning);
|
retval = diff_tree_sha1(NULL, t1->object.oid.hash, "", &revs->pruning);
|
||||||
|
|
||||||
return retval >= 0 && (tree_difference == REV_TREE_SAME);
|
return retval >= 0 && (tree_difference == REV_TREE_SAME);
|
||||||
}
|
}
|
||||||
@ -1378,7 +1378,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg_, int flags)
|
|||||||
break;
|
break;
|
||||||
if (!((struct tag*)it)->tagged)
|
if (!((struct tag*)it)->tagged)
|
||||||
return 0;
|
return 0;
|
||||||
hashcpy(sha1, get_object_hash(*((struct tag*)it)->tagged));
|
hashcpy(sha1, ((struct tag*)it)->tagged->oid.hash);
|
||||||
}
|
}
|
||||||
if (it->type != OBJ_COMMIT)
|
if (it->type != OBJ_COMMIT)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1555,10 +1555,10 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
|
|||||||
|
|
||||||
a = (a_obj->type == OBJ_COMMIT
|
a = (a_obj->type == OBJ_COMMIT
|
||||||
? (struct commit *)a_obj
|
? (struct commit *)a_obj
|
||||||
: lookup_commit_reference(get_object_hash(*a_obj)));
|
: lookup_commit_reference(a_obj->oid.hash));
|
||||||
b = (b_obj->type == OBJ_COMMIT
|
b = (b_obj->type == OBJ_COMMIT
|
||||||
? (struct commit *)b_obj
|
? (struct commit *)b_obj
|
||||||
: lookup_commit_reference(get_object_hash(*b_obj)));
|
: lookup_commit_reference(b_obj->oid.hash));
|
||||||
if (!a || !b)
|
if (!a || !b)
|
||||||
goto missing;
|
goto missing;
|
||||||
exclude = get_merge_bases(a, b);
|
exclude = get_merge_bases(a, b);
|
||||||
@ -2938,7 +2938,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
|
|||||||
if (opt->show_notes) {
|
if (opt->show_notes) {
|
||||||
if (!buf.len)
|
if (!buf.len)
|
||||||
strbuf_addstr(&buf, message);
|
strbuf_addstr(&buf, message);
|
||||||
format_display_notes(get_object_hash(commit->object), &buf, encoding, 1);
|
format_display_notes(commit->object.oid.hash, &buf, encoding, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2968,7 +2968,7 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
|
|||||||
{
|
{
|
||||||
if (commit->object.flags & SHOWN)
|
if (commit->object.flags & SHOWN)
|
||||||
return commit_ignore;
|
return commit_ignore;
|
||||||
if (revs->unpacked && has_sha1_pack(get_object_hash(commit->object)))
|
if (revs->unpacked && has_sha1_pack(commit->object.oid.hash))
|
||||||
return commit_ignore;
|
return commit_ignore;
|
||||||
if (revs->show_all)
|
if (revs->show_all)
|
||||||
return commit_show;
|
return commit_show;
|
||||||
|
18
sequencer.c
18
sequencer.c
@ -346,7 +346,7 @@ static int is_index_unchanged(void)
|
|||||||
if (cache_tree_update(&the_index, 0))
|
if (cache_tree_update(&the_index, 0))
|
||||||
return error(_("Unable to update cache tree\n"));
|
return error(_("Unable to update cache tree\n"));
|
||||||
|
|
||||||
return !hashcmp(active_cache_tree->sha1, get_object_hash(head_commit->tree->object));
|
return !hashcmp(active_cache_tree->sha1, head_commit->tree->object.oid.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -403,12 +403,12 @@ static int is_original_commit_empty(struct commit *commit)
|
|||||||
if (parse_commit(parent))
|
if (parse_commit(parent))
|
||||||
return error(_("Could not parse parent commit %s\n"),
|
return error(_("Could not parse parent commit %s\n"),
|
||||||
oid_to_hex(&parent->object.oid));
|
oid_to_hex(&parent->object.oid));
|
||||||
ptree_sha1 = get_object_hash(parent->tree->object);
|
ptree_sha1 = parent->tree->object.oid.hash;
|
||||||
} else {
|
} else {
|
||||||
ptree_sha1 = EMPTY_TREE_SHA1_BIN; /* commit is root */
|
ptree_sha1 = EMPTY_TREE_SHA1_BIN; /* commit is root */
|
||||||
}
|
}
|
||||||
|
|
||||||
return !hashcmp(ptree_sha1, get_object_hash(commit->tree->object));
|
return !hashcmp(ptree_sha1, commit->tree->object.oid.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -503,9 +503,9 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
|
|||||||
parent = commit->parents->item;
|
parent = commit->parents->item;
|
||||||
|
|
||||||
if (opts->allow_ff &&
|
if (opts->allow_ff &&
|
||||||
((parent && !hashcmp(get_object_hash(parent->object), head)) ||
|
((parent && !hashcmp(parent->object.oid.hash, head)) ||
|
||||||
(!parent && unborn)))
|
(!parent && unborn)))
|
||||||
return fast_forward_to(get_object_hash(commit->object), head, unborn, opts);
|
return fast_forward_to(commit->object.oid.hash, head, unborn, opts);
|
||||||
|
|
||||||
if (parent && parse_commit(parent) < 0)
|
if (parent && parse_commit(parent) < 0)
|
||||||
/* TRANSLATORS: The first %s will be "revert" or
|
/* TRANSLATORS: The first %s will be "revert" or
|
||||||
@ -592,17 +592,17 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
|
|||||||
* write it at all.
|
* write it at all.
|
||||||
*/
|
*/
|
||||||
if (opts->action == REPLAY_PICK && !opts->no_commit && (res == 0 || res == 1))
|
if (opts->action == REPLAY_PICK && !opts->no_commit && (res == 0 || res == 1))
|
||||||
update_ref(NULL, "CHERRY_PICK_HEAD", get_object_hash(commit->object), NULL,
|
update_ref(NULL, "CHERRY_PICK_HEAD", commit->object.oid.hash, NULL,
|
||||||
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
||||||
if (opts->action == REPLAY_REVERT && ((opts->no_commit && res == 0) || res == 1))
|
if (opts->action == REPLAY_REVERT && ((opts->no_commit && res == 0) || res == 1))
|
||||||
update_ref(NULL, "REVERT_HEAD", get_object_hash(commit->object), NULL,
|
update_ref(NULL, "REVERT_HEAD", commit->object.oid.hash, NULL,
|
||||||
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
error(opts->action == REPLAY_REVERT
|
error(opts->action == REPLAY_REVERT
|
||||||
? _("could not revert %s... %s")
|
? _("could not revert %s... %s")
|
||||||
: _("could not apply %s... %s"),
|
: _("could not apply %s... %s"),
|
||||||
find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV),
|
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV),
|
||||||
msg.subject);
|
msg.subject);
|
||||||
print_advice(res == 1, opts);
|
print_advice(res == 1, opts);
|
||||||
rerere(opts->allow_rerere_auto);
|
rerere(opts->allow_rerere_auto);
|
||||||
@ -664,7 +664,7 @@ static int format_todo(struct strbuf *buf, struct commit_list *todo_list,
|
|||||||
|
|
||||||
for (cur = todo_list; cur; cur = cur->next) {
|
for (cur = todo_list; cur; cur = cur->next) {
|
||||||
const char *commit_buffer = get_commit_buffer(cur->item, NULL);
|
const char *commit_buffer = get_commit_buffer(cur->item, NULL);
|
||||||
sha1_abbrev = find_unique_abbrev(get_object_hash(cur->item->object), DEFAULT_ABBREV);
|
sha1_abbrev = find_unique_abbrev(cur->item->object.oid.hash, DEFAULT_ABBREV);
|
||||||
subject_len = find_commit_subject(commit_buffer, &subject);
|
subject_len = find_commit_subject(commit_buffer, &subject);
|
||||||
strbuf_addf(buf, "%s %s %.*s\n", action_str, sha1_abbrev,
|
strbuf_addf(buf, "%s %s %.*s\n", action_str, sha1_abbrev,
|
||||||
subject_len, subject);
|
subject_len, subject);
|
||||||
|
16
sha1_name.c
16
sha1_name.c
@ -616,13 +616,13 @@ static int get_parent(const char *name, int len,
|
|||||||
if (parse_commit(commit))
|
if (parse_commit(commit))
|
||||||
return -1;
|
return -1;
|
||||||
if (!idx) {
|
if (!idx) {
|
||||||
hashcpy(result, get_object_hash(commit->object));
|
hashcpy(result, commit->object.oid.hash);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
p = commit->parents;
|
p = commit->parents;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (!--idx) {
|
if (!--idx) {
|
||||||
hashcpy(result, get_object_hash(p->item->object));
|
hashcpy(result, p->item->object.oid.hash);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
p = p->next;
|
p = p->next;
|
||||||
@ -649,7 +649,7 @@ static int get_nth_ancestor(const char *name, int len,
|
|||||||
return -1;
|
return -1;
|
||||||
commit = commit->parents->item;
|
commit = commit->parents->item;
|
||||||
}
|
}
|
||||||
hashcpy(result, get_object_hash(commit->object));
|
hashcpy(result, commit->object.oid.hash);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,7 +659,7 @@ struct object *peel_to_type(const char *name, int namelen,
|
|||||||
if (name && !namelen)
|
if (name && !namelen)
|
||||||
namelen = strlen(name);
|
namelen = strlen(name);
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!o || (!o->parsed && !parse_object(get_object_hash(*o))))
|
if (!o || (!o->parsed && !parse_object(o->oid.hash)))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (expected_type == OBJ_ANY || o->type == expected_type)
|
if (expected_type == OBJ_ANY || o->type == expected_type)
|
||||||
return o;
|
return o;
|
||||||
@ -736,7 +736,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
|
|||||||
return -1;
|
return -1;
|
||||||
if (!expected_type) {
|
if (!expected_type) {
|
||||||
o = deref_tag(o, name, sp - name - 2);
|
o = deref_tag(o, name, sp - name - 2);
|
||||||
if (!o || (!o->parsed && !parse_object(get_object_hash(*o))))
|
if (!o || (!o->parsed && !parse_object(o->oid.hash)))
|
||||||
return -1;
|
return -1;
|
||||||
hashcpy(sha1, o->oid.hash);
|
hashcpy(sha1, o->oid.hash);
|
||||||
return 0;
|
return 0;
|
||||||
@ -751,7 +751,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
|
|||||||
if (!o)
|
if (!o)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
hashcpy(sha1, get_object_hash(*o));
|
hashcpy(sha1, o->oid.hash);
|
||||||
if (sp[0] == '/') {
|
if (sp[0] == '/') {
|
||||||
/* "$commit^{/foo}" */
|
/* "$commit^{/foo}" */
|
||||||
char *prefix;
|
char *prefix;
|
||||||
@ -899,7 +899,7 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1,
|
|||||||
int matches;
|
int matches;
|
||||||
|
|
||||||
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
|
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
|
||||||
if (!parse_object(get_object_hash(commit->object)))
|
if (!parse_object(commit->object.oid.hash))
|
||||||
continue;
|
continue;
|
||||||
buf = get_commit_buffer(commit, NULL);
|
buf = get_commit_buffer(commit, NULL);
|
||||||
p = strstr(buf, "\n\n");
|
p = strstr(buf, "\n\n");
|
||||||
@ -907,7 +907,7 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1,
|
|||||||
unuse_commit_buffer(commit, buf);
|
unuse_commit_buffer(commit, buf);
|
||||||
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
hashcpy(sha1, get_object_hash(commit->object));
|
hashcpy(sha1, commit->object.oid.hash);
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
|
|||||||
cur_depth++;
|
cur_depth++;
|
||||||
if ((depth != INFINITE_DEPTH && cur_depth >= depth) ||
|
if ((depth != INFINITE_DEPTH && cur_depth >= depth) ||
|
||||||
(is_repository_shallow() && !commit->parents &&
|
(is_repository_shallow() && !commit->parents &&
|
||||||
(graft = lookup_commit_graft(get_object_hash(commit->object))) != NULL &&
|
(graft = lookup_commit_graft(commit->object.oid.hash)) != NULL &&
|
||||||
graft->nr_parent < 0)) {
|
graft->nr_parent < 0)) {
|
||||||
commit_list_insert(commit, &result);
|
commit_list_insert(commit, &result);
|
||||||
commit->object.flags |= shallow_flag;
|
commit->object.flags |= shallow_flag;
|
||||||
|
@ -597,7 +597,7 @@ static void calculate_changed_submodule_paths(void)
|
|||||||
diff_opts.output_format |= DIFF_FORMAT_CALLBACK;
|
diff_opts.output_format |= DIFF_FORMAT_CALLBACK;
|
||||||
diff_opts.format_callback = submodule_collect_changed_cb;
|
diff_opts.format_callback = submodule_collect_changed_cb;
|
||||||
diff_setup_done(&diff_opts);
|
diff_setup_done(&diff_opts);
|
||||||
diff_tree_sha1(get_object_hash(parent->item->object), get_object_hash(commit->object), "", &diff_opts);
|
diff_tree_sha1(parent->item->object.oid.hash, commit->object.oid.hash, "", &diff_opts);
|
||||||
diffcore_std(&diff_opts);
|
diffcore_std(&diff_opts);
|
||||||
diff_flush(&diff_opts);
|
diff_flush(&diff_opts);
|
||||||
parent = parent->next;
|
parent = parent->next;
|
||||||
|
6
tag.c
6
tag.c
@ -10,7 +10,7 @@ struct object *deref_tag(struct object *o, const char *warn, int warnlen)
|
|||||||
{
|
{
|
||||||
while (o && o->type == OBJ_TAG)
|
while (o && o->type == OBJ_TAG)
|
||||||
if (((struct tag *)o)->tagged)
|
if (((struct tag *)o)->tagged)
|
||||||
o = parse_object(get_object_hash(*((struct tag *)o)->tagged));
|
o = parse_object(((struct tag *)o)->tagged->oid.hash);
|
||||||
else
|
else
|
||||||
o = NULL;
|
o = NULL;
|
||||||
if (!o && warn) {
|
if (!o && warn) {
|
||||||
@ -24,7 +24,7 @@ struct object *deref_tag(struct object *o, const char *warn, int warnlen)
|
|||||||
struct object *deref_tag_noverify(struct object *o)
|
struct object *deref_tag_noverify(struct object *o)
|
||||||
{
|
{
|
||||||
while (o && o->type == OBJ_TAG) {
|
while (o && o->type == OBJ_TAG) {
|
||||||
o = parse_object(get_object_hash(*o));
|
o = parse_object(o->oid.hash);
|
||||||
if (o && o->type == OBJ_TAG && ((struct tag *)o)->tagged)
|
if (o && o->type == OBJ_TAG && ((struct tag *)o)->tagged)
|
||||||
o = ((struct tag *)o)->tagged;
|
o = ((struct tag *)o)->tagged;
|
||||||
else
|
else
|
||||||
@ -127,7 +127,7 @@ int parse_tag(struct tag *item)
|
|||||||
|
|
||||||
if (item->object.parsed)
|
if (item->object.parsed)
|
||||||
return 0;
|
return 0;
|
||||||
data = read_sha1_file(get_object_hash(item->object), &type, &size);
|
data = read_sha1_file(item->object.oid.hash, &type, &size);
|
||||||
if (!data)
|
if (!data)
|
||||||
return error("Could not read %s",
|
return error("Could not read %s",
|
||||||
oid_to_hex(&item->object.oid));
|
oid_to_hex(&item->object.oid));
|
||||||
|
@ -17,7 +17,7 @@ int main(int ac, char **av)
|
|||||||
if (!two)
|
if (!two)
|
||||||
die("not a tree-ish %s", av[2]);
|
die("not a tree-ish %s", av[2]);
|
||||||
|
|
||||||
shift_tree(get_object_hash(one->object), get_object_hash(two->object), shifted, -1);
|
shift_tree(one->object.oid.hash, two->object.oid.hash, shifted, -1);
|
||||||
printf("shifted: %s\n", sha1_to_hex(shifted));
|
printf("shifted: %s\n", sha1_to_hex(shifted));
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
4
tree.c
4
tree.c
@ -102,7 +102,7 @@ static int read_tree_1(struct tree *tree, struct strbuf *base,
|
|||||||
sha1_to_hex(entry.sha1),
|
sha1_to_hex(entry.sha1),
|
||||||
base->buf, entry.path);
|
base->buf, entry.path);
|
||||||
|
|
||||||
hashcpy(sha1, get_object_hash(commit->tree->object));
|
hashcpy(sha1, commit->tree->object.oid.hash);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
@ -212,7 +212,7 @@ int parse_tree_gently(struct tree *item, int quiet_on_missing)
|
|||||||
|
|
||||||
if (item->object.parsed)
|
if (item->object.parsed)
|
||||||
return 0;
|
return 0;
|
||||||
buffer = read_sha1_file(get_object_hash(item->object), &type, &size);
|
buffer = read_sha1_file(item->object.oid.hash, &type, &size);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return quiet_on_missing ? -1 :
|
return quiet_on_missing ? -1 :
|
||||||
error("Could not read %s",
|
error("Could not read %s",
|
||||||
|
@ -324,7 +324,7 @@ static int reachable(struct commit *want)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!commit->object.parsed)
|
if (!commit->object.parsed)
|
||||||
parse_object(get_object_hash(commit->object));
|
parse_object(commit->object.oid.hash);
|
||||||
if (commit->object.flags & REACHABLE)
|
if (commit->object.flags & REACHABLE)
|
||||||
continue;
|
continue;
|
||||||
commit->object.flags |= REACHABLE;
|
commit->object.flags |= REACHABLE;
|
||||||
@ -647,7 +647,7 @@ static void receive_needs(void)
|
|||||||
if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
|
if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
|
||||||
packet_write(1, "shallow %s",
|
packet_write(1, "shallow %s",
|
||||||
oid_to_hex(&object->oid));
|
oid_to_hex(&object->oid));
|
||||||
register_shallow(get_object_hash(*object));
|
register_shallow(object->oid.hash);
|
||||||
shallow_nr++;
|
shallow_nr++;
|
||||||
}
|
}
|
||||||
result = result->next;
|
result = result->next;
|
||||||
@ -661,7 +661,7 @@ static void receive_needs(void)
|
|||||||
oid_to_hex(&object->oid));
|
oid_to_hex(&object->oid));
|
||||||
object->flags &= ~CLIENT_SHALLOW;
|
object->flags &= ~CLIENT_SHALLOW;
|
||||||
/* make sure the real parents are parsed */
|
/* make sure the real parents are parsed */
|
||||||
unregister_shallow(get_object_hash(*object));
|
unregister_shallow(object->oid.hash);
|
||||||
object->parsed = 0;
|
object->parsed = 0;
|
||||||
parse_commit_or_die((struct commit *)object);
|
parse_commit_or_die((struct commit *)object);
|
||||||
parents = ((struct commit *)object)->parents;
|
parents = ((struct commit *)object)->parents;
|
||||||
@ -673,14 +673,14 @@ static void receive_needs(void)
|
|||||||
add_object_array(object, NULL, &extra_edge_obj);
|
add_object_array(object, NULL, &extra_edge_obj);
|
||||||
}
|
}
|
||||||
/* make sure commit traversal conforms to client */
|
/* make sure commit traversal conforms to client */
|
||||||
register_shallow(get_object_hash(*object));
|
register_shallow(object->oid.hash);
|
||||||
}
|
}
|
||||||
packet_flush(1);
|
packet_flush(1);
|
||||||
} else
|
} else
|
||||||
if (shallows.nr > 0) {
|
if (shallows.nr > 0) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < shallows.nr; i++)
|
for (i = 0; i < shallows.nr; i++)
|
||||||
register_shallow(get_object_hash(*shallows.objects[i].item));
|
register_shallow(shallows.objects[i].item->oid.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
shallow_nr += shallows.nr;
|
shallow_nr += shallows.nr;
|
||||||
|
8
walker.c
8
walker.c
@ -78,7 +78,7 @@ static int process_commit(struct walker *walker, struct commit *commit)
|
|||||||
if (commit->object.flags & COMPLETE)
|
if (commit->object.flags & COMPLETE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hashcpy(current_commit_sha1, get_object_hash(commit->object));
|
hashcpy(current_commit_sha1, commit->object.oid.hash);
|
||||||
|
|
||||||
walker_say(walker, "walk %s\n", oid_to_hex(&commit->object.oid));
|
walker_say(walker, "walk %s\n", oid_to_hex(&commit->object.oid));
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ static int process(struct walker *walker, struct object *obj)
|
|||||||
else {
|
else {
|
||||||
if (obj->flags & COMPLETE)
|
if (obj->flags & COMPLETE)
|
||||||
return 0;
|
return 0;
|
||||||
walker->prefetch(walker, get_object_hash(*obj));
|
walker->prefetch(walker, obj->oid.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
object_list_insert(obj, process_queue_end);
|
object_list_insert(obj, process_queue_end);
|
||||||
@ -170,13 +170,13 @@ static int loop(struct walker *walker)
|
|||||||
* the queue because we needed to fetch it first.
|
* the queue because we needed to fetch it first.
|
||||||
*/
|
*/
|
||||||
if (! (obj->flags & TO_SCAN)) {
|
if (! (obj->flags & TO_SCAN)) {
|
||||||
if (walker->fetch(walker, get_object_hash(*obj))) {
|
if (walker->fetch(walker, obj->oid.hash)) {
|
||||||
report_missing(obj);
|
report_missing(obj);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!obj->type)
|
if (!obj->type)
|
||||||
parse_object(get_object_hash(*obj));
|
parse_object(obj->oid.hash);
|
||||||
if (process_object(walker, obj))
|
if (process_object(walker, obj))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1347,7 +1347,7 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
|
|||||||
(!hashcmp(cb.nsha1, sha1) ||
|
(!hashcmp(cb.nsha1, sha1) ||
|
||||||
/* perhaps sha1 is a tag, try to dereference to a commit */
|
/* perhaps sha1 is a tag, try to dereference to a commit */
|
||||||
((commit = lookup_commit_reference_gently(sha1, 1)) != NULL &&
|
((commit = lookup_commit_reference_gently(sha1, 1)) != NULL &&
|
||||||
!hashcmp(cb.nsha1, get_object_hash(commit->object))))) {
|
!hashcmp(cb.nsha1, commit->object.oid.hash)))) {
|
||||||
const char *from = ref;
|
const char *from = ref;
|
||||||
if (!skip_prefix(from, "refs/tags/", &from))
|
if (!skip_prefix(from, "refs/tags/", &from))
|
||||||
skip_prefix(from, "refs/remotes/", &from);
|
skip_prefix(from, "refs/remotes/", &from);
|
||||||
|
Loading…
Reference in New Issue
Block a user