Skip to content

Commit b0c7bb7

Browse files
committed
signature: we do want to accept empty names or emails
1 parent af79575 commit b0c7bb7

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/signature.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
6666
p->name = extract_trimmed(name, strlen(name));
6767
p->email = extract_trimmed(email, strlen(email));
6868

69-
if (p->name == NULL || p->email == NULL ||
70-
p->name[0] == '\0' || p->email[0] == '\0') {
71-
git_signature_free(p);
72-
return signature_error("Empty name or email");
73-
}
74-
7569
p->when.time = time;
7670
p->when.offset = offset;
7771

tests-clar/commit/signature.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ void test_commit_signature__angle_brackets_in_email_are_not_supported(void)
4949

5050
void test_commit_signature__create_empties(void)
5151
{
52-
// can not create a signature with empty name or email
52+
// can create a signature with empty name or email
5353
cl_git_pass(try_build_signature("nulltoken", "emeric.fermas@gmail.com", 1234567890, 60));
5454

55-
cl_git_fail(try_build_signature("", "emeric.fermas@gmail.com", 1234567890, 60));
56-
cl_git_fail(try_build_signature(" ", "emeric.fermas@gmail.com", 1234567890, 60));
57-
cl_git_fail(try_build_signature("nulltoken", "", 1234567890, 60));
58-
cl_git_fail(try_build_signature("nulltoken", " ", 1234567890, 60));
55+
cl_git_pass(try_build_signature("", "emeric.fermas@gmail.com", 1234567890, 60));
56+
cl_git_pass(try_build_signature(" ", "emeric.fermas@gmail.com", 1234567890, 60));
57+
cl_git_pass(try_build_signature("nulltoken", "", 1234567890, 60));
58+
cl_git_pass(try_build_signature("nulltoken", " ", 1234567890, 60));
5959
}
6060

6161
void test_commit_signature__create_one_char(void)
@@ -74,6 +74,6 @@ void test_commit_signature__create_zero_char(void)
7474
{
7575
// creating a zero character signature
7676
git_signature *sign;
77-
cl_git_fail(git_signature_new(&sign, "", "x@y.z", 1234567890, 60));
78-
cl_assert(sign == NULL);
77+
cl_git_pass(git_signature_new(&sign, "", "x@y.z", 1234567890, 60));
78+
cl_assert(sign != NULL);
7979
}

0 commit comments

Comments
 (0)