summaryrefslogtreecommitdiff
path: root/tests/diff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-06-23 23:30:58 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2015-06-23 23:30:58 -0400
commitbd670abd23944a20c6a84978ea590c8fd4258cb2 (patch)
treedf51120cb908816edcc098da00c433b51f28fbf4 /tests/diff
parent8351abc7822c38f597bf0ee07f0f293a4f62b1f3 (diff)
parentbb4896f22c9199e88b25a47ee4389a7e778d9d7f (diff)
downloadlibgit2-bd670abd23944a20c6a84978ea590c8fd4258cb2.tar.gz
Merge pull request #3226 from libgit2/cmn/racy-diff-again
racy-git, the missing link
Diffstat (limited to 'tests/diff')
-rw-r--r--tests/diff/racy.c39
-rw-r--r--tests/diff/workdir.c2
2 files changed, 2 insertions, 39 deletions
diff --git a/tests/diff/racy.c b/tests/diff/racy.c
deleted file mode 100644
index a109f8c3b..000000000
--- a/tests/diff/racy.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "clar_libgit2.h"
-
-#include "buffer.h"
-
-static git_repository *g_repo;
-
-void test_diff_racy__initialize(void)
-{
- cl_git_pass(git_repository_init(&g_repo, "diff_racy", false));
-}
-
-void test_diff_racy__cleanup(void)
-{
- cl_git_sandbox_cleanup();
-}
-
-void test_diff_racy__diff(void)
-{
- git_index *index;
- git_diff *diff;
- git_buf path = GIT_BUF_INIT;
-
- cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(g_repo), "A"));
- cl_git_mkfile(path.ptr, "A");
-
- /* Put 'A' into the index */
- cl_git_pass(git_repository_index(&index, g_repo));
- cl_git_pass(git_index_add_bypath(index, "A"));
- cl_git_pass(git_index_write(index));
-
- cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, index, NULL));
- cl_assert_equal_i(0, git_diff_num_deltas(diff));
-
- /* Change its contents quickly, so we get the same timestamp */
- cl_git_mkfile(path.ptr, "B");
-
- cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, index, NULL));
- cl_assert_equal_i(1, git_diff_num_deltas(diff));
-}
diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c
index ecc556ce2..13de6a98b 100644
--- a/tests/diff/workdir.c
+++ b/tests/diff/workdir.c
@@ -1623,6 +1623,8 @@ void test_diff_workdir__can_update_index(void)
/* now if we do it again, we should see fewer OID calculations */
+ /* tick again as the index updating from the previous diff might have reset the timestamp */
+ tick_index(index);
basic_diff_status(&diff, &opts);
cl_git_pass(git_diff_get_perfdata(&perf, diff));