1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-28 04:49:43 +01:00
git/t/t7524-commit-summary.sh
Patrick Steinhardt 12dfc2475c diffcore-break: fix leaking filespecs when merging broken pairs
When merging file pairs after they have been broken up we queue a new
file pair and discard the broken-up ones. The newly-queued file pair
reuses one filespec of the broken up pairs each, where the respective
other filespec gets discarded. But we only end up freeing the filespec's
data, not the filespec itself, and thus leak memory.

Fix these leaks by using `free_filespec()` instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-09-27 08:25:37 -07:00

33 lines
698 B
Bash
Executable file

#!/bin/sh
test_description='git commit summary'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
test_seq 101 200 >file &&
git add file &&
git commit -m initial &&
git tag initial
'
test_expect_success 'commit summary ignores rewrites' '
git reset --hard initial &&
test_seq 200 300 >file &&
git diff --stat >diffstat &&
git diff --stat --break-rewrites >diffstatrewrite &&
# make sure this scenario is a detectable rewrite
! test_cmp_bin diffstat diffstatrewrite &&
git add file &&
git commit -m second >actual &&
grep "1 file" <actual >actual.total &&
grep "1 file" <diffstat >diffstat.total &&
test_cmp diffstat.total actual.total
'
test_done