summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2009-01-14 01:37:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-14 06:57:12 (GMT)
commit3d1d81eba29d5cfc5b214dc049b743ffbe032ef4 (patch)
tree32bdd4df2903dd3a8e864cf446624dd4d3429e53 /fast-import.c
parent8faea4f3b2f68a6ef168c6ada1627835380a570d (diff)
downloadgit-3d1d81eba29d5cfc5b214dc049b743ffbe032ef4.zip
git-3d1d81eba29d5cfc5b214dc049b743ffbe032ef4.tar.gz
git-3d1d81eba29d5cfc5b214dc049b743ffbe032ef4.tar.bz2
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 <felipe.contreras@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fast-import.c b/fast-import.c
index d58cca5..6d5ee6f 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -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:
@@ -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)