Skip to content

Commit 3d1d81e

Browse files
felipecgitster
authored andcommitted
fast-import: Cleanup mode setting.
"S_IFREG | mode" makes only sense for 0644 and 0755. Even though doing (S_IFREG | mode) may not hurt when mode is any other supported value, that is only true because S_IFREG mode bit happens to be already on for S_IFLNK or S_IFGITLINK. Signed-off-by: Felipe Contreras <[email protected]> Acked-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8faea4f commit 3d1d81e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fast-import.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,12 +1868,13 @@ static void file_change_m(struct branch *b)
18681868
if (!p)
18691869
die("Corrupt mode: %s", command_buf.buf);
18701870
switch (mode) {
1871+
case 0644:
1872+
case 0755:
1873+
mode |= S_IFREG;
18711874
case S_IFREG | 0644:
18721875
case S_IFREG | 0755:
18731876
case S_IFLNK:
18741877
case S_IFGITLINK:
1875-
case 0644:
1876-
case 0755:
18771878
/* ok */
18781879
break;
18791880
default:
@@ -1940,7 +1941,7 @@ static void file_change_m(struct branch *b)
19401941
typename(type), command_buf.buf);
19411942
}
19421943

1943-
tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode, NULL);
1944+
tree_content_set(&b->branch_tree, p, sha1, mode, NULL);
19441945
}
19451946

19461947
static void file_change_d(struct branch *b)

0 commit comments

Comments
 (0)