add -p tests: remove PERL prerequisites

The Perl version of the add -i/-p commands has been removed since
20b813d (add: remove "add.interactive.useBuiltin" & Perl "git
add--interactive", 2023-02-07)

Therefore, Perl prerequisite in the test scripts which use the patch
mode functionality is not neccessary.

Signed-off-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Ghanshyam Thakkar 2024-02-13 05:35:30 +05:30 committed by Junio C Hamano
parent 5a8ed3fe45
commit 7abc1869e5
6 changed files with 27 additions and 39 deletions

View File

@ -113,7 +113,7 @@ test_expect_success 'checkout of branch from multiple remotes fails with advice'
test_grep ! "^hint: " stderr test_grep ! "^hint: " stderr
' '


test_expect_success PERL 'checkout -p with multiple remotes does not print advice' ' test_expect_success 'checkout -p with multiple remotes does not print advice' '
git checkout -B main && git checkout -B main &&
test_might_fail git branch -D foo && test_might_fail git branch -D foo &&



View File

@ -4,7 +4,7 @@ test_description='git restore --patch'


. ./lib-patch-mode.sh . ./lib-patch-mode.sh


test_expect_success PERL 'setup' ' test_expect_success 'setup' '
mkdir dir && mkdir dir &&
echo parent >dir/foo && echo parent >dir/foo &&
echo dummy >bar && echo dummy >bar &&
@ -16,28 +16,28 @@ test_expect_success PERL 'setup' '
save_head save_head
' '


test_expect_success PERL 'restore -p without pathspec is fine' ' test_expect_success 'restore -p without pathspec is fine' '
echo q >cmd && echo q >cmd &&
git restore -p <cmd git restore -p <cmd
' '


# note: bar sorts before dir/foo, so the first 'n' is always to skip 'bar' # note: bar sorts before dir/foo, so the first 'n' is always to skip 'bar'


test_expect_success PERL 'saying "n" does nothing' ' test_expect_success 'saying "n" does nothing' '
set_and_save_state dir/foo work head && set_and_save_state dir/foo work head &&
test_write_lines n n | git restore -p && test_write_lines n n | git restore -p &&
verify_saved_state bar && verify_saved_state bar &&
verify_saved_state dir/foo verify_saved_state dir/foo
' '


test_expect_success PERL 'git restore -p' ' test_expect_success 'git restore -p' '
set_and_save_state dir/foo work head && set_and_save_state dir/foo work head &&
test_write_lines n y | git restore -p && test_write_lines n y | git restore -p &&
verify_saved_state bar && verify_saved_state bar &&
verify_state dir/foo head head verify_state dir/foo head head
' '


test_expect_success PERL 'git restore -p with staged changes' ' test_expect_success 'git restore -p with staged changes' '
set_state dir/foo work index && set_state dir/foo work index &&
test_write_lines n y | git restore -p && test_write_lines n y | git restore -p &&
verify_saved_state bar && verify_saved_state bar &&
@ -46,7 +46,7 @@ test_expect_success PERL 'git restore -p with staged changes' '


for opt in "HEAD" "@" for opt in "HEAD" "@"
do do
test_expect_success PERL "git restore -p --source=$opt" ' test_expect_success "git restore -p --source=$opt" '
set_state dir/foo work index && set_state dir/foo work index &&
# the third n is to get out in case it mistakenly does not apply # the third n is to get out in case it mistakenly does not apply
test_write_lines n y n | git restore -p --source=$opt >output && test_write_lines n y n | git restore -p --source=$opt >output &&
@ -56,7 +56,7 @@ do
' '
done done


test_expect_success PERL 'git restore -p --source=HEAD^' ' test_expect_success 'git restore -p --source=HEAD^' '
set_state dir/foo work index && set_state dir/foo work index &&
# the third n is to get out in case it mistakenly does not apply # the third n is to get out in case it mistakenly does not apply
test_write_lines n y n | git restore -p --source=HEAD^ && test_write_lines n y n | git restore -p --source=HEAD^ &&
@ -64,7 +64,7 @@ test_expect_success PERL 'git restore -p --source=HEAD^' '
verify_state dir/foo parent index verify_state dir/foo parent index
' '


test_expect_success PERL 'git restore -p --source=HEAD^...' ' test_expect_success 'git restore -p --source=HEAD^...' '
set_state dir/foo work index && set_state dir/foo work index &&
# the third n is to get out in case it mistakenly does not apply # the third n is to get out in case it mistakenly does not apply
test_write_lines n y n | git restore -p --source=HEAD^... && test_write_lines n y n | git restore -p --source=HEAD^... &&
@ -72,7 +72,7 @@ test_expect_success PERL 'git restore -p --source=HEAD^...' '
verify_state dir/foo parent index verify_state dir/foo parent index
' '


test_expect_success PERL 'git restore -p handles deletion' ' test_expect_success 'git restore -p handles deletion' '
set_state dir/foo work index && set_state dir/foo work index &&
rm dir/foo && rm dir/foo &&
test_write_lines n y | git restore -p && test_write_lines n y | git restore -p &&
@ -85,21 +85,21 @@ test_expect_success PERL 'git restore -p handles deletion' '
# dir/foo. There's always an extra 'n' to reject edits to dir/foo in # dir/foo. There's always an extra 'n' to reject edits to dir/foo in
# the failure case (and thus get out of the loop). # the failure case (and thus get out of the loop).


test_expect_success PERL 'path limiting works: dir' ' test_expect_success 'path limiting works: dir' '
set_state dir/foo work head && set_state dir/foo work head &&
test_write_lines y n | git restore -p dir && test_write_lines y n | git restore -p dir &&
verify_saved_state bar && verify_saved_state bar &&
verify_state dir/foo head head verify_state dir/foo head head
' '


test_expect_success PERL 'path limiting works: -- dir' ' test_expect_success 'path limiting works: -- dir' '
set_state dir/foo work head && set_state dir/foo work head &&
test_write_lines y n | git restore -p -- dir && test_write_lines y n | git restore -p -- dir &&
verify_saved_state bar && verify_saved_state bar &&
verify_state dir/foo head head verify_state dir/foo head head
' '


test_expect_success PERL 'path limiting works: HEAD^ -- dir' ' test_expect_success 'path limiting works: HEAD^ -- dir' '
set_state dir/foo work head && set_state dir/foo work head &&
# the third n is to get out in case it mistakenly does not apply # the third n is to get out in case it mistakenly does not apply
test_write_lines y n n | git restore -p --source=HEAD^ -- dir && test_write_lines y n n | git restore -p --source=HEAD^ -- dir &&
@ -107,7 +107,7 @@ test_expect_success PERL 'path limiting works: HEAD^ -- dir' '
verify_state dir/foo parent head verify_state dir/foo parent head
' '


test_expect_success PERL 'path limiting works: foo inside dir' ' test_expect_success 'path limiting works: foo inside dir' '
set_state dir/foo work head && set_state dir/foo work head &&
# the third n is to get out in case it mistakenly does not apply # the third n is to get out in case it mistakenly does not apply
test_write_lines y n n | (cd dir && git restore -p foo) && test_write_lines y n n | (cd dir && git restore -p foo) &&
@ -115,7 +115,7 @@ test_expect_success PERL 'path limiting works: foo inside dir' '
verify_state dir/foo head head verify_state dir/foo head head
' '


test_expect_success PERL 'none of this moved HEAD' ' test_expect_success 'none of this moved HEAD' '
verify_saved_head verify_saved_head
' '



View File

@ -3,12 +3,6 @@
test_description='stash -p' test_description='stash -p'
. ./lib-patch-mode.sh . ./lib-patch-mode.sh


if ! test_have_prereq PERL
then
skip_all='skipping stash -p tests, perl not available'
test_done
fi

test_expect_success 'setup' ' test_expect_success 'setup' '
mkdir dir && mkdir dir &&
echo parent > dir/foo && echo parent > dir/foo &&

View File

@ -5,7 +5,7 @@ test_description='git reset --patch'
TEST_PASSES_SANITIZE_LEAK=true TEST_PASSES_SANITIZE_LEAK=true
. ./lib-patch-mode.sh . ./lib-patch-mode.sh


test_expect_success PERL 'setup' ' test_expect_success 'setup' '
mkdir dir && mkdir dir &&
echo parent > dir/foo && echo parent > dir/foo &&
echo dummy > bar && echo dummy > bar &&
@ -19,7 +19,7 @@ test_expect_success PERL 'setup' '


# note: bar sorts before foo, so the first 'n' is always to skip 'bar' # note: bar sorts before foo, so the first 'n' is always to skip 'bar'


test_expect_success PERL 'saying "n" does nothing' ' test_expect_success 'saying "n" does nothing' '
set_and_save_state dir/foo work work && set_and_save_state dir/foo work work &&
test_write_lines n n | git reset -p && test_write_lines n n | git reset -p &&
verify_saved_state dir/foo && verify_saved_state dir/foo &&
@ -28,7 +28,7 @@ test_expect_success PERL 'saying "n" does nothing' '


for opt in "HEAD" "@" "" for opt in "HEAD" "@" ""
do do
test_expect_success PERL "git reset -p $opt" ' test_expect_success "git reset -p $opt" '
set_and_save_state dir/foo work work && set_and_save_state dir/foo work work &&
test_write_lines n y | git reset -p $opt >output && test_write_lines n y | git reset -p $opt >output &&
verify_state dir/foo work head && verify_state dir/foo work head &&
@ -37,28 +37,28 @@ do
' '
done done


test_expect_success PERL 'git reset -p HEAD^' ' test_expect_success 'git reset -p HEAD^' '
test_write_lines n y | git reset -p HEAD^ >output && test_write_lines n y | git reset -p HEAD^ >output &&
verify_state dir/foo work parent && verify_state dir/foo work parent &&
verify_saved_state bar && verify_saved_state bar &&
test_grep "Apply" output test_grep "Apply" output
' '


test_expect_success PERL 'git reset -p HEAD^^{tree}' ' test_expect_success 'git reset -p HEAD^^{tree}' '
test_write_lines n y | git reset -p HEAD^^{tree} >output && test_write_lines n y | git reset -p HEAD^^{tree} >output &&
verify_state dir/foo work parent && verify_state dir/foo work parent &&
verify_saved_state bar && verify_saved_state bar &&
test_grep "Apply" output test_grep "Apply" output
' '


test_expect_success PERL 'git reset -p HEAD^:dir/foo (blob fails)' ' test_expect_success 'git reset -p HEAD^:dir/foo (blob fails)' '
set_and_save_state dir/foo work work && set_and_save_state dir/foo work work &&
test_must_fail git reset -p HEAD^:dir/foo && test_must_fail git reset -p HEAD^:dir/foo &&
verify_saved_state dir/foo && verify_saved_state dir/foo &&
verify_saved_state bar verify_saved_state bar
' '


test_expect_success PERL 'git reset -p aaaaaaaa (unknown fails)' ' test_expect_success 'git reset -p aaaaaaaa (unknown fails)' '
set_and_save_state dir/foo work work && set_and_save_state dir/foo work work &&
test_must_fail git reset -p aaaaaaaa && test_must_fail git reset -p aaaaaaaa &&
verify_saved_state dir/foo && verify_saved_state dir/foo &&
@ -70,27 +70,27 @@ test_expect_success PERL 'git reset -p aaaaaaaa (unknown fails)' '
# dir/foo. There's always an extra 'n' to reject edits to dir/foo in # dir/foo. There's always an extra 'n' to reject edits to dir/foo in
# the failure case (and thus get out of the loop). # the failure case (and thus get out of the loop).


test_expect_success PERL 'git reset -p dir' ' test_expect_success 'git reset -p dir' '
set_state dir/foo work work && set_state dir/foo work work &&
test_write_lines y n | git reset -p dir && test_write_lines y n | git reset -p dir &&
verify_state dir/foo work head && verify_state dir/foo work head &&
verify_saved_state bar verify_saved_state bar
' '


test_expect_success PERL 'git reset -p -- foo (inside dir)' ' test_expect_success 'git reset -p -- foo (inside dir)' '
set_state dir/foo work work && set_state dir/foo work work &&
test_write_lines y n | (cd dir && git reset -p -- foo) && test_write_lines y n | (cd dir && git reset -p -- foo) &&
verify_state dir/foo work head && verify_state dir/foo work head &&
verify_saved_state bar verify_saved_state bar
' '


test_expect_success PERL 'git reset -p HEAD^ -- dir' ' test_expect_success 'git reset -p HEAD^ -- dir' '
test_write_lines y n | git reset -p HEAD^ -- dir && test_write_lines y n | git reset -p HEAD^ -- dir &&
verify_state dir/foo work parent && verify_state dir/foo work parent &&
verify_saved_state bar verify_saved_state bar
' '


test_expect_success PERL 'none of this moved HEAD' ' test_expect_success 'none of this moved HEAD' '
verify_saved_head verify_saved_head
' '



View File

@ -34,7 +34,7 @@ test_expect_success 'reset $file' '
test_cmp expect actual test_cmp expect actual
' '


test_expect_success PERL 'reset -p' ' test_expect_success 'reset -p' '
rm .git/index && rm .git/index &&
git add a && git add a &&
echo y >yes && echo y >yes &&

View File

@ -3,12 +3,6 @@
test_description='hunk edit with "commit -p -m"' test_description='hunk edit with "commit -p -m"'
. ./test-lib.sh . ./test-lib.sh


if ! test_have_prereq PERL
then
skip_all="skipping '$test_description' tests, perl not available"
test_done
fi

test_expect_success 'setup (initial)' ' test_expect_success 'setup (initial)' '
echo line1 >file && echo line1 >file &&
git add file && git add file &&