summaryrefslogtreecommitdiff
path: root/builtin-update-index.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-08-12 01:03:47 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-08-12 17:08:25 -0700
commit40aaae88adfe05be435b7bd17093d49869f3276f (patch)
treecbc2c6410884604c15a4301841b23e658cf2096a /builtin-update-index.c
parentgit-am: give better diagnostics when the patch does not apply during --3way (diff)
downloadtgif-40aaae88adfe05be435b7bd17093d49869f3276f.tar.xz
Better error message when we are unable to lock the index file
Most of the callers except the one in refs.c use the function to update the index file. Among the index writers, everybody except write-tree dies if they cannot open it for writing. This gives the function an extra argument, to tell it to die when it cannot create a new file as the lockfile. The only caller that does not have to die is write-tree, because updating the index for the cache-tree part is optional and not being able to do so does not affect the correctness. I think we do not have to be so careful and make the failure into die() the same way as other callers, but that would be a different patch. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-update-index.c')
-rw-r--r--builtin-update-index.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 24dca47d8d..d2556f376b 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -491,9 +491,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
/* We can't free this memory, it becomes part of a linked list parsed atexit() */
lock_file = xcalloc(1, sizeof(struct lock_file));
- newfd = hold_lock_file_for_update(lock_file, get_index_file());
- if (newfd < 0)
- die("unable to create new cachefile");
+ newfd = hold_lock_file_for_update(lock_file, get_index_file(), 1);
entries = read_cache();
if (entries < 0)