зеркало из https://github.com/microsoft/git.git
test-lib functions: add an --append option to test_commit
Add an --append option to test_commit to append <contents> to the <file> we're writing to. This simplifies a lot of test setup, as shown in some of the tests being changed here. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
999cfc4f45
Коммит
3373518cc8
|
@ -5,14 +5,8 @@ test_description='.mailmap configurations'
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup commits and contacts file' '
|
test_expect_success 'setup commits and contacts file' '
|
||||||
echo one >one &&
|
test_commit initial one one &&
|
||||||
git add one &&
|
test_commit --author "nick1 <bugs@company.xx>" --append second one two
|
||||||
test_tick &&
|
|
||||||
git commit -m initial &&
|
|
||||||
echo two >>one &&
|
|
||||||
git add one &&
|
|
||||||
test_tick &&
|
|
||||||
git commit --author "nick1 <bugs@company.xx>" -m second
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'check-mailmap no arguments' '
|
test_expect_success 'check-mailmap no arguments' '
|
||||||
|
@ -436,30 +430,11 @@ test_expect_success 'Shortlog output (complex mapping)' '
|
||||||
Santa Claus <santa.claus@northpole.xx> <me@company.xx>
|
Santa Claus <santa.claus@northpole.xx> <me@company.xx>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo three >>one &&
|
test_commit --author "nick2 <bugs@company.xx>" --append third one three &&
|
||||||
git add one &&
|
test_commit --author "nick2 <nick2@company.xx>" --append fourth one four &&
|
||||||
test_tick &&
|
test_commit --author "santa <me@company.xx>" --append fifth one five &&
|
||||||
git commit --author "nick2 <bugs@company.xx>" -m third &&
|
test_commit --author "claus <me@company.xx>" --append sixth one six &&
|
||||||
|
test_commit --author "CTO <cto@coompany.xx>" --append seventh one seven &&
|
||||||
echo four >>one &&
|
|
||||||
git add one &&
|
|
||||||
test_tick &&
|
|
||||||
git commit --author "nick2 <nick2@company.xx>" -m fourth &&
|
|
||||||
|
|
||||||
echo five >>one &&
|
|
||||||
git add one &&
|
|
||||||
test_tick &&
|
|
||||||
git commit --author "santa <me@company.xx>" -m fifth &&
|
|
||||||
|
|
||||||
echo six >>one &&
|
|
||||||
git add one &&
|
|
||||||
test_tick &&
|
|
||||||
git commit --author "claus <me@company.xx>" -m sixth &&
|
|
||||||
|
|
||||||
echo seven >>one &&
|
|
||||||
git add one &&
|
|
||||||
test_tick &&
|
|
||||||
git commit --author "CTO <cto@coompany.xx>" -m seventh &&
|
|
||||||
|
|
||||||
cat >expect <<-EOF &&
|
cat >expect <<-EOF &&
|
||||||
$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1):
|
$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1):
|
||||||
|
|
|
@ -183,6 +183,9 @@ debug () {
|
||||||
# Run all git commands in directory <dir>
|
# Run all git commands in directory <dir>
|
||||||
# --notick
|
# --notick
|
||||||
# Do not call test_tick before making a commit
|
# Do not call test_tick before making a commit
|
||||||
|
# --append
|
||||||
|
# Use "echo >>" instead of "echo >" when writing "<contents>" to
|
||||||
|
# "<file>"
|
||||||
# --signoff
|
# --signoff
|
||||||
# Invoke "git commit" with --signoff
|
# Invoke "git commit" with --signoff
|
||||||
# --author=<author>
|
# --author=<author>
|
||||||
|
@ -195,6 +198,7 @@ debug () {
|
||||||
|
|
||||||
test_commit () {
|
test_commit () {
|
||||||
notick= &&
|
notick= &&
|
||||||
|
append= &&
|
||||||
author= &&
|
author= &&
|
||||||
signoff= &&
|
signoff= &&
|
||||||
indir= &&
|
indir= &&
|
||||||
|
@ -204,6 +208,9 @@ test_commit () {
|
||||||
--notick)
|
--notick)
|
||||||
notick=yes
|
notick=yes
|
||||||
;;
|
;;
|
||||||
|
--append)
|
||||||
|
append=yes
|
||||||
|
;;
|
||||||
--author)
|
--author)
|
||||||
author="$2"
|
author="$2"
|
||||||
shift
|
shift
|
||||||
|
@ -223,7 +230,12 @@ test_commit () {
|
||||||
done &&
|
done &&
|
||||||
indir=${indir:+"$indir"/} &&
|
indir=${indir:+"$indir"/} &&
|
||||||
file=${2:-"$1.t"} &&
|
file=${2:-"$1.t"} &&
|
||||||
echo "${3-$1}" > "$indir$file" &&
|
if test -n "$append"
|
||||||
|
then
|
||||||
|
echo "${3-$1}" >>"$indir$file"
|
||||||
|
else
|
||||||
|
echo "${3-$1}" >"$indir$file"
|
||||||
|
fi &&
|
||||||
git ${indir:+ -C "$indir"} add "$file" &&
|
git ${indir:+ -C "$indir"} add "$file" &&
|
||||||
if test -z "$notick"
|
if test -z "$notick"
|
||||||
then
|
then
|
||||||
|
|
Загрузка…
Ссылка в новой задаче