shithub: riscv

Download patch

ref: a3cbab3dc2fd16ddbed40ecbe1d884e0bb4988f7
parent: a15863b8ae23a26a2f825daf6107ab92e53c2669
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;