Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/index/filemodes.c')
-rw-r--r--tests-clar/index/filemodes.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests-clar/index/filemodes.c b/tests-clar/index/filemodes.c
index 02f83efba..013932696 100644
--- a/tests-clar/index/filemodes.c
+++ b/tests-clar/index/filemodes.c
@@ -51,24 +51,29 @@ static void replace_file_with_mode(
git_buf_free(&content);
}
-static void add_and_check_mode(
- git_index *index, const char *filename, unsigned int expect_mode)
+#define add_and_check_mode(I,F,X) add_and_check_mode_(I,F,X,__FILE__,__LINE__)
+
+static void add_and_check_mode_(
+ git_index *index, const char *filename, unsigned int expect_mode,
+ const char *file, int line)
{
size_t pos;
const git_index_entry *entry;
cl_git_pass(git_index_add_bypath(index, filename));
- cl_assert(!git_index_find(&pos, index, filename));
+ clar__assert(!git_index_find(&pos, index, filename),
+ file, line, "Cannot find index entry", NULL, 1);
entry = git_index_get_byindex(index, pos);
- cl_assert(entry->mode == expect_mode);
+
+ clar__assert_equal(file, line, "Expected mode does not match index",
+ 1, "%07o", (unsigned int)entry->mode, (unsigned int)expect_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);
@@ -96,15 +101,10 @@ void test_index_filemodes__untrusted(void)
O_WRONLY | O_CREAT | O_TRUNC, 0644);
add_and_check_mode(index, "new_off", GIT_FILEMODE_BLOB);
- /* this test won't give predictable results on a platform
- * that doesn't support filemodes correctly, so skip it.
- */
- if (can_filemode) {
- /* 6 - add 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);
- }
+ /* 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);
}