summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2015-11-10 02:22:27 +0000
committerLibravatar Jeff King <peff@peff.net>2015-11-20 08:02:05 -0500
commit7999b2cf772956466baa8925491d6fb1b0963292 (patch)
tree34a3bf75c3cdc621d732107f53181ff28c0550a4 /builtin/commit.c
parentobject: introduce get_object_hash macro. (diff)
downloadtgif-7999b2cf772956466baa8925491d6fb1b0963292.tar.xz
Add several uses of get_object_hash.
Convert most instances where the sha1 member of struct object is dereferenced to use get_object_hash. Most instances that are passed to functions that have versions taking struct object_id, such as get_sha1_hex/get_oid_hex, or instances that can be trivially converted to use struct object_id instead, are not converted. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index dca09e2c3b..795f9d24f2 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -299,7 +299,7 @@ static void create_base_index(const struct commit *current_head)
opts.dst_index = &the_index;
opts.fn = oneway_merge;
- tree = parse_tree_indirect(current_head->object.sha1);
+ tree = parse_tree_indirect(get_object_hash(current_head->object));
if (!tree)
die(_("failed to unpack HEAD tree object"));
parse_tree(tree);
@@ -1766,7 +1766,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
if (!transaction ||
ref_transaction_update(transaction, "HEAD", sha1,
current_head
- ? current_head->object.sha1 : null_sha1,
+ ? get_object_hash(current_head->object) : null_sha1,
0, sb.buf, &err) ||
ref_transaction_commit(transaction, &err)) {
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");
if (cfg) {
/* we are amending, so current_head is not NULL */
- copy_note_for_rewrite(cfg, current_head->object.sha1, sha1);
+ copy_note_for_rewrite(cfg, get_object_hash(current_head->object), sha1);
finish_copy_notes_for_rewrite(cfg, "Notes added by 'git commit --amend'");
}
- run_rewrite_hook(current_head->object.sha1, sha1);
+ run_rewrite_hook(get_object_hash(current_head->object), sha1);
}
if (!quiet)
print_summary(prefix, sha1, !current_head);