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

Re: [PATCH] New test for preserve merges and squash

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 20, 2008, 00:28 UTC
Message-ID
<7v1w661bnx.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1205971432-12641-1-git-send-email-joerg@alea.gnuu.de>
Jörg Sommer <joerg@alea.gnuu.de> writes:
Show 7 quoted lines
> Signed-off-by: Jörg Sommer <joerg@alea.gnuu.de>
> ---
>  t/t3404-rebase-interactive.sh |   20 ++++++++++++++++++++
>  1 files changed, 20 insertions(+), 0 deletions(-)
>
> The current version of git fails this test. I think it's a bug, because
> the patch is what I expect to happen. Or am I wrong?
Please mark such tests with test_expect_fail.
And also Cc: the guilty parties.
	$ git-blame master -- git-rebase--interactive.sh
        $ git shortlog -n -s master -- git-rebase--interactive.sh
would tell you who they are ;-).
Show 18 quoted lines
> +test_expect_success 'squash and preserve merges' '
> +	test_tick &&
> +	git checkout -b squash-and-preserve-merges master &&
> +	echo A > file1 &&
> +	git commit -m SaPM-1 file1 &&
> +	echo B > file1 &&
> +	git commit -m SaPM-2 file1 &&
> +	git merge to-be-preserved &&
> +	echo C > file1 &&
> +	git commit -m SaPM-3 file1 &&
> +
> +        EXPECT_COUNT=4 FAKE_LINES="1 2 squash 4 3" \
> +          git rebase -i -p --onto branch1 master &&
> +	test $(git rev-parse HEAD^2) = $(git rev-parse to-be-preserved) &&
> +	test $(git rev-parse HEAD~3) = $(git rev-parse branch1) &&
> +	test $(git show HEAD:file1) = C &&
> +	test $(git show HEAD~2:file1) = A
> +'

Please split such a test into two parts, a part that sets things up (which would succeed), and the part that runs the command it tries to test ("rebase -i" followed by the validation of the result, which you are expecting to fail). That way, somebody who is trying to fix the breakage can stop the test script by inserting "exit" between the two, run the rebase command by hand to see what is going on, etc. to diagnose the issue.

Previous: Jörg SommerNext: Jörg Sommer
Message 2 of 8 in “New test for preserve merges and squash”
  1. New test for preserve merges and squashJörg Sommer, Mar 20, 2008
  2. Junio C HamanoMar 20, 2008
  3. Jörg SommerMar 20, 2008
  4. Johannes SchindelinMar 20, 2008
  5. New test for rebase with preserve merges and squashJörg Sommer, Mar 20, 2008
  6. Johannes SchindelinMar 20, 2008
  7. Why rebase with preserve merges asks for merged commitsJörg Sommer, Mar 21, 2008
  8. Johannes SchindelinMar 21, 2008

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.