[PATCH 1/4] tree view: imitate proper permissions

Julius Plenz plenz at cis.fu-berlin.de
Tue Oct 30 14:07:15 CET 2012


Signed-off-by: Julius Plenz <plenz at cis.fu-berlin.de>
---
 ui-shared.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index 43166af..e1f6124 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -946,17 +946,20 @@ void cgit_print_pageheader(struct cgit_context *ctx)
 
 void cgit_print_filemode(unsigned short mode)
 {
-	if (S_ISDIR(mode))
+	unsigned short m = mode;
+	if (S_ISDIR(mode)) {
 		html("d");
-	else if (S_ISLNK(mode))
+		m = 0755;
+	} else if (S_ISLNK(mode)) {
 		html("l");
-	else if (S_ISGITLINK(mode))
+		m = 0777;
+	} else if (S_ISGITLINK(mode))
 		html("m");
 	else
 		html("-");
-	html_fileperm(mode >> 6);
-	html_fileperm(mode >> 3);
-	html_fileperm(mode);
+	html_fileperm(m >> 6);
+	html_fileperm(m >> 3);
+	html_fileperm(m);
 }
 
 void cgit_print_snapshot_links(const char *repo, const char *head,
-- 
1.7.12.3-zedat





More information about the CGit mailing list