Jeff King <peff@xxxxxxxx> writes: > 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); You would probably want to refresh_cache() here even if you are not going to write the resulting index out, so that you won't show the stat-only differences to the end user. Other than that, I think this is a good change. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html