mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-22 21:00:02 +00:00
Merge pull request #2072 from ethomson/commit_summary
Summarize empty messages
This commit is contained in:
commit
e82b6d13d2
@ -311,7 +311,10 @@ const char *git_commit_summary(git_commit *commit)
|
|||||||
git_buf_putc(&summary, *msg);
|
git_buf_putc(&summary, *msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
commit->summary = git_buf_detach(&summary);
|
if (summary.asize == 0)
|
||||||
|
commit->summary = git__strdup("");
|
||||||
|
else
|
||||||
|
commit->summary = git_buf_detach(&summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
return commit->summary;
|
return commit->summary;
|
||||||
|
@ -72,4 +72,8 @@ void test_commit_commit__summary(void)
|
|||||||
assert_commit_summary("Trailing spaces are removed", "Trailing spaces are removed ");
|
assert_commit_summary("Trailing spaces are removed", "Trailing spaces are removed ");
|
||||||
assert_commit_summary("Trailing tabs", "Trailing tabs\t\n\nare removed");
|
assert_commit_summary("Trailing tabs", "Trailing tabs\t\n\nare removed");
|
||||||
assert_commit_summary("Trailing spaces", "Trailing spaces \n\nare removed");
|
assert_commit_summary("Trailing spaces", "Trailing spaces \n\nare removed");
|
||||||
|
assert_commit_summary("", "");
|
||||||
|
assert_commit_summary("", " ");
|
||||||
|
assert_commit_summary("", "\n");
|
||||||
|
assert_commit_summary("", "\n \n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user