mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
![Ævar Arnfjörð Bjarmason](/assets/img/avatar_default.png)
Clear the "boundary_commits" object_array in release_revisions(). This makes a few more tests pass under SANITIZE=leak, including "t/t4126-apply-empty.sh" which started failed as an UNLEAK() in cmd_format_patch() was removed in a preceding commit. This also re-marks the various tests relying on "git format-patch" as passing under "SANITIZE=leak", in the preceding "revisions API users: use release_revisions() in builtin/log.c" commit those were marked as failing as we removed the UNLEAK(rev) from cmd_format_patch() in "builtin/log.c". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
143 lines
2.8 KiB
Bash
Executable file
143 lines
2.8 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2006 Brian C Gernhardt
|
|
#
|
|
|
|
test_description='Format-patch numbering options'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
|
|
echo A > file &&
|
|
git add file &&
|
|
git commit -m First &&
|
|
|
|
echo B >> file &&
|
|
git commit -a -m Second &&
|
|
|
|
echo C >> file &&
|
|
git commit -a -m Third
|
|
|
|
'
|
|
|
|
# Each of these gets used multiple times.
|
|
|
|
test_num_no_numbered() {
|
|
cnt=$(grep "^Subject: \[PATCH\]" $1 | wc -l) &&
|
|
test $cnt = $2
|
|
}
|
|
|
|
test_single_no_numbered() {
|
|
test_num_no_numbered $1 1
|
|
}
|
|
|
|
test_no_numbered() {
|
|
test_num_no_numbered $1 2
|
|
}
|
|
|
|
test_single_cover_letter_numbered() {
|
|
grep "^Subject: \[PATCH 0/1\]" $1 &&
|
|
grep "^Subject: \[PATCH 1/1\]" $1
|
|
}
|
|
|
|
test_single_numbered() {
|
|
grep "^Subject: \[PATCH 1/1\]" $1
|
|
}
|
|
|
|
test_numbered() {
|
|
grep "^Subject: \[PATCH 1/2\]" $1 &&
|
|
grep "^Subject: \[PATCH 2/2\]" $1
|
|
}
|
|
|
|
test_expect_success 'single patch defaults to no numbers' '
|
|
git format-patch --stdout HEAD~1 >patch0.single &&
|
|
test_single_no_numbered patch0.single
|
|
'
|
|
|
|
test_expect_success 'multiple patch defaults to numbered' '
|
|
|
|
git format-patch --stdout HEAD~2 >patch0.multiple &&
|
|
test_numbered patch0.multiple
|
|
|
|
'
|
|
|
|
test_expect_success 'Use --numbered' '
|
|
|
|
git format-patch --numbered --stdout HEAD~1 >patch1 &&
|
|
test_single_numbered patch1
|
|
|
|
'
|
|
|
|
test_expect_success 'format.numbered = true' '
|
|
|
|
git config format.numbered true &&
|
|
git format-patch --stdout HEAD~2 >patch2 &&
|
|
test_numbered patch2
|
|
|
|
'
|
|
|
|
test_expect_success 'format.numbered && single patch' '
|
|
|
|
git format-patch --stdout HEAD^ > patch3 &&
|
|
test_single_numbered patch3
|
|
|
|
'
|
|
|
|
test_expect_success 'format.numbered && --no-numbered' '
|
|
|
|
git format-patch --no-numbered --stdout HEAD~2 >patch4 &&
|
|
test_no_numbered patch4
|
|
|
|
'
|
|
|
|
test_expect_success 'format.numbered && --keep-subject' '
|
|
|
|
git format-patch --keep-subject --stdout HEAD^ >patch4a &&
|
|
grep "^Subject: Third" patch4a
|
|
|
|
'
|
|
|
|
test_expect_success 'format.numbered = auto' '
|
|
|
|
git config format.numbered auto &&
|
|
git format-patch --stdout HEAD~2 > patch5 &&
|
|
test_numbered patch5
|
|
|
|
'
|
|
|
|
test_expect_success 'format.numbered = auto && single patch' '
|
|
|
|
git format-patch --stdout HEAD^ > patch6 &&
|
|
test_single_no_numbered patch6
|
|
|
|
'
|
|
|
|
test_expect_success 'format.numbered = auto && --no-numbered' '
|
|
|
|
git format-patch --no-numbered --stdout HEAD~2 > patch7 &&
|
|
test_no_numbered patch7
|
|
|
|
'
|
|
|
|
test_expect_success '--start-number && --numbered' '
|
|
|
|
git format-patch --start-number 3 --numbered --stdout HEAD~1 > patch8 &&
|
|
grep "^Subject: \[PATCH 3/3\]" patch8
|
|
'
|
|
|
|
test_expect_success 'single patch with cover-letter defaults to numbers' '
|
|
git format-patch --cover-letter --stdout HEAD~1 >patch9.single &&
|
|
test_single_cover_letter_numbered patch9.single
|
|
'
|
|
|
|
test_expect_success 'Use --no-numbered and --cover-letter single patch' '
|
|
git format-patch --no-numbered --stdout --cover-letter HEAD~1 >patch10 &&
|
|
test_no_numbered patch10
|
|
'
|
|
|
|
|
|
|
|
test_done
|