[1/3] rebase: add test for rebase --fork-point with short upstream
diff mbox series

Message ID 20191205225322.5529-2-alext9@gmail.com
State New
Headers show
Series
  • rebase: fix bug in --fork-point
Related show

Commit Message

Alex Torok Dec. 5, 2019, 10:53 p.m. UTC
This proves the bug of "rebase --fork-point upstream branch" not using
the fork point of upstream and branch if upstream is not the full
refname of the upstream branch.

Signed-off-by: Alex Torok <alext9@gmail.com>
---
 t/t3431-rebase-fork-point.sh | 1 +
 1 file changed, 1 insertion(+)

Comments

Junio C Hamano Dec. 5, 2019, 11:04 p.m. UTC | #1
Alex Torok <alext9@gmail.com> writes:

> This proves the bug of "rebase --fork-point upstream branch" not using
> the fork point of upstream and branch if upstream is not the full
> refname of the upstream branch.
>
> Signed-off-by: Alex Torok <alext9@gmail.com>
> ---
>  t/t3431-rebase-fork-point.sh | 1 +
>  1 file changed, 1 insertion(+)

Is this new test expected to fail after applying only 1/3 and then
starts working after applying all 3 patches?

If so, it probably makes a lot mroe sense to reorder the series to
have 2/3 as a single preparatory patch, with 1/3 + 3/3 combined into
a single patch "rebase: find --fork-point with full ref" to fix the
code and protect the fix with the test at the same time.

> diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh
> index 78851b9a2a..6ecdae918e 100755
> --- a/t/t3431-rebase-fork-point.sh
> +++ b/t/t3431-rebase-fork-point.sh
> @@ -49,6 +49,7 @@ test_rebase 'G F C D B A' --no-fork-point --onto D
>  test_rebase 'G F C B A' --no-fork-point --keep-base
>  test_rebase 'G F E D B A' --fork-point refs/heads/master
>  test_rebase 'G F D B A' --fork-point --onto D refs/heads/master
> +test_rebase 'G F D B A' --fork-point --onto D master
>  test_rebase 'G F B A' --fork-point --keep-base refs/heads/master
>  test_rebase 'G F C E D B A' refs/heads/master
>  test_rebase 'G F C D B A' --onto D refs/heads/master
Alex Torok Dec. 5, 2019, 11:25 p.m. UTC | #2
That was the intention. Your idea for ordering makes more sense.

I'll reorder the commits and submit new patches.


On Thu, Dec 5, 2019 at 6:04 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Alex Torok <alext9@gmail.com> writes:
>
> > This proves the bug of "rebase --fork-point upstream branch" not using
> > the fork point of upstream and branch if upstream is not the full
> > refname of the upstream branch.
> >
> > Signed-off-by: Alex Torok <alext9@gmail.com>
> > ---
> >  t/t3431-rebase-fork-point.sh | 1 +
> >  1 file changed, 1 insertion(+)
>
> Is this new test expected to fail after applying only 1/3 and then
> starts working after applying all 3 patches?
>
> If so, it probably makes a lot mroe sense to reorder the series to
> have 2/3 as a single preparatory patch, with 1/3 + 3/3 combined into
> a single patch "rebase: find --fork-point with full ref" to fix the
> code and protect the fix with the test at the same time.
>
> > diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh
> > index 78851b9a2a..6ecdae918e 100755
> > --- a/t/t3431-rebase-fork-point.sh
> > +++ b/t/t3431-rebase-fork-point.sh
> > @@ -49,6 +49,7 @@ test_rebase 'G F C D B A' --no-fork-point --onto D
> >  test_rebase 'G F C B A' --no-fork-point --keep-base
> >  test_rebase 'G F E D B A' --fork-point refs/heads/master
> >  test_rebase 'G F D B A' --fork-point --onto D refs/heads/master
> > +test_rebase 'G F D B A' --fork-point --onto D master
> >  test_rebase 'G F B A' --fork-point --keep-base refs/heads/master
> >  test_rebase 'G F C E D B A' refs/heads/master
> >  test_rebase 'G F C D B A' --onto D refs/heads/master

Patch
diff mbox series

diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh
index 78851b9a2a..6ecdae918e 100755
--- a/t/t3431-rebase-fork-point.sh
+++ b/t/t3431-rebase-fork-point.sh
@@ -49,6 +49,7 @@  test_rebase 'G F C D B A' --no-fork-point --onto D
 test_rebase 'G F C B A' --no-fork-point --keep-base
 test_rebase 'G F E D B A' --fork-point refs/heads/master
 test_rebase 'G F D B A' --fork-point --onto D refs/heads/master
+test_rebase 'G F D B A' --fork-point --onto D master
 test_rebase 'G F B A' --fork-point --keep-base refs/heads/master
 test_rebase 'G F C E D B A' refs/heads/master
 test_rebase 'G F C D B A' --onto D refs/heads/master