diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-09-19 13:47:19 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-19 13:47:19 -0700 |
commit | 4af9a7d344b0e1c3b504c0cfb650dabdb1df1852 (patch) | |
tree | 243319fc09235a1e046ea94f40f7837ed9f02ea2 /builtin/commit-tree.c | |
parent | Merge branch 'mh/ref-store' (diff) | |
parent | builtin/reset: convert to use struct object_id (diff) | |
download | tgif-4af9a7d344b0e1c3b504c0cfb650dabdb1df1852.tar.xz |
Merge branch 'bc/object-id'
The "unsigned char sha1[20]" to "struct object_id" conversion
continues. Notable changes in this round includes that ce->sha1,
i.e. the object name recorded in the cache_entry, turns into an
object_id.
It had merge conflicts with a few topics in flight (Christian's
"apply.c split", Dscho's "cat-file --filters" and Jeff Hostetler's
"status --porcelain-v2"). Extra sets of eyes double-checking for
mismerges are highly appreciated.
* bc/object-id:
builtin/reset: convert to use struct object_id
builtin/commit-tree: convert to struct object_id
builtin/am: convert to struct object_id
refs: add an update_ref_oid function.
sha1_name: convert get_sha1_mb to struct object_id
builtin/update-index: convert file to struct object_id
notes: convert init_notes to use struct object_id
builtin/rm: convert to use struct object_id
builtin/blame: convert file to use struct object_id
Convert read_mmblob to take struct object_id.
notes-merge: convert struct notes_merge_pair to struct object_id
builtin/checkout: convert some static functions to struct object_id
streaming: make stream_blob_to_fd take struct object_id
builtin: convert textconv_object to use struct object_id
builtin/cat-file: convert some static functions to struct object_id
builtin/cat-file: convert struct expand_data to use struct object_id
builtin/log: convert some static functions to use struct object_id
builtin/blame: convert struct origin to use struct object_id
builtin/apply: convert static functions to struct object_id
cache: convert struct cache_entry to use struct object_id
Diffstat (limited to 'builtin/commit-tree.c')
-rw-r--r-- | builtin/commit-tree.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 8a674bc9e7..605017261c 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -40,8 +40,8 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) { int i, got_tree = 0; struct commit_list *parents = NULL; - unsigned char tree_sha1[20]; - unsigned char commit_sha1[20]; + struct object_id tree_oid; + struct object_id commit_oid; struct strbuf buffer = STRBUF_INIT; git_config(commit_tree_config, NULL); @@ -52,13 +52,13 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) for (i = 1; i < argc; i++) { const char *arg = argv[i]; if (!strcmp(arg, "-p")) { - unsigned char sha1[20]; + struct object_id oid; if (argc <= ++i) usage(commit_tree_usage); - if (get_sha1_commit(argv[i], sha1)) + if (get_sha1_commit(argv[i], oid.hash)) die("Not a valid object name %s", argv[i]); - assert_sha1_type(sha1, OBJ_COMMIT); - new_parent(lookup_commit(sha1), &parents); + assert_sha1_type(oid.hash, OBJ_COMMIT); + new_parent(lookup_commit(oid.hash), &parents); continue; } @@ -105,7 +105,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) continue; } - if (get_sha1_tree(arg, tree_sha1)) + if (get_sha1_tree(arg, tree_oid.hash)) die("Not a valid object name %s", arg); if (got_tree) die("Cannot give more than one trees"); @@ -117,13 +117,13 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) die_errno("git commit-tree: failed to read"); } - if (commit_tree(buffer.buf, buffer.len, tree_sha1, parents, - commit_sha1, NULL, sign_commit)) { + if (commit_tree(buffer.buf, buffer.len, tree_oid.hash, parents, + commit_oid.hash, NULL, sign_commit)) { strbuf_release(&buffer); return 1; } - printf("%s\n", sha1_to_hex(commit_sha1)); + printf("%s\n", oid_to_hex(&commit_oid)); strbuf_release(&buffer); return 0; } |