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:
authornulltoken <emeric.fermas@gmail.com>2013-02-22 18:25:06 +0400
committernulltoken <emeric.fermas@gmail.com>2013-02-22 18:25:59 +0400
commit9ccab8dfb86bb75c8810ad490b3713c0fa052b01 (patch)
tree0b451d0c161e327ce79d9d06125dde540ef9c688 /tests-clar/stash
parent39bcb4deb816573b8f68154f90288ad1e21e1520 (diff)
stash: Update the reference when dropping the topmost stash
Diffstat (limited to 'tests-clar/stash')
-rw-r--r--tests-clar/stash/drop.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests-clar/stash/drop.c b/tests-clar/stash/drop.c
index 548addaca..1eb42c029 100644
--- a/tests-clar/stash/drop.c
+++ b/tests-clar/stash/drop.c
@@ -137,3 +137,36 @@ void test_stash_drop__dropping_the_last_entry_removes_the_stash(void)
cl_git_fail_with(
git_reference_lookup(&stash, repo, GIT_REFS_STASH_FILE), GIT_ENOTFOUND);
}
+
+void retrieve_top_stash_id(git_oid *out)
+{
+ git_object *top_stash;
+
+ cl_git_pass(git_revparse_single(&top_stash, repo, "stash@{0}"));
+ cl_git_pass(git_reference_name_to_id(out, repo, GIT_REFS_STASH_FILE));
+
+ cl_assert_equal_i(true, git_oid_cmp(out, git_object_id(top_stash)) == 0);
+
+ git_object_free(top_stash);
+}
+
+void test_stash_drop__dropping_the_top_stash_updates_the_stash_reference(void)
+{
+ git_object *next_top_stash;
+ git_oid oid;
+
+ push_three_states();
+
+ retrieve_top_stash_id(&oid);
+
+ cl_git_pass(git_revparse_single(&next_top_stash, repo, "stash@{1}"));
+ cl_assert_equal_i(
+ false, git_oid_cmp(&oid, git_object_id(next_top_stash)) == 0);
+
+ cl_git_pass(git_stash_drop(repo, 0));
+
+ retrieve_top_stash_id(&oid);
+
+ cl_assert_equal_i(
+ true, git_oid_cmp(&oid, git_object_id(next_top_stash)) == 0);
+}