summaryrefslogtreecommitdiff
path: root/tests/checkout/checkout_helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/checkout/checkout_helpers.c')
-rw-r--r--tests/checkout/checkout_helpers.c20
1 files changed, 20 insertions, 0 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));
+}