Re: [PATCH v4] diff: make diff_free_filespec_data accept NULL
- From
Jinoh Kang <luke1337@theori.io>
- Date
- Nov 11, 2020, 12:30 UTC
- Message-ID
- <01640022-5bda-9712-8228-501374474d5f@theori.io>
- In-Reply-To
- <nycvar.QRO.7.76.6.2011101638080.18437@tvgsbejvaqbjf.bet>
On 11/10/20 3:38 PM, Johannes Schindelin wrote:
> I had suggested an improvement for this hunk as well as for the test case. > Fell through the cracks?
You guessed it right. My apologies.
Show 46 quoted lines
> +test_expect_success 'difftool --cached with unmerged files' ' > + test_when_finished git reset --hard && > + echo base >file && > + git add file && > + git commit -m base && > > This does not advance the committer date. Let's just use the helper > function we invented to make this much easier: > > test_commit base > > This has also the advantage of already tagging the outcome. > >> + git checkout -B conflict-a && >> + git checkout -B conflict-b && >> + git checkout conflict-a && >> + echo conflict-a >>file && >> + git add file && >> + git commit -m conflict-a && >> + git checkout conflict-b && >> + echo conflict-b >>file && >> + git add file && >> + git commit -m conflict-b && >> + git checkout master && >> + git merge conflict-a && >> + test_must_fail git merge conflict-b && >> + : >expect && >> + git difftool --cached --no-prompt >actual && >> + test_cmp expect actual > > Shouldn't this use the `test_must_be_empty` function instead? > > How about writing the test case this way: > > test_expect_success 'difftool --cached with unmerged files' ' > test_when_finished git reset --hard && > > test_commit conflicting && > test_commit conflict-a a conflicting.t && > git reset --hard conflicting && > test_commit conflict-b b conflicting.t && > test_must_fail git merge conflict-a && > > git difftool --cached --no-prompt >out && > test_must_be_empty out > '
The original test code was copied from the "difftool --dir-diff with unmerged files" case above.
It might be worth cleaning it up too, but let's leave it for another time.
I'm keeping the return-early code as per Junio's request.
-- Jinoh Kang Theori