diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-07-21 11:53:29 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-08-11 20:47:59 +0100 |
commit | e7fc8601ff9a68a5bfdc26e6073f7821b8f9b05c (patch) | |
tree | 52be5bf39f3e05b9329ccdd1a90e935a08513ad2 | |
parent | 45ddb58634820fece9aea6d758316f0939bf9da6 (diff) | |
download | libgit2-e7fc8601ff9a68a5bfdc26e6073f7821b8f9b05c.tar.gz |
filter: test that system attributes can be ignored
Test that we can optionally ignore system attributes when filtering a
blob.
-rw-r--r-- | tests/filter/systemattrs.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/filter/systemattrs.c b/tests/filter/systemattrs.c index bb3a4dac4..4996b3b1e 100644 --- a/tests/filter/systemattrs.c +++ b/tests/filter/systemattrs.c @@ -52,3 +52,30 @@ void test_filter_systemattrs__reads_system_attributes(void) git_buf_dispose(&buf); git_blob_free(blob); } + +void test_filter_systemattrs__disables_system_attributes(void) +{ + git_blob *blob; + git_buf buf = { 0 }; + git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT; + + opts.flags |= GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES; + + cl_git_pass(git_revparse_single( + (git_object **)&blob, g_repo, "799770d")); /* all-lf */ + + cl_assert_equal_s(ALL_LF_TEXT_RAW, git_blob_rawcontent(blob)); + + cl_git_pass(git_blob_filter(&buf, blob, "file.bin", &opts)); + cl_assert_equal_s(ALL_LF_TEXT_RAW, buf.ptr); + + /* No attributes mean these are all treated literally */ + cl_git_pass(git_blob_filter(&buf, blob, "file.crlf", &opts)); + cl_assert_equal_s(ALL_LF_TEXT_RAW, buf.ptr); + + cl_git_pass(git_blob_filter(&buf, blob, "file.lf", &opts)); + cl_assert_equal_s(ALL_LF_TEXT_RAW, buf.ptr); + + git_buf_dispose(&buf); + git_blob_free(blob); +} |