summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-07-21 16:25:41 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2019-08-11 21:32:03 +0100
commitcdbbb364828428fd7d44cca2df01ae14ee0a3d16 (patch)
tree9f658a9c92ebfb64044859d702a30c0dbdf24031
parentff25ec83562bf0a2aa714cd6296c93fe6cce3c36 (diff)
downloadlibgit2-ethomson/attrs_from_head.tar.gz
filter: test second-level in-repo `.gitattributes`ethomson/attrs_from_head
Ensure that a `.gitattributes` file that is deeper in the tree is honored, not just an attributes file at the root.
-rw-r--r--tests/filter/bare.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/filter/bare.c b/tests/filter/bare.c
index 495e04e17..430931ee8 100644
--- a/tests/filter/bare.c
+++ b/tests/filter/bare.c
@@ -80,6 +80,29 @@ void test_filter_bare__from_lf(void)
git_blob_free(blob);
}
+void test_filter_bare__nested_attributes(void)
+{
+ git_blob *blob;
+ git_buf buf = { 0 };
+
+ 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, "raw/file.bin", &filter_opts));
+ cl_assert_equal_s(ALL_LF_TEXT_RAW, buf.ptr);
+
+ cl_git_pass(git_blob_filter(&buf, blob, "raw/file.crlf", &filter_opts));
+ cl_assert_equal_s(ALL_LF_TEXT_RAW, buf.ptr);
+
+ cl_git_pass(git_blob_filter(&buf, blob, "raw/file.lf", &filter_opts));
+ cl_assert_equal_s(ALL_LF_TEXT_RAW, buf.ptr);
+
+ git_buf_dispose(&buf);
+ git_blob_free(blob);
+}
+
void test_filter_bare__sanitizes(void)
{
git_blob *blob;