diff options
author | Vicent Martà <vicent@github.com> | 2013-10-09 04:03:12 +0400 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-10-09 04:03:12 +0400 |
commit | 95c148b2c772b5f97e0db60bff089d8fa944971c (patch) | |
tree | 18695995886b76a7c7e4e3fc0447bdfe7300bc63 /src/index.c | |
parent | 062c95c2a9265cab8039c02a978944cd672017e5 (diff) | |
parent | 867f7c9b3329952dc0aebf9770019a7a01ff2691 (diff) |
Merge pull request #1886 from libgit2/precompose-utf8
Add support for core.precomposeunicode on Mac
Diffstat (limited to 'src/index.c')
-rw-r--r-- | src/index.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/index.c b/src/index.c index c923f1675..5cdd40aaa 100644 --- a/src/index.c +++ b/src/index.c @@ -580,7 +580,8 @@ const git_index_entry *git_index_get_bypath( return git_index_get_byindex(index, pos); } -void git_index_entry__init_from_stat(git_index_entry *entry, struct stat *st) +void git_index_entry__init_from_stat( + git_index_entry *entry, struct stat *st, bool trust_mode) { entry->ctime.seconds = (git_time_t)st->st_ctime; entry->mtime.seconds = (git_time_t)st->st_mtime; @@ -588,7 +589,8 @@ void git_index_entry__init_from_stat(git_index_entry *entry, struct stat *st) /* entry->ctime.nanoseconds = st->st_ctimensec; */ entry->dev = st->st_rdev; entry->ino = st->st_ino; - entry->mode = index_create_mode(st->st_mode); + entry->mode = (!trust_mode && S_ISREG(st->st_mode)) ? + index_create_mode(0666) : index_create_mode(st->st_mode); entry->uid = st->st_uid; entry->gid = st->st_gid; entry->file_size = st->st_size; @@ -632,7 +634,7 @@ static int index_entry_init( entry = git__calloc(1, sizeof(git_index_entry)); GITERR_CHECK_ALLOC(entry); - git_index_entry__init_from_stat(entry, &st); + git_index_entry__init_from_stat(entry, &st, !index->distrust_filemode); entry->oid = oid; entry->path = git__strdup(rel_path); |