summaryrefslogtreecommitdiff
path: root/ls-tree.c
diff options
context:
space:
mode:
authorPetr Baudis <pasky@ucw.cz>2005-04-13 02:28:48 -0700
committerPetr Baudis <xpasky@machine>2005-04-13 02:28:48 -0700
commit2de381f919829aec1e35d6c7cc33519295dcd053 (patch)
tree3f703cd0cd32a4aa9892bda84c664c36e40f7921 /ls-tree.c
parentbdd4da595a265a091a859754a22688f7351cddee (diff)
downloadgit-2de381f919829aec1e35d6c7cc33519295dcd053.tar.gz
[PATCH] Consolidate the error handling
Now there is error() for "library" errors and die() for fatal "application" errors. usage() is now used strictly only for usage errors. Signed-off-by: Petr Baudis <pasky@ucw.cz>
Diffstat (limited to 'ls-tree.c')
-rw-r--r--ls-tree.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ls-tree.c b/ls-tree.c
index 05c743ab6a..102b12555b 100644
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -13,9 +13,9 @@ static int list(unsigned char *sha1)
buffer = read_sha1_file(sha1, type, &size);
if (!buffer)
- usage("unable to read sha1 file");
+ die("unable to read sha1 file");
if (strcmp(type, "tree"))
- usage("expected a 'tree' node");
+ die("expected a 'tree' node");
while (size) {
int len = strlen(buffer)+1;
unsigned char *sha1 = buffer + len;
@@ -24,7 +24,7 @@ static int list(unsigned char *sha1)
unsigned char *type;
if (size < len + 20 || sscanf(buffer, "%o", &mode) != 1)
- usage("corrupt 'tree' file");
+ die("corrupt 'tree' file");
buffer = sha1 + 20;
size -= len + 20;
/* XXX: We do some ugly mode heuristics here.
@@ -48,6 +48,6 @@ int main(int argc, char **argv)
if (!sha1_file_directory)
sha1_file_directory = DEFAULT_DB_ENVIRONMENT;
if (list(sha1) < 0)
- usage("list failed");
+ die("list failed");
return 0;
}