Created
August 24, 2011 10:22
-
-
Save kiryl/1167736 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct git_repository git_repository; | |
typedef struct git_reference git_reference; | |
extern int git__rethrow(int error, const char *, ...); | |
void git_path_join(char *buffer_out, const char *path_a, const char *path_b); | |
int git_reference_lookup(git_reference **reference_out, git_repository *repo, const char *name); | |
int git_reference_delete(git_reference *ref); | |
static int retrieve_tag_reference(git_reference **tag_reference_out, char *ref_name_out, git_repository *repo, const char *tag_name) | |
{ | |
git_reference *tag_ref; | |
int error; | |
git_path_join(ref_name_out, "refs/" "tags/", tag_name); | |
error = git_reference_lookup(&tag_ref, repo, ref_name_out); | |
if (error < 0) | |
return git__rethrow(error, "Failed to retrieve tag reference"); | |
*tag_reference_out = tag_ref; | |
return 0; | |
} | |
int git_tag_delete(git_repository *repo, const char *tag_name) | |
{ | |
int error; | |
git_reference *tag_ref; | |
char ref_name[1024]; | |
error = retrieve_tag_reference(&tag_ref, ref_name, repo, tag_name); | |
if (error < 0) | |
return git__rethrow(error, "Failed to delete tag"); | |
return git_reference_delete(tag_ref); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment