summaryrefslogtreecommitdiff
path: root/update-cache.c
diff options
context:
space:
mode:
authorPetr Baudis <pasky@ucw.cz>2005-04-13 09:28:48 (GMT)
committerPetr Baudis <xpasky@machine>2005-04-13 09:28:48 (GMT)
commit2de381f919829aec1e35d6c7cc33519295dcd053 (patch)
tree3f703cd0cd32a4aa9892bda84c664c36e40f7921 /update-cache.c
parentbdd4da595a265a091a859754a22688f7351cddee (diff)
downloadgit-2de381f919829aec1e35d6c7cc33519295dcd053.zip
git-2de381f919829aec1e35d6c7cc33519295dcd053.tar.gz
git-2de381f919829aec1e35d6c7cc33519295dcd053.tar.bz2
[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 'update-cache.c')
-rw-r--r--update-cache.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/update-cache.c b/update-cache.c
index d08e895..8fcf07a 100644
--- a/update-cache.c
+++ b/update-cache.c
@@ -249,14 +249,14 @@ int main(int argc, char **argv)
newfd = open(".git/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
if (newfd < 0)
- usage("unable to create new cachefile");
+ die("unable to create new cachefile");
atexit(remove_lock_file);
remove_lock = 1;
entries = read_cache();
if (entries < 0)
- usage("cache corrupted");
+ die("cache corrupted");
for (i = 1 ; i < argc; i++) {
char *path = argv[i];
@@ -278,18 +278,18 @@ int main(int argc, char **argv)
refresh_cache();
continue;
}
- usage("unknown option %s", path);
+ die("unknown option %s", path);
}
if (!verify_path(path)) {
fprintf(stderr, "Ignoring path %s\n", argv[i]);
continue;
}
if (add_file_to_cache(path))
- usage("Unable to add %s to database", path);
+ die("Unable to add %s to database", path);
}
if (write_cache(newfd, active_cache, active_nr) ||
rename(".git/index.lock", ".git/index"))
- usage("Unable to write new cachefile");
+ die("Unable to write new cachefile");
remove_lock = 0;
return 0;