aboutsummaryrefslogtreecommitdiff
path: root/cat-file.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2006-05-09 01:43:38 +0400
committerJunio C Hamano <junkio@cox.net>2006-05-08 16:25:33 -0700
commit31fff305bcc6db3b8082eac7fc9e441b27964fea (patch)
tree1681e28441508afae3f3e1bf602c4b0914d9c820 /cat-file.c
parentafb4ff206967c6b3e481994cc6d0d86139792169 (diff)
downloadgit-31fff305bcc6db3b8082eac7fc9e441b27964fea.tar.gz
git-31fff305bcc6db3b8082eac7fc9e441b27964fea.tar.xz
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 'cat-file.c')
-rw-r--r--cat-file.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cat-file.c b/cat-file.c
index 628f6cada..7413feed7 100644
--- a/cat-file.c
+++ b/cat-file.c
@@ -103,8 +103,10 @@ int main(int argc, char **argv)
setup_git_directory();
git_config(git_default_config);
- if (argc != 3 || get_sha1(argv[2], sha1))
+ if (argc != 3)
usage("git-cat-file [-t|-s|-e|-p|<type>] <sha1>");
+ if (get_sha1(argv[2], sha1))
+ die("Not a valid object name %s", argv[2]);
opt = 0;
if ( argv[1][0] == '-' ) {
@@ -133,8 +135,7 @@ int main(int argc, char **argv)
return !has_sha1_file(sha1);
case 'p':
- if (get_sha1(argv[2], sha1) ||
- sha1_object_info(sha1, type, NULL))
+ if (sha1_object_info(sha1, type, NULL))
die("Not a valid object name %s", argv[2]);
/* custom pretty-print here */