Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
builtin/commit-tree: convert to struct object_id
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 5 Sep 2016 20:08:10 +0000
(20:08 +0000)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 7 Sep 2016 19:59:43 +0000
(12:59 -0700)
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit-tree.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
8c88769
)
diff --git
a/builtin/commit-tree.c
b/builtin/commit-tree.c
index 8a674bc9e759116a06f7464222ec591472b65610..605017261c38dea1f5ada18c7d5b12446d6ea44f 100644
(file)
--- 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;
{
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);
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")) {
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 (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]);
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;
}
continue;
}
@@
-105,7
+105,7
@@
int cmd_commit_tree(int argc, const char **argv, const char *prefix)
continue;
}
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");
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");
}
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;
}
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;
}
strbuf_release(&buffer);
return 0;
}