summaryrefslogtreecommitdiff
path: root/tests-clar/index/filemodes.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-24 10:11:20 -0700
committerRussell Belfer <rb@github.com>2013-09-24 10:11:20 -0700
commit634f10f69090b325a50c8bca6cb303397576305e (patch)
tree7728cd252fd6377749b593654d88d89270a66a73 /tests-clar/index/filemodes.c
parenta3c2d916d8ad67196d2211b0a88dcbab7a433764 (diff)
downloadlibgit2-634f10f69090b325a50c8bca6cb303397576305e.tar.gz
Fix incorrect return code in crlf filter
The git_buf_text_gather_stats call returns a boolean indicating if the file looks like binary data. That shouldn't be an error; it should be used to skip CRLF processing though.
Diffstat (limited to 'tests-clar/index/filemodes.c')
-rw-r--r--tests-clar/index/filemodes.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests-clar/index/filemodes.c b/tests-clar/index/filemodes.c
index e56a9c069..02f83efba 100644
--- a/tests-clar/index/filemodes.c
+++ b/tests-clar/index/filemodes.c
@@ -44,7 +44,8 @@ static void replace_file_with_mode(
cl_git_pass(p_rename(path.ptr, backup));
cl_git_write2file(
- path.ptr, content.ptr, O_WRONLY|O_CREAT|O_TRUNC, create_mode);
+ path.ptr, content.ptr, content.size,
+ O_WRONLY|O_CREAT|O_TRUNC, create_mode);
git_buf_free(&path);
git_buf_free(&content);
@@ -91,7 +92,7 @@ void test_index_filemodes__untrusted(void)
add_and_check_mode(index, "exec_on", GIT_FILEMODE_BLOB_EXECUTABLE);
/* 5 - add new 0644 -> expect 0644 */
- cl_git_write2file("filemodes/new_off", "blah",
+ 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);
@@ -100,7 +101,7 @@ void test_index_filemodes__untrusted(void)
*/
if (can_filemode) {
/* 6 - add 0755 -> expect 0755 */
- cl_git_write2file("filemodes/new_on", "blah",
+ 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);
}
@@ -140,12 +141,12 @@ void test_index_filemodes__trusted(void)
add_and_check_mode(index, "exec_on", GIT_FILEMODE_BLOB_EXECUTABLE);
/* 5 - add new 0644 -> expect 0644 */
- cl_git_write2file("filemodes/new_off", "blah",
+ 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 0755 -> expect 0755 */
- cl_git_write2file("filemodes/new_on", "blah",
+ 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);