diff options
author | Russell Belfer <rb@github.com> | 2013-10-08 23:45:43 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-10-08 23:45:43 +0400 |
commit | 14997dc5f69e7ceebe502b32087d809a8482bf78 (patch) | |
tree | ff245ed60887dc4eddd3b3ea65e7dd215deeeb62 /tests-clar/index/filemodes.c | |
parent | 5173ea921d4ccbbe7d61ddce9a0920c2e1c82035 (diff) |
More filemode cleanups for FAT on MacOS
This cleans up some additional issues. The main change is that
on a filesystem that doesn't support mode bits, libgit2 will now
create new blobs with GIT_FILEMODE_BLOB always instead of being
at the mercy to the filesystem driver to report executable or not.
This means that if "core.filemode" lies and claims that filemode
is not supported, then we will ignore the executable bit from the
filesystem. Previously we would have allowed it.
This adds an option to the new git_repository_reset_filesystem to
recurse through submodules if desired. There may be other types
of APIs that would like a "recurse submodules" option, but this
one is particularly useful.
This also has a number of cleanups, etc., for related things
including trying to give better error messages when problems come
up from the filesystem. For example, the FAT filesystem driver on
MacOS appears to return errno EINVAL if you attempt to write a
filename with invalid UTF-8 in it. We try to capture that with a
better error message now.
Diffstat (limited to 'tests-clar/index/filemodes.c')
-rw-r--r-- | tests-clar/index/filemodes.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/tests-clar/index/filemodes.c b/tests-clar/index/filemodes.c index 8cbd6ff3a..013932696 100644 --- a/tests-clar/index/filemodes.c +++ b/tests-clar/index/filemodes.c @@ -74,7 +74,6 @@ static void add_and_check_mode_( void test_index_filemodes__untrusted(void) { git_index *index; - bool can_filemode = cl_is_chmod_supported(); cl_repo_set_bool(g_repo, "core.filemode", false); @@ -97,20 +96,15 @@ void test_index_filemodes__untrusted(void) replace_file_with_mode("exec_on", "filemodes/exec_on.1", 0755); add_and_check_mode(index, "exec_on", GIT_FILEMODE_BLOB_EXECUTABLE); - /* these tests of newly added files won't give predictable results on - * filesystems without actual filemode support, so skip them. - */ - if (can_filemode) { - /* 5 - add new 0644 -> expect 0644 */ - cl_git_write2file("filemodes/new_off", "blah", 0, - O_WRONLY | O_CREAT | O_TRUNC, 0644); - add_and_check_mode(index, "new_off", GIT_FILEMODE_BLOB); - - /* 6 - add new 0755 -> expect 0755 */ - cl_git_write2file("filemodes/new_on", "blah", 0, - O_WRONLY | O_CREAT | O_TRUNC, 0755); - add_and_check_mode(index, "new_on", GIT_FILEMODE_BLOB_EXECUTABLE); - } + /* 5 - add new 0644 -> expect 0644 */ + cl_git_write2file("filemodes/new_off", "blah", 0, + O_WRONLY | O_CREAT | O_TRUNC, 0644); + add_and_check_mode(index, "new_off", GIT_FILEMODE_BLOB); + + /* 6 - add new 0755 -> expect 0644 if core.filemode == false */ + cl_git_write2file("filemodes/new_on", "blah", 0, + O_WRONLY | O_CREAT | O_TRUNC, 0755); + add_and_check_mode(index, "new_on", GIT_FILEMODE_BLOB); git_index_free(index); } |