git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/7] t5520: test --rebase with multiple branches

From
Stefan Beller <sbeller@google.com>
Date
May 4, 2015, 17:09 UTC
Message-ID
<CAGZ79kbSMbhW2FLK05CaQjJjSTqEurB8iyeEBgyA1wbWJ4g2vw@mail.gmail.com>
In-Reply-To
<1430581035-29464-6-git-send-email-pyokagan@gmail.com>
On Sat, May 2, 2015 at 8:37 AM, Paul Tan <pyokagan@gmail.com> wrote:
Show 26 quoted lines
> Since rebasing on top of multiple upstream branches does not make sense,
> since commit 51b2ead0 ("disallow providing multiple upstream branches
> to rebase, pull --rebase"), git-pull explicitly disallowed specifying
> multiple branches in the rebase case.
>
> Implement tests to ensure that git-pull fails and prints out the
> user-friendly error message in such a case.
>
> Signed-off-by: Paul Tan <pyokagan@gmail.com>
> ---
>  t/t5520-pull.sh | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
> index 25d519d..17c63ff 100755
> --- a/t/t5520-pull.sh
> +++ b/t/t5520-pull.sh
> @@ -223,6 +223,14 @@ test_expect_success '--rebase' '
>         test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
>         test new = $(git show HEAD:file2)
>  '
> +
> +test_expect_success '--rebase fails with multiple branches' '
> +       git reset --hard before-rebase &&
> +       test_must_fail git pull --rebase . copy master 2>out &&
> +       test_when_finished "rm -f out" &&

I think it would make sense to switch the previous 2 lines, because the test_when_finished should also be run if the test actually fails. The actual tested part may segfault, which would interrupt the && chain from reaching the test_when_finished line. And here, the line to test is meant to be the "git pull --rebase" line, so we'd assume it may be stopping there due to failures in the tested program.

If you grep through the code base, you'll find lots of test_when_finished commands as the very first command (or the earliest spot where it makes sense).

Show 9 quoted lines
> +       test_i18ngrep "Cannot rebase onto multiple branches" out
> +'
> +
>  test_expect_success 'pull.rebase' '
>         git reset --hard before-rebase &&
>         test_config pull.rebase true &&
> --
> 2.1.4
>
Previous: Paul TanNext: Junio C Hamano
Message 13 of 21 in “Improve git-pull test coverage”
  1. 0/7 Improve git-pull test coveragePaul Tan, May 2, 2015
  2. 1/7 t5520: test pulling multiple branches into an empty repositoryPaul Tan, May 2, 2015
  3. 2/7 t5520: implement tests for no merge candidates casesPaul Tan, May 2, 2015
  4. Matthieu MoyMay 4, 2015
  5. Paul TanMay 6, 2015
  6. Paul TanMay 6, 2015
  7. 3/7 t5520: test for failure if index has unresolved entriesPaul Tan, May 2, 2015
  8. Matthieu MoyMay 4, 2015
  9. 4/7 t5520: test work tree fast-forward when fetch updates headPaul Tan, May 2, 2015
  10. Eric SunshineMay 3, 2015
  11. Paul TanMay 3, 2015
  12. 5/7 t5520: test --rebase with multiple branchesPaul Tan, May 2, 2015
  13. Stefan BellerMay 4, 2015
  14. Junio C HamanoMay 4, 2015
  15. Paul TanMay 5, 2015
  16. 6/7 t5520: test --rebase failure on unborn branch with indexPaul Tan, May 2, 2015
  17. 7/7 t5521: test --dry-run does not make any changesPaul Tan, May 2, 2015
  18. Matthieu MoyMay 4, 2015
  19. Junio C HamanoMay 4, 2015
  20. Paul TanMay 5, 2015
  21. Paul TanMay 6, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.