Skip to content

Commit

Permalink
Merge branch 'pr/6657' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ethomson committed Dec 14, 2023
2 parents 2d744e9 + 85c4edf commit 82d4414
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/libgit2/signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ static bool contains_angle_brackets(const char *input)
static bool is_crud(unsigned char c)
{
return c <= 32 ||
c == '.' ||
c == ',' ||
c == ':' ||
c == ';' ||
Expand Down
9 changes: 8 additions & 1 deletion tests/libgit2/commit/signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ void test_commit_signature__leading_and_trailing_spaces_are_trimmed(void)
assert_name_and_email("nulltoken", "emeric.fermas@gmail.com", " \t nulltoken \n", " \n emeric.fermas@gmail.com \n");
}

void test_commit_signature__leading_and_trailing_dots_are_supported(void)
{
assert_name_and_email(".nulltoken", ".emeric.fermas@gmail.com", ".nulltoken", ".emeric.fermas@gmail.com");
assert_name_and_email("nulltoken.", "emeric.fermas@gmail.com.", "nulltoken.", "emeric.fermas@gmail.com.");
assert_name_and_email(".nulltoken.", ".emeric.fermas@gmail.com.", ".nulltoken.", ".emeric.fermas@gmail.com.");
}

void test_commit_signature__leading_and_trailing_crud_is_trimmed(void)
{
assert_name_and_email("nulltoken", "emeric.fermas@gmail.com", "\"nulltoken\"", "\"emeric.fermas@gmail.com\"");
assert_name_and_email("nulltoken w", "emeric.fermas@gmail.com", "nulltoken w.", "emeric.fermas@gmail.com");
assert_name_and_email("nulltoken w", "emeric.fermas@gmail.com", "nulltoken w;", "emeric.fermas@gmail.com");
assert_name_and_email("nulltoken \xe2\x98\xba", "emeric.fermas@gmail.com", "nulltoken \xe2\x98\xba", "emeric.fermas@gmail.com");
}

Expand Down

0 comments on commit 82d4414

Please sign in to comment.