summaryrefslogtreecommitdiff
path: root/tests/apply/both.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-03-20 14:28:25 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2021-04-28 13:03:33 +0100
commitdbc03de479eec4f96ce3273bf76f49daccbeb496 (patch)
tree0ada4cf3ec1b92175b20d7be13082d1b468eba97 /tests/apply/both.c
parentdc1ba018289aa40e1948a5fbb673652f86170677 (diff)
downloadlibgit2-dbc03de479eec4f96ce3273bf76f49daccbeb496.tar.gz
apply: ensure we validate paths
There was no test ensuring that we validate `.git` paths. We do, but let's add a test to make sure that we never regress this.
Diffstat (limited to 'tests/apply/both.c')
-rw-r--r--tests/apply/both.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/apply/both.c b/tests/apply/both.c
index 400df5e38..108963270 100644
--- a/tests/apply/both.c
+++ b/tests/apply/both.c
@@ -734,3 +734,14 @@ void test_apply_both__cant_remove_file_twice(void)
git_diff_free(diff);
}
+
+void test_apply_both__cant_add_invalid_filename(void)
+{
+ git_diff *diff;
+
+ cl_git_pass(git_diff_from_buffer(&diff, DIFF_ADD_INVALID_FILENAME,
+ strlen(DIFF_ADD_INVALID_FILENAME)));
+ cl_git_fail(git_apply(repo, diff, GIT_APPLY_LOCATION_BOTH, NULL));
+
+ git_diff_free(diff);
+}