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

Re: [PATCH 1/5] Add test-script for git-merge porcelain

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 23, 2007, 00:51 UTC
Message-ID
<7vwsuidx1a.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1190421186-21784-2-git-send-email-hjemli@gmail.com>
Lars Hjemli <hjemli@gmail.com> writes:
> This test-script tries to excercise the porcelainish aspects of git-merge.
It does exercise; no need for "tries to" ;-).
Show 14 quoted lines
> +test_expect_success 'verify merge result' '
> +	echo "
> +1 X
> +2
> +3
> +4
> +5
> +6
> +7
> +8
> +9
> +" > result.1 &&
> +	cmp -s file result.1
> +'

Unless there is a compelling reason otherwise, I'd prefer tests with a test vector like this to be spelled like this:

	diff -u result.1 file

That is, compare to show the difference actual output might have from the expected result. It's easier to spot the difference when you later break things this way.

Show 6 quoted lines
> +test_expect_success 'merge c1 with c2' '
> +	git reset --hard c1 &&
> +	git merge c2 &&
> +	test "$c1" = "$(git rev-parse HEAD^1)" &&
> +	test "$c2" = "$(git rev-parse HEAD^2)"
> +'
We might also want to test:
 - the index is merged;
 - the working tree matches the index;
 - the merge message (e.g. "git show -s --pretty=format:%s
   HEAD") is as expected;
Otherwise I think it is a good idea to add these tests.

By the way, I think squash_message() leaves a wrong message template for an Octopus, which might be worth fixing.

Previous: Lars HjemliNext: Lars Hjemli
Message 13 of 14 in “per branch options for git-merge incl. --no-ff”
  1. 0/5 per branch options for git-merge incl. --no-ffLars Hjemli, Sep 22, 2007
  2. 1/5 Add test-script for git-merge porcelainLars Hjemli, Sep 22, 2007
  3. 2/5 git-merge: refactor option parsingLars Hjemli, Sep 22, 2007
  4. 3/5 git-merge: add support for branch.<name>.mergeoptionsLars Hjemli, Sep 22, 2007
  5. 4/5 git-merge: add support for --commitLars Hjemli, Sep 22, 2007
  6. 5/5 git-merge: add --ff and --no-ff optionsLars Hjemli, Sep 22, 2007
  7. Junio C HamanoSep 23, 2007
  8. Lars HjemliSep 23, 2007
  9. Junio C HamanoSep 23, 2007
  10. Lars HjemliSep 23, 2007
  11. Junio C HamanoSep 23, 2007
  12. Lars HjemliSep 23, 2007
  13. Junio C HamanoSep 23, 2007
  14. Lars HjemliSep 23, 2007

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.