libgit2/tests/t0802-write.c
Vicent Marti 6fd195d76c Change git_repository initialization to use a path
The constructor to git_repository is now called

	'git_repository_open(path)'

and takes a path to a git repository instead of an existing ODB object.
Unit tests have been updated accordingly and the two test repositories
have been merged into one.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-11-02 18:42:42 +02:00

39 lines
809 B
C

#include "test_lib.h"
#include "test_helpers.h"
#include "commit.h"
#include <git/odb.h>
#include <git/tag.h>
#include <git/revwalk.h>
static const char *tag_id = "b25fa35b38051e4ae45d4222e795f9df2e43f1d1";
BEGIN_TEST(tag_writeback_test)
git_oid id;
git_repository *repo;
git_tag *tag;
/* char hex_oid[41]; */
repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id, tag_id);
tag = git_tag_lookup(repo, &id);
must_be_true(tag != NULL);
git_tag_set_name(tag, "This is a different tag LOL");
must_pass(git_object_write((git_object *)tag));
/*
git_oid_fmt(hex_oid, git_tag_id(tag));
hex_oid[40] = 0;
printf("TAG New SHA1: %s\n", hex_oid);
*/
must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)tag));
git_repository_free(repo);
END_TEST