зеркало из https://github.com/microsoft/git.git
test-lib functions: add --author support to test_commit
Add support for --author to "test_commit". This will simplify some current and future tests, one of those is being changed here. Let's also line-wrap the "git commit" command invocation to make diffs that add subsequent options easier to add, as they'll only need to add a new option line. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
76b8b8d05c
Коммит
999cfc4f45
|
@ -18,11 +18,8 @@ message_body () {
|
||||||
}
|
}
|
||||||
|
|
||||||
test_expect_success '-C option copies authorship and message' '
|
test_expect_success '-C option copies authorship and message' '
|
||||||
echo "Initial" >foo &&
|
test_commit --author Frigate\ \<flying@over.world\> \
|
||||||
git add foo &&
|
"Initial Commit" foo Initial Initial &&
|
||||||
test_tick &&
|
|
||||||
git commit -m "Initial Commit" --author Frigate\ \<flying@over.world\> &&
|
|
||||||
git tag Initial &&
|
|
||||||
echo "Test 1" >>foo &&
|
echo "Test 1" >>foo &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git commit -a -C Initial &&
|
git commit -a -C Initial &&
|
||||||
|
|
|
@ -185,6 +185,8 @@ debug () {
|
||||||
# Do not call test_tick before making a commit
|
# Do not call test_tick before making a commit
|
||||||
# --signoff
|
# --signoff
|
||||||
# Invoke "git commit" with --signoff
|
# Invoke "git commit" with --signoff
|
||||||
|
# --author=<author>
|
||||||
|
# Invoke "git commit" with --author=<author>
|
||||||
#
|
#
|
||||||
# This will commit a file with the given contents and the given commit
|
# This will commit a file with the given contents and the given commit
|
||||||
# message, and tag the resulting commit with the given tag name.
|
# message, and tag the resulting commit with the given tag name.
|
||||||
|
@ -193,6 +195,7 @@ debug () {
|
||||||
|
|
||||||
test_commit () {
|
test_commit () {
|
||||||
notick= &&
|
notick= &&
|
||||||
|
author= &&
|
||||||
signoff= &&
|
signoff= &&
|
||||||
indir= &&
|
indir= &&
|
||||||
while test $# != 0
|
while test $# != 0
|
||||||
|
@ -201,6 +204,10 @@ test_commit () {
|
||||||
--notick)
|
--notick)
|
||||||
notick=yes
|
notick=yes
|
||||||
;;
|
;;
|
||||||
|
--author)
|
||||||
|
author="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--signoff)
|
--signoff)
|
||||||
signoff="$1"
|
signoff="$1"
|
||||||
;;
|
;;
|
||||||
|
@ -222,7 +229,9 @@ test_commit () {
|
||||||
then
|
then
|
||||||
test_tick
|
test_tick
|
||||||
fi &&
|
fi &&
|
||||||
git ${indir:+ -C "$indir"} commit $signoff -m "$1" &&
|
git ${indir:+ -C "$indir"} commit \
|
||||||
|
${author:+ --author "$author"} \
|
||||||
|
$signoff -m "$1" &&
|
||||||
git ${indir:+ -C "$indir"} tag "${4:-$1}"
|
git ${indir:+ -C "$indir"} tag "${4:-$1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче