git/list[1] front-page[2] threads[3] people[4] search[5] about
 

filemode=false somewhat broken

From
JRJuergen Ruehle <j.ruehle@bmiag.de>
Date
Nov 22, 2006, 20:02 UTC
Message-ID
<17764.44236.473000.729015@lapjr.intranet.kiel.bmiag.de>

Commit fd28b34afd9bbd58297a25edced3f504c9a5487a tried to ignore the executable bit if filemode=false, but instead forced all files to be regular with 644 permission bits nuking symlink support. The attached diff works better for me, but note that I'm completely posix agnostic.

Unfortunately there still seems to be another problem somewhere: files merged by octopus (wanted to try one, too, after the recent discussions on the list:-) lose the x bits in the process. But as usual I'm not smart enough to find the problem:-(

diff --git a/builtin-update-index.c b/builtin-update-index.c
index 7f9c638..f4b4bc4 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -112,13 +112,13 @@ static int add_file_to_cache(const char
 	ce->ce_mode = create_ce_mode(st.st_mode);
 	if (!trust_executable_bit) {
 		/* If there is an existing entry, pick the mode bits
-		 * from it, otherwise force to 644.
+		 * from it, otherwise use mask 666.
 		 */
 		int pos = cache_name_pos(path, namelen);
 		if (0 <= pos)
 			ce->ce_mode = active_cache[pos]->ce_mode;
 		else
-			ce->ce_mode = create_ce_mode(S_IFREG | 0644);
+			ce->ce_mode = create_ce_mode((S_IFMT | 0666) & st.st_mode);
 	}
 
 	if (index_path(ce->sha1, path, &st, !info_only))
diff --git a/read-cache.c b/read-cache.c
index 97c3867..6cbbecf 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -347,13 +347,13 @@ int add_file_to_index(const char *path,
 	ce->ce_mode = create_ce_mode(st.st_mode);
 	if (!trust_executable_bit) {
 		/* If there is an existing entry, pick the mode bits
-		 * from it, otherwise force to 644.
+		 * from it, otherwise use mask 666.
 		 */
 		int pos = cache_name_pos(path, namelen);
 		if (pos >= 0)
 			ce->ce_mode = active_cache[pos]->ce_mode;
 		else
-			ce->ce_mode = create_ce_mode(S_IFREG | 0644);
+			ce->ce_mode = create_ce_mode((S_IFMT | 0666) & st.st_mode);
 	}
 
 	if (index_path(ce->sha1, path, &st, 1))
-- 
1.4.4.g540c
Next: Junio C Hamano
Message 1 of 3 in “filemode=false somewhat broken”
  1. Juergen RuehleNov 22, 2006
  2. Junio C HamanoNov 22, 2006
  3. Shawn PearceNov 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.