mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-04 23:54:09 +00:00
Remove GIT_SIGNATURE_VERSION and friends
This commit is contained in:
parent
2da619abde
commit
de70aea6b1
@ -151,15 +151,11 @@ typedef struct git_time {
|
||||
|
||||
/** An action signature (e.g. for committers, taggers, etc) */
|
||||
typedef struct git_signature {
|
||||
unsigned int version;
|
||||
char *name; /** full name of the author */
|
||||
char *email; /** email of the author */
|
||||
git_time when; /** time when the action happened */
|
||||
} git_signature;
|
||||
|
||||
#define GIT_SIGNATURE_VERSION 1
|
||||
#define GIT_SIGNATURE_INIT {GIT_SIGNATURE_VERSION, 0}
|
||||
|
||||
/** In-memory representation of a reference. */
|
||||
typedef struct git_reference git_reference;
|
||||
|
||||
|
@ -93,8 +93,6 @@ int git_commit_create(
|
||||
git_odb *odb;
|
||||
|
||||
assert(git_object_owner((const git_object *)tree) == repo);
|
||||
GITERR_CHECK_VERSION(author, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
GITERR_CHECK_VERSION(committer, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
|
||||
git_oid__writebuf(&commit, "tree ", git_object_id((const git_object *)tree));
|
||||
|
||||
|
@ -456,9 +456,6 @@ int git_note_create(
|
||||
git_commit *commit = NULL;
|
||||
git_tree *tree = NULL;
|
||||
|
||||
GITERR_CHECK_VERSION(author, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
GITERR_CHECK_VERSION(committer, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
|
||||
target = git_oid_allocfmt(oid);
|
||||
GITERR_CHECK_ALLOC(target);
|
||||
|
||||
@ -486,9 +483,6 @@ int git_note_remove(git_repository *repo, const char *notes_ref,
|
||||
git_commit *commit = NULL;
|
||||
git_tree *tree = NULL;
|
||||
|
||||
GITERR_CHECK_VERSION(author, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
GITERR_CHECK_VERSION(committer, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
|
||||
target = git_oid_allocfmt(oid);
|
||||
GITERR_CHECK_ALLOC(target);
|
||||
|
||||
|
@ -112,7 +112,6 @@ static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
|
||||
|
||||
entry->committer = git__malloc(sizeof(git_signature));
|
||||
GITERR_CHECK_ALLOC(entry->committer);
|
||||
entry->committer->version = GIT_SIGNATURE_VERSION;
|
||||
|
||||
if (git_oid_fromstrn(&entry->oid_old, buf, GIT_OID_HEXSZ) < 0)
|
||||
goto fail;
|
||||
@ -298,8 +297,6 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid,
|
||||
|
||||
assert(reflog && new_oid && committer);
|
||||
|
||||
GITERR_CHECK_VERSION(committer, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
|
||||
if (reflog_entry_new(&entry) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -90,7 +90,6 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
|
||||
|
||||
p = git__calloc(1, sizeof(git_signature));
|
||||
GITERR_CHECK_ALLOC(p);
|
||||
p->version = GIT_SIGNATURE_VERSION;
|
||||
|
||||
if (process_trimming(name, &p->name, name + strlen(name), 1) < 0 ||
|
||||
process_trimming(email, &p->email, email + strlen(email), 1) < 0)
|
||||
@ -264,9 +263,8 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
|
||||
const char *buffer = *buffer_out;
|
||||
const char *line_end, *name_end, *email_end, *tz_start, *time_start;
|
||||
int error = 0;
|
||||
git_signature initsig = GIT_SIGNATURE_INIT;
|
||||
|
||||
memmove(sig, &initsig, sizeof(git_signature));
|
||||
memset(sig, 0, sizeof(git_signature));
|
||||
|
||||
if ((line_end = memchr(buffer, ender, buffer_end - buffer)) == NULL)
|
||||
return signature_error("no newline given");
|
||||
|
@ -523,8 +523,6 @@ int git_stash_save(
|
||||
|
||||
assert(out && repo && stasher);
|
||||
|
||||
GITERR_CHECK_VERSION(stasher, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
|
||||
if ((error = ensure_non_bare_repository(repo)) < 0)
|
||||
return error;
|
||||
|
||||
|
@ -244,8 +244,6 @@ static int git_tag_create__internal(
|
||||
assert(repo && tag_name && target);
|
||||
assert(!create_tag_annotation || (tagger && message));
|
||||
|
||||
GITERR_CHECK_VERSION(tagger, GIT_SIGNATURE_VERSION, "git_signature");
|
||||
|
||||
if (git_object_owner(target) != repo) {
|
||||
giterr_set(GITERR_INVALID, "The given target does not belong to this repository");
|
||||
return -1;
|
||||
|
@ -149,7 +149,7 @@ void test_commit_parse__signature(void)
|
||||
{
|
||||
const char *str = passcase->string;
|
||||
size_t len = strlen(passcase->string);
|
||||
struct git_signature person = GIT_SIGNATURE_INIT;
|
||||
struct git_signature person = {0};
|
||||
cl_git_pass(git_signature__parse(&person, &str, str + len, passcase->header, '\n'));
|
||||
cl_assert(strcmp(passcase->name, person.name) == 0);
|
||||
cl_assert(strcmp(passcase->email, person.email) == 0);
|
||||
@ -162,7 +162,7 @@ void test_commit_parse__signature(void)
|
||||
{
|
||||
const char *str = failcase->string;
|
||||
size_t len = strlen(failcase->string);
|
||||
git_signature person = GIT_SIGNATURE_INIT;
|
||||
git_signature person = {0};
|
||||
cl_git_fail(git_signature__parse(&person, &str, str + len, failcase->header, '\n'));
|
||||
git__free(person.name); git__free(person.email);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user