git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: phillip.wood123@gmail.com
To: Matt Hunter <m@lfurio.us>,
	phillip.wood@dunelm.org.uk, git@vger.kernel.org
Cc: Johannes Sixt <j6t@kdbg.org>
Subject: Re: [PATCH] revision: fix --left/right-only use with unrelated histories
Date: Wed, 2 Apr 2025 14:12:07 +0100	[thread overview]
Message-ID: <63e79534-db09-444f-8e82-8e01d914182d@gmail.com> (raw)
In-Reply-To: <D8TJMUMOGLBC.3FR8DHTTUN4M9@lfurio.us>

Hi Matt

On 30/03/2025 11:54, Matt Hunter wrote:
> On Sun Mar 30, 2025 at 6:11 AM EDT, Phillip Wood wrote:
>> Thank you for adding a test. We have a helper function test_line_count
>> which provides a helpful debugging message if the comparison fails.
>> Using that and avoiding process substitutions we'd write
>>
>> 	sort head >sorted_head &&
>> 	sort cmp >sorted_cmp &&
>> 	comm -12 sorted_head sorted_cmp >actual &&
>> 	test_line_count = 0 actual
> Thanks for that helper tip.  I was just about to send a v2 when your
> message came in, so I'm getting that incorporated now.
> 
> By the way, I had originally wanted to write test assertions that
> checked the actual number of commit ids returned from each of the two
> calls to rev-list - something like:
> 
>      git rev-list --X-only HEAD...cmp >file &&
>      test_line_count = N file
> 
> But since I'm not very familiar with this test harness yet, I couldn't
> actually figure the correct value for N.  It's not 1 (the commit made in
> my test body), and it's not 2 (that commit, plus the one from the setup
> case at the top of the file).  Any appropriate higher value wasn't
> obvious.

Each test in a given file runs in the same repository (this is a 
performance optimization) so the number of commits will depend on what 
the previous tests have done. Usually there is a setup test at the start 
of the file which creates some commits with tags. Individual tests can 
then use those tags to establish a known state.

Best Wishes

Phillip


> So I switched to what you saw in my v1.  Maybe this "no commit ids in
> common" test is actually the stronger assertion?


  reply	other threads:[~2025-04-02 13:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-30  5:49 [PATCH] revision: fix --left/right-only use with unrelated histories Matt Hunter
2025-03-30  8:31 ` Johannes Sixt
2025-04-01  9:56   ` Junio C Hamano
2025-03-30 10:11 ` Phillip Wood
2025-03-30 10:54   ` Matt Hunter
2025-04-02 13:12     ` phillip.wood123 [this message]
2025-04-04  5:13       ` Matt Hunter
2025-03-30 11:24 ` [PATCH v2] " Matt Hunter
2025-04-11 14:41   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63e79534-db09-444f-8e82-8e01d914182d@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=m@lfurio.us \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).