Commit f3564e1e by nulltoken Committed by Vicent Marti

Fix tag reference name in testrepo.git

The git test repository was holding a wrongly named tag reference ("very-simple") pointing at a tag named "e90810b".
This mistake (mine :-/ ) originates back to https://github.com/libgit2/libgit2/commit/9282e92

Whole credit goes to @tclem for having spotted this.
parent d69d0185
......@@ -177,7 +177,7 @@ BEGIN_TEST(write2, "Attempt to write a tag bearing the same name than an already
must_fail(git_tag_create(
&tag_id, /* out id */
repo,
"very-simple",
"e90810b",
&target_id,
GIT_OBJ_COMMIT,
tagger,
......@@ -199,7 +199,7 @@ BEGIN_TEST(write3, "Replace an already existing tag")
git_oid_mkstr(&target_id, tagged_commit);
must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/very-simple"));
must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/e90810b"));
git_oid_cpy(&old_tag_id, git_reference_oid(ref_tag));
/* create signature */
......@@ -209,7 +209,7 @@ BEGIN_TEST(write3, "Replace an already existing tag")
must_pass(git_tag_create_f(
&tag_id, /* out id */
repo,
"very-simple",
"e90810b",
&target_id,
GIT_OBJ_COMMIT,
tagger,
......@@ -217,7 +217,7 @@ BEGIN_TEST(write3, "Replace an already existing tag")
git_signature_free((git_signature *)tagger);
must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/very-simple"));
must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/e90810b"));
must_be_true(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
must_be_true(git_oid_cmp(git_reference_oid(ref_tag), &old_tag_id) != 0);
......@@ -231,9 +231,9 @@ BEGIN_TEST(write4, "Delete an already existing tag")
must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
must_pass(git_tag_delete(repo,"very-simple"));
must_pass(git_tag_delete(repo,"e90810b"));
must_fail(git_reference_lookup(&ref_tag, repo, "refs/tags/very-simple"));
must_fail(git_reference_lookup(&ref_tag, repo, "refs/tags/e90810b"));
close_temp_repo(repo);
......
......@@ -27,13 +27,14 @@
#include "repository.h"
static const char *loose_tag_ref_name = "refs/tags/test";
static const char *loose_tag_ref_name = "refs/tags/e90810b";
static const char *non_existing_tag_ref_name = "refs/tags/i-do-not-exist";
BEGIN_TEST(readtag0, "lookup a loose tag reference")
git_repository *repo;
git_reference *reference;
git_object *object;
char ref_name_from_tag_name[MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH];
must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
......@@ -46,6 +47,10 @@ BEGIN_TEST(readtag0, "lookup a loose tag reference")
must_be_true(object != NULL);
must_be_true(git_object_type(object) == GIT_OBJ_TAG);
/* Ensure the name of the tag matches the name of the reference */
git__joinpath(ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object));
must_be_true(strcmp(ref_name_from_tag_name, loose_tag_ref_name) == 0);
git_repository_free(repo);
END_TEST
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment