summaryrefslogtreecommitdiff
path: root/commit-tree.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2006-05-08 21:43:38 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-05-08 23:25:33 (GMT)
commit31fff305bcc6db3b8082eac7fc9e441b27964fea (patch)
tree1681e28441508afae3f3e1bf602c4b0914d9c820 /commit-tree.c
parentafb4ff206967c6b3e481994cc6d0d86139792169 (diff)
downloadgit-31fff305bcc6db3b8082eac7fc9e441b27964fea.zip
git-31fff305bcc6db3b8082eac7fc9e441b27964fea.tar.gz
git-31fff305bcc6db3b8082eac7fc9e441b27964fea.tar.bz2
Separate object name errors from usage errors
Separate object name errors from usage errors. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'commit-tree.c')
-rw-r--r--commit-tree.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/commit-tree.c b/commit-tree.c
index 2595850..0320036 100644
--- a/commit-tree.c
+++ b/commit-tree.c
@@ -91,15 +91,19 @@ int main(int argc, char **argv)
git_config(git_default_config);
- if (argc < 2 || get_sha1_hex(argv[1], tree_sha1) < 0)
+ if (argc < 2)
usage(commit_tree_usage);
+ if (get_sha1(argv[1], tree_sha1))
+ die("Not a valid object name %s", argv[1]);
check_valid(tree_sha1, tree_type);
for (i = 2; i < argc; i += 2) {
char *a, *b;
a = argv[i]; b = argv[i+1];
- if (!b || strcmp(a, "-p") || get_sha1(b, parent_sha1[parents]))
+ if (!b || strcmp(a, "-p"))
usage(commit_tree_usage);
+ if (get_sha1(b, parent_sha1[parents]))
+ die("Not a valid object name %s", b);
check_valid(parent_sha1[parents], commit_type);
if (new_parent(parents))
parents++;