const unsigned char *new_head, const char *msg)
{
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)
strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
* We ignore errors in 'gc --auto', since the
* user should see them.
*/
+ close_all_packs();
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
}
}
if (ref_exists(truname.buf)) {
strbuf_addf(msg,
"%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,
(early ? " (early part)" : ""));
strbuf_release(&truname);
desc = merge_remote_util(remote_head);
if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
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),
remote);
goto cleanup;
}
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:
strbuf_release(&buf);
strbuf_release(&bname);
second_token = lookup_commit_reference_gently(second_sha1, 0);
if (!second_token)
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 second_token;
die(_("%s - not something we can merge"), argv[0]);
if (remoteheads->next)
die(_("Can merge only exactly one commit into empty head"));
- read_empty(get_object_hash(remote_head->object), 0);
- update_ref("initial pull", "HEAD", get_object_hash(remote_head->object),
+ read_empty(remote_head->object.oid.hash, 0);
+ update_ref("initial pull", "HEAD", remote_head->object.oid.hash,
NULL, 0, UPDATE_REFS_DIE_ON_ERR);
goto done;
}
* additional safety measure to check for it.
*/
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.");
strbuf_addstr(&merge_msg, argv[0]);
head_arg = argv[1];
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) {
case 'G':
break;
for (p = remoteheads; p; p = p->next) {
struct commit *commit = p->item;
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);
strbuf_reset(&buf);
if (fast_forward != FF_ONLY &&
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);
if (remoteheads && !common)
goto done;
} else if (fast_forward != FF_NO && !remoteheads->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. */
struct strbuf msg = STRBUF_INIT;
struct commit *commit;
if (verbosity >= 0) {
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);
- find_unique_abbrev_r(to, get_object_hash(remoteheads->item->object),
+ find_unique_abbrev_r(to, remoteheads->item->object.oid.hash,
DEFAULT_ABBREV);
printf(_("Updating %s..%s\n"), from, to);
}
goto done;
}
- if (checkout_fast_forward(get_object_hash(head_commit->object),
- get_object_hash(commit->object),
+ if (checkout_fast_forward(head_commit->object.oid.hash,
+ commit->object.oid.hash,
overwrite_ignore)) {
ret = 1;
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();
goto done;
} else if (!remoteheads->next && common->next)
/* See if it is really trivial. */
git_committer_info(IDENT_STRICT);
printf(_("Trying really trivial in-index merge...\n"));
- if (!read_tree_trivial(get_object_hash(common->item->object),
- get_object_hash(head_commit->object),
- get_object_hash(remoteheads->item->object))) {
+ if (!read_tree_trivial(common->item->object.oid.hash,
+ head_commit->object.oid.hash,
+ remoteheads->item->object.oid.hash)) {
ret = merge_trivial(head_commit, remoteheads);
goto done;
}
* HEAD^^" would be missed.
*/
common_one = get_merge_bases(head_commit, j->item);
- if (hashcmp(get_object_hash(common_one->item->object),
- get_object_hash(j->item->object))) {
+ if (hashcmp(common_one->item->object.oid.hash,
+ j->item->object.oid.hash)) {
up_to_date = 0;
break;
}
int ret;
if (i) {
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)
printf(_("Trying merge strategy %s...\n"),
* it up.
*/
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)
fprintf(stderr,
_("No merge strategy handled the merge.\n"));
; /* We already have its result in the working tree. */
else {
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"),
best_strategy);
try_merge_strategy(best_strategy, common, remoteheads,