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:
authorRussell Belfer <rb@github.com>2013-09-24 21:11:20 +0400
committerRussell Belfer <rb@github.com>2013-09-24 21:11:20 +0400
commit634f10f69090b325a50c8bca6cb303397576305e (patch)
tree7728cd252fd6377749b593654d88d89270a66a73 /tests-clar/diff
parenta3c2d916d8ad67196d2211b0a88dcbab7a433764 (diff)
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/diff')
-rw-r--r--tests-clar/diff/workdir.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests-clar/diff/workdir.c b/tests-clar/diff/workdir.c
index c7fac1e48..6c17b41c6 100644
--- a/tests-clar/diff/workdir.c
+++ b/tests-clar/diff/workdir.c
@@ -1266,3 +1266,28 @@ void test_diff_workdir__untracked_directory_comes_last(void)
git_diff_list_free(diff);
}
+
+void test_diff_workdir__untracked_with_bom(void)
+{
+ git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
+ git_diff_list *diff = NULL;
+ const git_diff_delta *delta;
+
+ g_repo = cl_git_sandbox_init("empty_standard_repo");
+ cl_repo_set_bool(g_repo, "core.autocrlf", true);
+
+ cl_git_write2file("empty_standard_repo/bom.txt",
+ "\xFF\xFE\x31\x00\x32\x00\x33\x00\x34\x00", 10, O_WRONLY|O_CREAT, 0664);
+
+ opts.flags =
+ GIT_DIFF_INCLUDE_UNTRACKED | GIT_DIFF_INCLUDE_UNTRACKED_CONTENT;
+
+ cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
+
+ cl_assert_equal_i(1, git_diff_num_deltas(diff));
+ cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 0));
+ cl_assert_equal_i(GIT_DELTA_UNTRACKED, delta->status);
+ cl_assert((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
+
+ git_diff_list_free(diff);
+}