Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-16 09:51:45 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-16 09:51:45 +0300
commite44abe16bd20512c76331e6889f390e35993153a (patch)
tree8a36e5be8f9a2c32d65a77796b919bbfcf77da07 /tests/checkout
parentc4e6ab5f23819c35dc0c1a0fd7f50e5a194f0d5a (diff)
tests: tick the index when we count OID calculations
These tests want to test that we don't recalculate entries which match the index already. This is however something we force when truncating racily-clean entries. Tick the index forward as we know that we don't perform the modifications which the racily-clean code is trying to avoid.
Diffstat (limited to 'tests/checkout')
-rw-r--r--tests/checkout/checkout_helpers.c20
-rw-r--r--tests/checkout/checkout_helpers.h2
-rw-r--r--tests/checkout/crlf.c19
3 files changed, 22 insertions, 19 deletions
diff --git a/tests/checkout/checkout_helpers.c b/tests/checkout/checkout_helpers.c
index 06b4e0682..c2e65b885 100644
--- a/tests/checkout/checkout_helpers.c
+++ b/tests/checkout/checkout_helpers.c
@@ -2,6 +2,7 @@
#include "checkout_helpers.h"
#include "refs.h"
#include "fileops.h"
+#include "index.h"
void assert_on_branch(git_repository *repo, const char *branch)
{
@@ -128,3 +129,22 @@ int checkout_count_callback(
return 0;
}
+
+void tick_index(git_index *index)
+{
+ git_time_t ts;
+ struct timespec times[2];
+
+ cl_assert(index->on_disk);
+ cl_assert(git_index_path(index));
+
+ cl_git_pass(git_index_read(index, true));
+ ts = index->stamp.mtime;
+
+ times[0].tv_sec = UTIME_OMIT; /* dont' change the atime */
+ times[0].tv_nsec = UTIME_OMIT; /* dont' change the atime */
+ times[1].tv_sec = ts + 1;
+ times[1].tv_nsec = 0;
+ cl_git_pass(p_utimensat(AT_FDCWD, git_index_path(index), times, 0));
+ cl_git_pass(git_index_read(index, true));
+}
diff --git a/tests/checkout/checkout_helpers.h b/tests/checkout/checkout_helpers.h
index 705ee903d..6058a196c 100644
--- a/tests/checkout/checkout_helpers.h
+++ b/tests/checkout/checkout_helpers.h
@@ -27,3 +27,5 @@ extern int checkout_count_callback(
const git_diff_file *target,
const git_diff_file *workdir,
void *payload);
+
+extern void tick_index(git_index *index);
diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c
index e0d94e79f..61459b3a4 100644
--- a/tests/checkout/crlf.c
+++ b/tests/checkout/crlf.c
@@ -32,25 +32,6 @@ void test_checkout_crlf__detect_crlf_autocrlf_false(void)
check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_RAW);
}
-static void tick_index(git_index *index)
-{
- git_time_t ts;
- struct timespec times[2];
-
- cl_assert(index->on_disk);
- cl_assert(git_index_path(index));
-
- cl_git_pass(git_index_read(index, true));
- ts = index->stamp.mtime;
-
- times[0].tv_sec = UTIME_OMIT; /* dont' change the atime */
- times[0].tv_nsec = UTIME_OMIT; /* dont' change the atime */
- times[1].tv_sec = ts + 1;
- times[1].tv_nsec = 0;
- cl_git_pass(p_utimensat(AT_FDCWD, git_index_path(index), times, 0));
- cl_git_pass(git_index_read(index, true));
-}
-
void test_checkout_crlf__autocrlf_false_index_size_is_unfiltered_size(void)
{
git_index *index;