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

Re: [PATCH 1/5] Introduces for_each_revision() helper

From
Shawn O. Pearce <spearce@spearce.org>
Date
Apr 29, 2007, 07:06 UTC
Message-ID
<20070429070616.GV5942@spearce.org>
In-Reply-To
<7vy7kbeke1.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 7 quoted lines
> The reason I do not like this particular one is because both
> operations you are hiding are not simple operations like
> "initialize a variable to list head" or "follow a single pointer
> in the structure", but rather heavyweight operations with rather
> complex semantics.  I would want to make sure that people
> realize they are calling something heavyweight when they use the
> revision traversal.

But in_merge_base is heavyweight if the two commits are in the same object database, but aren't connected at all. You'll need to traverse both histories before aborting and saying there is no merge base. That ain't cheap on large trees. But its also a single line of code.

Anyway, my original problem with this macro was the way it was defined. I think Luiz was able to fix most of my issues with it in his latest version, but I still have a personal distaste for hiding things like a for(;;) construct in a macro, or allowing a macro parameter to be used more than once within the definition of the macro (unexpected side-effects of evaluating an more than once).

-- 
Shawn.
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 17 in “New for_each_revision() helper”
  1. 0/5 New for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  2. 1/5 Introduces for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  3. Junio C HamanoApr 27, 2007
  4. Luiz Fernando N. CapitulinoApr 27, 2007
  5. Junio C HamanoApr 29, 2007
  6. Shawn O. PearceApr 29, 2007
  7. Junio C HamanoApr 30, 2007
  8. Johannes SchindelinApr 28, 2007
  9. Alex RiesenApr 28, 2007
  10. Johannes SchindelinApr 28, 2007
  11. Luiz Fernando N. CapitulinoApr 28, 2007
  12. Alex RiesenApr 28, 2007
  13. Luiz Fernando N. CapitulinoApr 29, 2007
  14. 2/5 builtin-fmt-merge-msg.c: Use for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  15. 3/5 reachable.c: Use for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  16. 4/5 builtin-shortlog.c: Use for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  17. 5/5 builtin-log.c: Use for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007

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.