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

Re: [RFC PATCH v5] Implement --first-parent for git rev-list --bisect

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 6, 2018, 20:33 UTC
Message-ID
<nycvar.QRO.7.76.6.1807062123280.75@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqwou8kz9b.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Fri, 6 Jul 2018, Junio C Hamano wrote:
Show 54 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> > git rev-list --first-parent --bisect-all F..E >revs &&
> >> > test_line_count = 9 revs &&
> >> > for rev in E e1 e2 e3 e4 e5 e6 e7 e8
> >> > do
> >> >   grep "^$(git rev-parse $rev) " revs ||
> >> >   {
> >> >     echo "$rev not shown" >&2 &&
> >> >     return 1
> >> >   }
> >> > done &&
> >> > sed -e "s/.*(dist=\([0-9]*\)).*/\1/" revs >actual.dists &&
> >> > sort -r actual.dists >actual.dists.sorted &&
> >> > test_cmp actual.dists.sorted actual.dists
> >> 
> > From my point of view, this indicates that you want to set those exact
> > dist values in stone.
> 
> As I already said, I do not think it is absolutely necessary to
> declare that the minimum dist is 0 or 1, or how big one step of dist
> is.  For those reading from the sidelines, the history we are
> testing this new feature over looks like this
> 
> #     E		dist=0
> #    / \
> #   e1  |	dist=1
> #   |   |
> #   e2  |	dist=2
> #   |   |       ...
> #   |   |       ...
> #   e7  |	dist=2
> #   |   |
> #   e8  |	dist=1
> #    \ /
> #     F		dist=0
> 
> Current code will say dist=0 for E and F, dist=1 for e1 and e8,
> etc., and I am fine if the code suddenly start saying that E and F
> (i.e. those at the boundary of the graph) have dist=1 and one hop
> weighs 10 so dist=11 for e1 and e8 (i.e. those at one hop from the
> boundary).
> 
> But I am not fine if E and F get larger dist than e1 and e8, or e1
> and e8 get different ones.  I do not think the code quoted upfront
> would catch such future breakages.
> 
> And I also do not see a reason why somebody wants to make the dist
> computation to be 1-based (iow, changing the minimum from 0 to 1) or
> one step not to be 1 (iow, giving 11 to e1 and e8), so while I agree
> it is not strictly necessary to cast the concrete distance value in
> stone, I do not see much harm doing so *if* it helps to make it
> simpler the test that is necessary to make sure relative dist values
> assigned to these commits are in correct order.
I guess that you still want to misunderstand me.

Because it is not really hard to understand what I said: a good regression test will verify precisely what you want to ensure, not precisely what the command's output is.

So in this case, quite obviously what you want to do is to verify that E and F get larger dist than e1 and e8. So that is what you test for. Not some fixed text that might require adjusting in the future for any other reason than a real bug.

Ciao, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 18 in “Implement --first-parent for git rev-list --bisect”
  1. Implement --first-parent for git rev-list --bisectTiago Botelho, Jun 22, 2018
  2. Junio C HamanoJun 25, 2018
  3. Christian CouderJun 26, 2018
  4. Johannes SchindelinJun 26, 2018
  5. Christian CouderJun 26, 2018
  6. Johannes SchindelinJun 26, 2018
  7. Junio C HamanoJun 26, 2018
  8. Johannes SchindelinJun 27, 2018
  9. Junio C HamanoJun 27, 2018
  10. Johannes SchindelinJun 28, 2018
  11. Junio C HamanoJun 28, 2018
  12. Johannes SchindelinJun 29, 2018
  13. Tiago BotelhoJul 3, 2018
  14. Junio C HamanoJul 3, 2018
  15. Johannes SchindelinJul 4, 2018
  16. Junio C HamanoJul 6, 2018
  17. Johannes SchindelinJul 6, 2018
  18. Junio C HamanoJul 6, 2018

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.