Skip to content

Commit

Permalink
fast-import: Cleanup mode setting.
Browse files Browse the repository at this point in the history
"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 <felipe.contreras@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed Jan 14, 2009
1 parent 8faea4f commit 3d1d81e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1868,12 +1868,13 @@ static void file_change_m(struct branch *b)
if (!p)
die("Corrupt mode: %s", command_buf.buf);
switch (mode) {
case 0644:
case 0755:
mode |= S_IFREG;
case S_IFREG | 0644:
case S_IFREG | 0755:
case S_IFLNK:
case S_IFGITLINK:
case 0644:
case 0755:
/* ok */
break;
default:
Expand Down Expand Up @@ -1940,7 +1941,7 @@ static void file_change_m(struct branch *b)
typename(type), command_buf.buf);
}

tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode, NULL);
tree_content_set(&b->branch_tree, p, sha1, mode, NULL);
}

static void file_change_d(struct branch *b)
Expand Down

0 comments on commit 3d1d81e

Please sign in to comment.