summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2015-11-10 02:22:27 (GMT)
committerJeff King <peff@peff.net>2015-11-20 13:02:05 (GMT)
commit7999b2cf772956466baa8925491d6fb1b0963292 (patch)
tree34a3bf75c3cdc621d732107f53181ff28c0550a4 /builtin/commit.c
parent3c4270107fec2c1d85b7b1a6f8b0aeebf3193b28 (diff)
downloadgit-7999b2cf772956466baa8925491d6fb1b0963292.zip
git-7999b2cf772956466baa8925491d6fb1b0963292.tar.gz
git-7999b2cf772956466baa8925491d6fb1b0963292.tar.bz2
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 dca09e2..795f9d2 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);