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

Re: [PATCH v2 1/2] test: git-stash conflict sets up rerere

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 9, 2012, 02:37 UTC
Message-ID
<7v8vetmzgz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1341693962-17090-2-git-send-email-hordp@cisco.com>
Phil Hord <hordp@cisco.com> writes:
> Add a failing test to confirm a conflicted stash apply invokes
> rerere to record the conflicts and resolve the the files it can.
OK.
> In this failing state, mergetool may be confused by a left-over
> state from previous rerere activity.

It is unclear to me what relevance this has to this patch. Does it have this sequence:

    "previous rerere activity" (whatever that is)
    test_must_fail git stash apply &&
    git mergetool

and demonstrate that "git mergetool" fails because there is a wrong rerere state in the repository after "git stash apply" returns?

Or perhaps you are relying on the state that is left by the previous test piece?

> Also, the next test expected us to finish up with a reset, which
> is impossible to do if we fail (as we must) and it's an
> unreasonable expectation anyway.  Begin the next test with a reset
> of his own instead.

Yes, it is always a good discipline to start a new test piece from a known state.

Show 16 quoted lines
> @@ -193,7 +203,37 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '
>      git reset --hard
>  '
>  
> +test_expect_failure 'conflicted stash sets up rerere'  '
> +    git config rerere.enabled true &&
> +    git checkout stash1 &&
> +    echo "Conflicting stash content" >file11 &&
> +    git stash &&
> +    
> +    git checkout --detach stash2 &&
> +    test_must_fail git stash apply &&
> +    
> +    test -e .git/MERGE_RR &&
> +    test -n "$(git ls-files -u)" &&
> +    conflicts="$(git rerere remaining)" &&

Checking that the index is conflicted with "ls-files -u" and asking the public API "git rerere remaining" to see what paths rerere thinks it did not touch, like you do in the second and third lines, are very sensible, but it is probably not a good idea for this test to check implementation details with "test -f .git/MERGE_RR".

Show 12 quoted lines
> +    test "$conflicts" = "file11" &&
> +    output="$(git mergetool --no-prompt)" &&
> +    test "$output" != "No files need merging" &&
> +
> +    git commit -am "save the stash resolution" &&
> +
> +    git reset --hard stash2 &&
> +    test_must_fail git stash apply &&
> +
> +    test -e .git/MERGE_RR &&
> +    test -n "$(git ls-files -u)" &&
> +    conflicts="$(git rerere remaining)" &&
Likewise.
Show 10 quoted lines
> +    test -z "$conflicts" &&
> +    output="$(git mergetool --no-prompt)" &&
> +    test "$output" = "No files need merging"
> +'
> +
>  test_expect_success 'mergetool takes partial path' '
> +    git reset --hard
>      git config rerere.enabled false &&
>      git checkout -b test12 branch1 &&
>      git submodule update -N &&
Previous: Phil HordNext: Phil Hord
Message 8 of 13 in “stash: Delete MERGE_RR before stash apply”
  1. stash: Delete MERGE_RR before stash applyPhil Hord, Jul 5, 2012
  2. Junio C HamanoJul 5, 2012
  3. Phil HordJul 6, 2012
  4. Junio C HamanoJul 6, 2012
  5. Phil HordJul 6, 2012
  6. 0/2 stash: invoke rerere in case of conflictPhil Hord, Jul 7, 2012
  7. 1/2 test: git-stash conflict sets up rererePhil Hord, Jul 7, 2012
  8. Junio C HamanoJul 9, 2012
  9. Phil HordJul 9, 2012
  10. Junio C HamanoAug 16, 2012
  11. Phil HordAug 17, 2012
  12. Junio C HamanoAug 17, 2012
  13. 2/2 stash: invoke rerere in case of conflictPhil Hord, Jul 7, 2012

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.