Message ID | 20231111132720.78877-4-andy.koppe@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | rebase: support --autosquash without -i | expand |
Andy Koppe <andy.koppe@gmail.com> writes: > Amend t3415-rebase-autosquash.sh to test the --autosquash option and > rebase.autoSquash config with and without -i. > > Signed-off-by: Andy Koppe <andy.koppe@gmail.com> > --- > t/t3415-rebase-autosquash.sh | 38 ++++++++++++++++++++++++++---------- > 1 file changed, 28 insertions(+), 10 deletions(-) > > diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh > index a364530d76..fcc40d6fe1 100755 > --- a/t/t3415-rebase-autosquash.sh > +++ b/t/t3415-rebase-autosquash.sh > @@ -43,7 +43,7 @@ test_auto_fixup () { > > git tag $1 && > test_tick && > - git rebase $2 -i HEAD^^^ && > + git rebase $2 HEAD^^^ && > git log --oneline >actual && > if test -n "$no_squash" > then > @@ -61,15 +61,24 @@ test_auto_fixup () { > } > > test_expect_success 'auto fixup (option)' ' > - test_auto_fixup final-fixup-option --autosquash > + test_auto_fixup fixup-option --autosquash && > + test_auto_fixup fixup-option-i "--autosquash -i" > ' Nice. As test_auto_fixup (and test_auto_squash we see later) clears the slate with "git reset --hard base" before it starts its work, it is easy to rerun them with and without "-i".
On 11/11/2023 13:27, Andy Koppe wrote: > Amend t3415-rebase-autosquash.sh to test the --autosquash option and > rebase.autoSquash config with and without -i. Thanks for adding these tests. I'd be happy to see this squashed into the previous commit, though that is probably not worth a re-roll on its own. Best Wishes Phillip > Signed-off-by: Andy Koppe <andy.koppe@gmail.com> > --- > t/t3415-rebase-autosquash.sh | 38 ++++++++++++++++++++++++++---------- > 1 file changed, 28 insertions(+), 10 deletions(-) > > diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh > index a364530d76..fcc40d6fe1 100755 > --- a/t/t3415-rebase-autosquash.sh > +++ b/t/t3415-rebase-autosquash.sh > @@ -43,7 +43,7 @@ test_auto_fixup () { > > git tag $1 && > test_tick && > - git rebase $2 -i HEAD^^^ && > + git rebase $2 HEAD^^^ && > git log --oneline >actual && > if test -n "$no_squash" > then > @@ -61,15 +61,24 @@ test_auto_fixup () { > } > > test_expect_success 'auto fixup (option)' ' > - test_auto_fixup final-fixup-option --autosquash > + test_auto_fixup fixup-option --autosquash && > + test_auto_fixup fixup-option-i "--autosquash -i" > ' > > -test_expect_success 'auto fixup (config)' ' > +test_expect_success 'auto fixup (config true)' ' > git config rebase.autosquash true && > - test_auto_fixup final-fixup-config-true && > + test_auto_fixup ! fixup-config-true && > + test_auto_fixup fixup-config-true-i -i && > test_auto_fixup ! fixup-config-true-no --no-autosquash && > + test_auto_fixup ! fixup-config-true-i-no "-i --no-autosquash" > +' > + > +test_expect_success 'auto fixup (config false)' ' > git config rebase.autosquash false && > - test_auto_fixup ! final-fixup-config-false > + test_auto_fixup ! fixup-config-false && > + test_auto_fixup ! fixup-config-false-i -i && > + test_auto_fixup fixup-config-false-yes --autosquash && > + test_auto_fixup fixup-config-false-i-yes "-i --autosquash" > ' > > test_auto_squash () { > @@ -87,7 +96,7 @@ test_auto_squash () { > git commit -m "squash! first" -m "extra para for first" && > git tag $1 && > test_tick && > - git rebase $2 -i HEAD^^^ && > + git rebase $2 HEAD^^^ && > git log --oneline >actual && > if test -n "$no_squash" > then > @@ -105,15 +114,24 @@ test_auto_squash () { > } > > test_expect_success 'auto squash (option)' ' > - test_auto_squash final-squash --autosquash > + test_auto_squash squash-option --autosquash && > + test_auto_squash squash-option-i "--autosquash -i" > ' > > -test_expect_success 'auto squash (config)' ' > +test_expect_success 'auto squash (config true)' ' > git config rebase.autosquash true && > - test_auto_squash final-squash-config-true && > + test_auto_squash ! squash-config-true && > + test_auto_squash squash-config-true-i -i && > test_auto_squash ! squash-config-true-no --no-autosquash && > + test_auto_squash ! squash-config-true-i-no "-i --no-autosquash" > +' > + > +test_expect_success 'auto squash (config false)' ' > git config rebase.autosquash false && > - test_auto_squash ! final-squash-config-false > + test_auto_squash ! squash-config-false && > + test_auto_squash ! squash-config-false-i -i && > + test_auto_squash squash-config-false-yes --autosquash && > + test_auto_squash squash-config-false-i-yes "-i --autosquash" > ' > > test_expect_success 'misspelled auto squash' '
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh index a364530d76..fcc40d6fe1 100755 --- a/t/t3415-rebase-autosquash.sh +++ b/t/t3415-rebase-autosquash.sh @@ -43,7 +43,7 @@ test_auto_fixup () { git tag $1 && test_tick && - git rebase $2 -i HEAD^^^ && + git rebase $2 HEAD^^^ && git log --oneline >actual && if test -n "$no_squash" then @@ -61,15 +61,24 @@ test_auto_fixup () { } test_expect_success 'auto fixup (option)' ' - test_auto_fixup final-fixup-option --autosquash + test_auto_fixup fixup-option --autosquash && + test_auto_fixup fixup-option-i "--autosquash -i" ' -test_expect_success 'auto fixup (config)' ' +test_expect_success 'auto fixup (config true)' ' git config rebase.autosquash true && - test_auto_fixup final-fixup-config-true && + test_auto_fixup ! fixup-config-true && + test_auto_fixup fixup-config-true-i -i && test_auto_fixup ! fixup-config-true-no --no-autosquash && + test_auto_fixup ! fixup-config-true-i-no "-i --no-autosquash" +' + +test_expect_success 'auto fixup (config false)' ' git config rebase.autosquash false && - test_auto_fixup ! final-fixup-config-false + test_auto_fixup ! fixup-config-false && + test_auto_fixup ! fixup-config-false-i -i && + test_auto_fixup fixup-config-false-yes --autosquash && + test_auto_fixup fixup-config-false-i-yes "-i --autosquash" ' test_auto_squash () { @@ -87,7 +96,7 @@ test_auto_squash () { git commit -m "squash! first" -m "extra para for first" && git tag $1 && test_tick && - git rebase $2 -i HEAD^^^ && + git rebase $2 HEAD^^^ && git log --oneline >actual && if test -n "$no_squash" then @@ -105,15 +114,24 @@ test_auto_squash () { } test_expect_success 'auto squash (option)' ' - test_auto_squash final-squash --autosquash + test_auto_squash squash-option --autosquash && + test_auto_squash squash-option-i "--autosquash -i" ' -test_expect_success 'auto squash (config)' ' +test_expect_success 'auto squash (config true)' ' git config rebase.autosquash true && - test_auto_squash final-squash-config-true && + test_auto_squash ! squash-config-true && + test_auto_squash squash-config-true-i -i && test_auto_squash ! squash-config-true-no --no-autosquash && + test_auto_squash ! squash-config-true-i-no "-i --no-autosquash" +' + +test_expect_success 'auto squash (config false)' ' git config rebase.autosquash false && - test_auto_squash ! final-squash-config-false + test_auto_squash ! squash-config-false && + test_auto_squash ! squash-config-false-i -i && + test_auto_squash squash-config-false-yes --autosquash && + test_auto_squash squash-config-false-i-yes "-i --autosquash" ' test_expect_success 'misspelled auto squash' '
Amend t3415-rebase-autosquash.sh to test the --autosquash option and rebase.autoSquash config with and without -i. Signed-off-by: Andy Koppe <andy.koppe@gmail.com> --- t/t3415-rebase-autosquash.sh | 38 ++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-)