From 40aaae88adfe05be435b7bd17093d49869f3276f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 12 Aug 2006 01:03:47 -0700 Subject: 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 --- builtin-rm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'builtin-rm.c') diff --git a/builtin-rm.c b/builtin-rm.c index 8af3d7eb48..593d86744c 100644 --- a/builtin-rm.c +++ b/builtin-rm.c @@ -52,9 +52,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) git_config(git_default_config); - newfd = hold_lock_file_for_update(&lock_file, get_index_file()); - if (newfd < 0) - die("unable to create new index file"); + newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1); if (read_cache() < 0) die("index file corrupt"); -- cgit v1.2.1