On Tue, Jun 4, 2019 at 6:14 AM SZEDER Gábor <[email protected]> wrote:
>
> On Tue, Jun 04, 2019 at 12:26:14AM -0700, Elijah Newren wrote:
> > Of course, this wasn't the only bug; it also showed we had a glaring
> > whole in our test coverage -- there's a dearth of tests for rename/add
> > conflicts, and in particular none involving content merges for the
> > rename side. So, I created a patch which adds some tests for that
> > (which triggered the assertion error). I pulled SZEDER's fix into the
> > same patch and added a commit message explaining the issue, using a
> > Based-on-patch-by tag for the fix. SZEDER: if you'd like to see this
> > in a different format (maybe I add tests which show the error and then
> > in a separate patch authored by you we introduce your fix?), just let
> > me know.
>
> Nah, I'm fine with it.
>
...
> > In commit 8daec1df03de ("merge-recursive: switch from (oid,mode) pairs
> > to a diff_filespec", 2019-04-05), we actually switched from
> > (oid,mode,path) triplets to a diff_filespec -- but most callsites in the
> > patch only needed to worry about oid and mode so the commit message
> > focused on that. The oversight in the commit message apparently spilled
> > over to the code as will; one of the dozen or so callsites accidentally
>
> s/will/well/
Thanks, will fix this up.
> > + git ls-files -u >out &&
> > + test_line_count = 2 out &&
> > + git ls-files -u b >out &&
>
> Are these two 'git ls-files -u' executions as intended, i.e. first
> without a file and then with 'b'?
>
> Or is this a bit of a "Huh?!"-inducing way (for me; for you it might
> be an idiom :) to check that 'b' has two unmerged entries and no other
> file has unmerged entries?
Yes, with rename/add there's always a possibility that the original
filename ('a', in this case) appears unmerged or that due to the
rename/add collision that both paths are renamed (e.g. 'b.HEAD' and
'b.MERGE_HEAD') and entries for these are found in the index. I'll
add a quick little comment before the second saying 'Also, make sure
both unmerged entries are for "b"'.
> > + git hash-object b >actual &&
> > + git hash-object ours >expect &&
> > + test_cmp expect actual
>
> So these last three lines compute the object ids of two files and then
> compare those two oids to make sure they match... But wouldn't a
> 'test_cmp ours b' do the trick just as well?
Yes, that'd be better. I'll fix it up and resend.