mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 15:33:51 +00:00
Don't scale diff stat when not needed
This commit is contained in:
parent
b1914c3651
commit
ce3b71d91b
@ -284,6 +284,8 @@ int git_diff_stats_to_buf(
|
||||
if (width < STATS_FULL_MIN_SCALE)
|
||||
width = STATS_FULL_MIN_SCALE;
|
||||
}
|
||||
if (width > stats->max_filestat)
|
||||
width = 0;
|
||||
|
||||
for (i = 0; i < stats->files_changed; ++i) {
|
||||
if ((delta = git_diff_get_delta(stats->diff, i)) == NULL)
|
||||
|
@ -54,6 +54,10 @@ void test_diff_stats__stat(void)
|
||||
cl_git_pass(git_diff_stats_to_buf(&buf, _stats, GIT_DIFF_STATS_FULL, 0));
|
||||
cl_assert(strcmp(git_buf_cstr(&buf), stat) == 0);
|
||||
git_buf_free(&buf);
|
||||
|
||||
cl_git_pass(git_diff_stats_to_buf(&buf, _stats, GIT_DIFF_STATS_FULL, 80));
|
||||
cl_assert(strcmp(git_buf_cstr(&buf), stat) == 0);
|
||||
git_buf_free(&buf);
|
||||
}
|
||||
|
||||
void test_diff_stats__multiple_hunks(void)
|
||||
|
Loading…
Reference in New Issue
Block a user