diff --git a/include/git2/types.h b/include/git2/types.h index d83b1d14b..06fcf3613 100644 --- a/include/git2/types.h +++ b/include/git2/types.h @@ -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; diff --git a/src/commit.c b/src/commit.c index f9606dd72..4072518ff 100644 --- a/src/commit.c +++ b/src/commit.c @@ -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)); diff --git a/src/notes.c b/src/notes.c index 71a9e33ad..f96b5b139 100644 --- a/src/notes.c +++ b/src/notes.c @@ -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); diff --git a/src/reflog.c b/src/reflog.c index c0af60f49..ac481fb81 100644 --- a/src/reflog.c +++ b/src/reflog.c @@ -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; diff --git a/src/signature.c b/src/signature.c index 008b13120..7d043e6cf 100644 --- a/src/signature.c +++ b/src/signature.c @@ -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"); diff --git a/src/stash.c b/src/stash.c index 14b48a595..e32d8fa31 100644 --- a/src/stash.c +++ b/src/stash.c @@ -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; diff --git a/src/tag.c b/src/tag.c index c3b3319fb..606afd657 100644 --- a/src/tag.c +++ b/src/tag.c @@ -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; diff --git a/tests-clar/commit/parse.c b/tests-clar/commit/parse.c index 37e38db53..8075f2619 100644 --- a/tests-clar/commit/parse.c +++ b/tests-clar/commit/parse.c @@ -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); }