summaryrefslogtreecommitdiff
path: root/tests/worktree
diff options
context:
space:
mode:
authorSven Strickroth <email@cs-ware.de>2018-03-11 15:35:56 +0100
committerSven Strickroth <email@cs-ware.de>2018-03-27 19:04:05 +0200
commiteb0a3afdbfeca211b1db81dd85e3716fcd333206 (patch)
tree12a19272e1090af45557af34f5be6d835490cb53 /tests/worktree
parent2a11eaf3de0fd3fd4717ce72d489954a677f4ede (diff)
downloadlibgit2-eb0a3afdbfeca211b1db81dd85e3716fcd333206.tar.gz
worktree: Read worktree specific reflog for HEAD
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'tests/worktree')
-rw-r--r--tests/worktree/reflog.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/worktree/reflog.c b/tests/worktree/reflog.c
index 6152eb385..a68e72dcf 100644
--- a/tests/worktree/reflog.c
+++ b/tests/worktree/reflog.c
@@ -22,6 +22,32 @@ void test_worktree_reflog__cleanup(void)
cleanup_fixture_worktree(&fixture);
}
+void test_worktree_reflog__read_worktree_HEAD(void)
+{
+ git_reflog *reflog;
+ const git_reflog_entry *entry;
+
+ cl_git_pass(git_reflog_read(&reflog, fixture.worktree, "HEAD"));
+ cl_assert_equal_i(1, git_reflog_entrycount(reflog));
+
+ entry = git_reflog_entry_byindex(reflog, 0);
+ cl_assert(entry != NULL);
+ cl_assert_equal_s("checkout: moving from 099fabac3a9ea935598528c27f866e34089c2eff to testrepo-worktree", git_reflog_entry_message(entry));
+
+ git_reflog_free(reflog);
+}
+
+void test_worktree_reflog__read_parent_HEAD(void)
+{
+ git_reflog *reflog;
+
+ cl_git_pass(git_reflog_read(&reflog, fixture.repo, "HEAD"));
+ /* there is no logs/HEAD in the parent repo */
+ cl_assert_equal_i(0, git_reflog_entrycount(reflog));
+
+ git_reflog_free(reflog);
+}
+
void test_worktree_reflog__read(void)
{
git_reflog *reflog;