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

Re: [PATCH v6 1/2] worktree: add 'for_each_worktree' function

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 31, 2015, 17:56 UTC
Message-ID
<xmqqd1y3wdcr.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAPig+cTHZrQn8LpfftcsAQhFAykgDorbR97tkcuSCFYD_ngs9g@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
> Thanks for working on this....
<aol>metoo</aol>
Show 10 quoted lines
> Stepping back a bit, is a for-each-foo()-style interface desirable?
> This sort of interface imposes a good deal of complexity on callers,
> demanding a callback function and callback data (cb_data), and is
> generally (at least in C) more difficult to reason about than other
> simpler interfaces. Is such complexity warranted?
>
> An alternate, much simpler interface would be to have a function, say
> get_worktrees(), return an array of 'worktree' structures to the
> caller, which the caller would iterate over (which is a common
> operation in C, thus easily reasoned about).
Nice.
Previous: Eric SunshineNext: David Turner
Message 4 of 14 in “worktree: for-each function and list command”
  1. 0/2 worktree: for-each function and list commandMichael Rappazzo, Aug 30, 2015
  2. 1/2 worktree: add 'for_each_worktree' functionMichael Rappazzo, Aug 30, 2015
  3. Eric SunshineAug 31, 2015
  4. Junio C HamanoAug 31, 2015
  5. David TurnerAug 31, 2015
  6. Eric SunshineAug 31, 2015
  7. David TurnerAug 31, 2015
  8. Mike RappazzoAug 31, 2015
  9. Eric SunshineAug 31, 2015
  10. Eric SunshineAug 31, 2015
  11. Mike RappazzoAug 31, 2015
  12. Eric SunshineAug 31, 2015
  13. 2/2 worktree: add 'list' commandMichael Rappazzo, Aug 30, 2015
  14. Eric SunshineAug 31, 2015

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.