git: 9front

Download patch

ref: cec5b46f2803be968f3e1ad38501181c039e2fc7
parent: fba714a4e6425c9dd1e5a52c0716f53bb2589da7
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Oct 15 13:09:20 EDT 2023

git/walk, git/save: be less restrictive about permission matching

Files will inherit permissions from the parent directory, which
means that a file will show different permissons depending on
where they get checked out. Showing that the file has been
modified this case is technically correct but confusing.

Since git only stores the exec bit, we should only check the
owner exec bit when checking files in and out of git.

--- a/sys/src/cmd/git/save.c
+++ b/sys/src/cmd/git/save.c
@@ -34,7 +34,7 @@
 		return 0160000;
 	else if(e->mode & DMDIR)
 		return 0040000;
-	else if(e->mode & 0111)
+	else if(e->mode & 0100)
 		return 0100755;
 	else
 		return 0100644;
--- a/sys/src/cmd/git/walk.c
+++ b/sys/src/cmd/git/walk.c
@@ -187,7 +187,7 @@
 	db = dirfstat(fb);
 	if(da == nil || db == nil)
 		goto mismatch;
-	if(da->mode != db->mode)
+	if((da->mode&0100) != (db->mode&0100))
 		goto mismatch;
 	if(da->length != db->length)
 		goto mismatch;
--