On Sun, Oct 12, 2008 at 12:49:00AM -0400, Jeff King wrote:BTW, in case anybody is interested, here is the patch. Like I said, I think we are better off with an alternative to "status", but maybe this is useful to somebody anyway. --- diff --git a/builtin-commit.c b/builtin-commit.c index b01ad9f..8951364 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -217,7 +217,8 @@ static void create_base_index(void) exit(128); /* We've already reported the error, finish dying */ } -static char *prepare_index(int argc, const char **argv, const char *prefix) +static char *prepare_index(int argc, const char **argv, const char *prefix, + int status_only) { int fd; struct string_list partial; @@ -270,7 +271,13 @@ static char *prepare_index(int argc, const char **argv, const char *prefix) * We still need to refresh the index here. */ if (!pathspec || !*pathspec) { - fd = hold_locked_index(&index_lock, 1); + fd = hold_locked_index(&index_lock, 0); + if (fd < 0) { + if (!status_only) + die("unable to lock index: %s", + strerror(errno)); + return get_index_file(); + } refresh_cache(REFRESH_QUIET); if (write_cache(fd, active_cache, active_nr) || commit_locked_index(&index_lock)) @@ -869,7 +876,7 @@ int cmd_status(int argc, const char **argv, const char *prefix) argc = parse_and_validate_options(argc, argv, builtin_status_usage, prefix); - index_file = prepare_index(argc, argv, prefix); + index_file = prepare_index(argc, argv, prefix, 1); commitable = run_status(stdout, index_file, prefix, 0); @@ -953,7 +960,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) argc = parse_and_validate_options(argc, argv, builtin_commit_usage, prefix); - index_file = prepare_index(argc, argv, prefix); + index_file = prepare_index(argc, argv, prefix, 0); /* Set up everything for writing the commit object. This includes running hooks, writing the trees, and interacting with the user. */ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Alexander Sulfrian | [RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set |
| Junio C Hamano | Re: Rss produced by git is not valid xml? |
