git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git status: do not require write permission
@ 2010-01-20  0:06 Johannes Schindelin
  2010-01-20  0:28 ` Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2010-01-20  0:06 UTC (permalink / raw)
  To: git; +Cc: gitster


Today, git status played violin on my nerves for the very last time.
There is no good reason, really none, for git status to require
write permissions.  If the index is not up-to-date, so be it, I
cannot commit anyway.

But in most cases, the index _is_ up-to-date, and now I can tell
my fellow former users that their repository XYZ.git does not have any
uncommitted changes, so can they please delete it to free up some disk
space, thank you very much.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin-commit.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 55676fd..9eccc51 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -325,11 +325,13 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 	 * We still need to refresh the index here.
 	 */
 	if (!pathspec || !*pathspec) {
-		fd = hold_locked_index(&index_lock, 1);
-		refresh_cache_or_die(refresh_flags);
-		if (write_cache(fd, active_cache, active_nr) ||
-		    commit_locked_index(&index_lock))
-			die("unable to write new_index file");
+		fd = hold_locked_index(&index_lock, 0);
+		if (fd >= 0) {
+			refresh_cache_or_die(refresh_flags);
+			if (write_cache(fd, active_cache, active_nr) ||
+			    commit_locked_index(&index_lock))
+				die("unable to write new_index file");
+		}
 		commit_style = COMMIT_AS_IS;
 		return get_index_file();
 	}
-- 
1.6.4.297.gcb4cc

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-01-20  1:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-20  0:06 [PATCH] git status: do not require write permission Johannes Schindelin
2010-01-20  0:28 ` Jeff King
2010-01-20  0:35   ` Johannes Schindelin
2010-01-20  0:38     ` Johannes Schindelin
2010-01-20  0:39   ` Junio C Hamano
2010-01-20  1:09     ` Junio C Hamano
2010-01-20  1:23     ` Johannes Schindelin
2010-01-20  1:38       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).