summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Forster <brendan@github.com>2015-03-29 10:12:59 +0200
committerBrendan Forster <brendan@github.com>2015-03-30 09:13:30 +0200
commitccf8b2c173f2c5c11857cb026ee4d6a882a72b29 (patch)
treeb1f93d8c8b5eabdd34d8db7c82d6728af4a960f9
parentde355f234174df291c9c40378da70114c3ba6c5d (diff)
downloadlibgit2-ccf8b2c173f2c5c11857cb026ee4d6a882a72b29.tar.gz
added failing test against demo repository
-rw-r--r--tests/diff/workdir.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c
index 963be9481..af20b628a 100644
--- a/tests/diff/workdir.c
+++ b/tests/diff/workdir.c
@@ -1694,3 +1694,34 @@ void test_diff_workdir__binary_detection(void)
git_index_free(idx);
git_buf_free(&b);
}
+
+
+void test_diff_workdir__cpp_file_changed(void)
+{
+ const char *a_commit = "1107ceab8176a";
+ static char *str0 [] = { "MD5FileHash.cpp" };
+
+ git_diff *diff = NULL;
+ git_tree *a;
+ diff_expects exp;
+
+ g_repo = cl_git_sandbox_init("issue_3020");
+
+ a = resolve_commit_oid_to_tree(g_repo, a_commit);
+
+ git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
+
+ opts.pathspec.strings = str0; opts.pathspec.count = ARRAY_SIZE(str0);
+
+ opts.flags = GIT_DIFF_INCLUDE_UNTRACKED
+ | GIT_DIFF_RECURSE_UNTRACKED_DIRS;
+
+ cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, a, &opts));
+
+ cl_git_pass(git_diff_foreach(
+ diff, diff_file_cb, diff_hunk_cb, diff_line_cb, &exp));
+
+ cl_assert_equal_i(1, exp.files);
+
+ git_diff_free(diff);
+} \ No newline at end of file