[PATCH] git status: do not require write permission

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 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

--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]