Message ID | 20200407141125.30872-7-phillip.wood123@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fixup ra/rebase-i-more-options | expand |
On Tue, Apr 7, 2020 at 7:11 AM Phillip Wood <phillip.wood123@gmail.com> wrote: > > From: Phillip Wood <phillip.wood@dunelm.org.uk> > > Add tests to check --ignore-whitespace and --ignore-date are remembered > when running `rebase --continue` and to check > --committer-date-is-author-date with --ignore-date gives the expected > result. Thanks for adding these. > > Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> > --- > t/t3433-rebase-options-compatibility.sh | 55 +++++++++++++++++++++++++ t3433 is taken by t3433-rebase-across-mode-change.sh in upstream. When you revert the reversion of Rohit's changes, perhaps you need to rename his t3433 to some other file? Also, the name "rebase-options-compatibility" suggest to me that it's just checking whether certain options can be used together. Perhaps the --ignore-whitespace and --ignore-date tests you add should go somewhere else? > 1 file changed, 55 insertions(+) > > diff --git a/t/t3433-rebase-options-compatibility.sh b/t/t3433-rebase-options-compatibility.sh > index 8247d01442..a13c341301 100755 > --- a/t/t3433-rebase-options-compatibility.sh > +++ b/t/t3433-rebase-options-compatibility.sh > @@ -7,6 +7,8 @@ test_description='tests to ensure compatibility between am and interactive backe > > . ./test-lib.sh > > +. "$TEST_DIRECTORY"/lib-rebase.sh > + > GIT_AUTHOR_DATE="1999-04-02T08:03:20+05:30" > export GIT_AUTHOR_DATE > > @@ -70,6 +72,22 @@ test_expect_success '--ignore-whitespace works with interactive backend' ' > test_cmp expect file > ' > > +test_expect_success '--ignore-whitespace is remembered when continuing' ' > + cat >expect <<-\EOF && > + line 1 > + new line 2 > + line 3 > + EOF > + ( > + set_fake_editor && > + FAKE_LINES="break 1" && > + export FAKE_LINES && > + git rebase -i --ignore-whitespace main side > + ) && > + git rebase --continue && > + test_cmp expect file > +' > + > test_expect_success '--committer-date-is-author-date works with am backend' ' > GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author && > git rebase --committer-date-is-author-date HEAD^ && > @@ -135,6 +153,16 @@ test_expect_success '--ignore-date works with interactive backend' ' > grep "+0000" authortime > ' > > +test_expect_success '--ignore-date works after conflict resolution' ' > + test_must_fail git rebase --ignore-date -i \ > + --onto commit2^^ commit2^ commit2 && I don't see any todo list here; is there a reason you are using -i instead of say -m? (Similar question applies for the subsequent tests you add below too?) > + echo resolved >foo && > + git add foo && > + git rebase --continue && > + git log --pretty=%ai >authortime && > + grep +0000 authortime > +' > + > test_expect_success '--ignore-date works with rebase -r' ' > git checkout side && > git merge --no-ff commit3 && > @@ -143,4 +171,31 @@ test_expect_success '--ignore-date works with rebase -r' ' > ! grep -v "+0000" authortime > ' > > +test_expect_success '--ignore-date with --committer-date-is-author-date works' ' > + test_must_fail git rebase -i --committer-date-is-author-date \ > + --ignore-date --onto commit2^^ commit2^ commit3 && > + git checkout --theirs foo && > + git add foo && > + git rebase --continue && > + git log -2 --pretty=%ai >authortime && > + git log -2 --pretty=%ci >committertime && > + test_cmp authortime committertime && > + ! grep -v "+0000" authortime > +' > + > +test_expect_success '--ignore-date --committer-date-is-author-date works when forking merge' ' > + GIT_SEQUENCE_EDITOR="echo \"merge -C $(git rev-parse HEAD) commit3\">" \ > + git rebase -i --strategy=resolve --ignore-date \ > + --committer-date-is-author-date side side && > + git log -1 --pretty=%ai >authortime && > + git log -1 --pretty=%ci >committertime && > + test_cmp authortime committertime && > + grep "+0000" authortime > + ' > + > +# This must be the last test in this file > +test_expect_success '$EDITOR and friends are unchanged' ' > + test_editor_unchanged > +' > + > test_done > -- > 2.26.0 >
Hi Elijah On 07/04/2020 16:13, Elijah Newren wrote: > On Tue, Apr 7, 2020 at 7:11 AM Phillip Wood <phillip.wood123@gmail.com> wrote: >> >> From: Phillip Wood <phillip.wood@dunelm.org.uk> >> >> Add tests to check --ignore-whitespace and --ignore-date are remembered >> when running `rebase --continue` and to check >> --committer-date-is-author-date with --ignore-date gives the expected >> result. > > Thanks for adding these. > >> >> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> >> --- >> t/t3433-rebase-options-compatibility.sh | 55 +++++++++++++++++++++++++ > > t3433 is taken by t3433-rebase-across-mode-change.sh in upstream. > When you revert the reversion of Rohit's changes, perhaps you need to > rename his t3433 to some other file? Thanks for point that out I'll rename it > Also, the name "rebase-options-compatibility" suggest to me that it's > just checking whether certain options can be used together. Perhaps > the --ignore-whitespace and --ignore-date tests you add should go > somewhere else? I think this file is so named because it tests that the merge backend is compatible with the apply backend for the new options (i.e. they both give the same results) - I'll try and think of a better name >> 1 file changed, 55 insertions(+) >> >> diff --git a/t/t3433-rebase-options-compatibility.sh b/t/t3433-rebase-options-compatibility.sh >> index 8247d01442..a13c341301 100755 >> --- a/t/t3433-rebase-options-compatibility.sh >> +++ b/t/t3433-rebase-options-compatibility.sh >> @@ -7,6 +7,8 @@ test_description='tests to ensure compatibility between am and interactive backe >> >> . ./test-lib.sh >> >> +. "$TEST_DIRECTORY"/lib-rebase.sh >> + >> GIT_AUTHOR_DATE="1999-04-02T08:03:20+05:30" >> export GIT_AUTHOR_DATE >> >> @@ -70,6 +72,22 @@ test_expect_success '--ignore-whitespace works with interactive backend' ' >> test_cmp expect file >> ' >> >> +test_expect_success '--ignore-whitespace is remembered when continuing' ' >> + cat >expect <<-\EOF && >> + line 1 >> + new line 2 >> + line 3 >> + EOF >> + ( >> + set_fake_editor && >> + FAKE_LINES="break 1" && >> + export FAKE_LINES && >> + git rebase -i --ignore-whitespace main side >> + ) && >> + git rebase --continue && >> + test_cmp expect file >> +' >> + >> test_expect_success '--committer-date-is-author-date works with am backend' ' >> GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author && >> git rebase --committer-date-is-author-date HEAD^ && >> @@ -135,6 +153,16 @@ test_expect_success '--ignore-date works with interactive backend' ' >> grep "+0000" authortime >> ' >> >> +test_expect_success '--ignore-date works after conflict resolution' ' >> + test_must_fail git rebase --ignore-date -i \ >> + --onto commit2^^ commit2^ commit2 && > > I don't see any todo list here; is there a reason you are using -i > instead of say -m? (Similar question applies for the subsequent tests > you add below too?) Habit. (also these were originally based on an older commit and I wasn't sure if that had your 'rebase -m' changes in it.) I'll update them to use -m Best Wishes Phillip >> + echo resolved >foo && >> + git add foo && >> + git rebase --continue && >> + git log --pretty=%ai >authortime && >> + grep +0000 authortime >> +' >> + >> test_expect_success '--ignore-date works with rebase -r' ' >> git checkout side && >> git merge --no-ff commit3 && >> @@ -143,4 +171,31 @@ test_expect_success '--ignore-date works with rebase -r' ' >> ! grep -v "+0000" authortime >> ' >> >> +test_expect_success '--ignore-date with --committer-date-is-author-date works' ' >> + test_must_fail git rebase -i --committer-date-is-author-date \ >> + --ignore-date --onto commit2^^ commit2^ commit3 && >> + git checkout --theirs foo && >> + git add foo && >> + git rebase --continue && >> + git log -2 --pretty=%ai >authortime && >> + git log -2 --pretty=%ci >committertime && >> + test_cmp authortime committertime && >> + ! grep -v "+0000" authortime >> +' >> + >> +test_expect_success '--ignore-date --committer-date-is-author-date works when forking merge' ' >> + GIT_SEQUENCE_EDITOR="echo \"merge -C $(git rev-parse HEAD) commit3\">" \ >> + git rebase -i --strategy=resolve --ignore-date \ >> + --committer-date-is-author-date side side && >> + git log -1 --pretty=%ai >authortime && >> + git log -1 --pretty=%ci >committertime && >> + test_cmp authortime committertime && >> + grep "+0000" authortime >> + ' >> + >> +# This must be the last test in this file >> +test_expect_success '$EDITOR and friends are unchanged' ' >> + test_editor_unchanged >> +' >> + >> test_done >> -- >> 2.26.0 >>
diff --git a/t/t3433-rebase-options-compatibility.sh b/t/t3433-rebase-options-compatibility.sh index 8247d01442..a13c341301 100755 --- a/t/t3433-rebase-options-compatibility.sh +++ b/t/t3433-rebase-options-compatibility.sh @@ -7,6 +7,8 @@ test_description='tests to ensure compatibility between am and interactive backe . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-rebase.sh + GIT_AUTHOR_DATE="1999-04-02T08:03:20+05:30" export GIT_AUTHOR_DATE @@ -70,6 +72,22 @@ test_expect_success '--ignore-whitespace works with interactive backend' ' test_cmp expect file ' +test_expect_success '--ignore-whitespace is remembered when continuing' ' + cat >expect <<-\EOF && + line 1 + new line 2 + line 3 + EOF + ( + set_fake_editor && + FAKE_LINES="break 1" && + export FAKE_LINES && + git rebase -i --ignore-whitespace main side + ) && + git rebase --continue && + test_cmp expect file +' + test_expect_success '--committer-date-is-author-date works with am backend' ' GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author && git rebase --committer-date-is-author-date HEAD^ && @@ -135,6 +153,16 @@ test_expect_success '--ignore-date works with interactive backend' ' grep "+0000" authortime ' +test_expect_success '--ignore-date works after conflict resolution' ' + test_must_fail git rebase --ignore-date -i \ + --onto commit2^^ commit2^ commit2 && + echo resolved >foo && + git add foo && + git rebase --continue && + git log --pretty=%ai >authortime && + grep +0000 authortime +' + test_expect_success '--ignore-date works with rebase -r' ' git checkout side && git merge --no-ff commit3 && @@ -143,4 +171,31 @@ test_expect_success '--ignore-date works with rebase -r' ' ! grep -v "+0000" authortime ' +test_expect_success '--ignore-date with --committer-date-is-author-date works' ' + test_must_fail git rebase -i --committer-date-is-author-date \ + --ignore-date --onto commit2^^ commit2^ commit3 && + git checkout --theirs foo && + git add foo && + git rebase --continue && + git log -2 --pretty=%ai >authortime && + git log -2 --pretty=%ci >committertime && + test_cmp authortime committertime && + ! grep -v "+0000" authortime +' + +test_expect_success '--ignore-date --committer-date-is-author-date works when forking merge' ' + GIT_SEQUENCE_EDITOR="echo \"merge -C $(git rev-parse HEAD) commit3\">" \ + git rebase -i --strategy=resolve --ignore-date \ + --committer-date-is-author-date side side && + git log -1 --pretty=%ai >authortime && + git log -1 --pretty=%ci >committertime && + test_cmp authortime committertime && + grep "+0000" authortime + ' + +# This must be the last test in this file +test_expect_success '$EDITOR and friends are unchanged' ' + test_editor_unchanged +' + test_done