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

Re: What's cooking in git.git (Sep 2016, #08; Tue, 27)

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 4, 2016, 16:11 UTC
Message-ID
<xmqqh98sw0tv.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79kY+yB-AxRUt0rArGw6DaLDsMZDjKt2jQh9B=P-79T+qYQ@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
> So how would we go about git_all_attrs then?

I think you arrived the same conclusion, but the use of git_attr_check_elem[] in the original implementation of git_all_attrs() does not translate to the use of struct git_attr_check in the new world order we have been discussing. The latter is about "here are the attributes I want to know about", i.e. the question being asked and then we would need to separate out the answer from it to prepare for the threaded future.

The question git_all_attrs() asks is quite different. The caller does not even know what set of attributes it is interested in, so if you ever want to allow more than one callers pass the same callsite to the function at the same time, they need their own copy of both <attr>s and <value>s. I'd expect they'd ask about a path and then receive an array of (<attr>,<value>). This is essentially what happens in today's "array of git_attr_check_elem[]" interface.

That is fundamentally different from the normal use of git_check_attr(), where <attr>s are part of questions being asked.

> int git_all_attrs(const char *path, char *result_keys[], char *result_values[],
>                         int nr, int alloc)

Or wrap each (<attr>,<value>) in a struct and return an array of it. I do not see a reason why the above cannot be

	struct { const struct git_attr *a; const char *v; }
	**git_all_attr(const char *path);

which returns an array of struct's with an sentinel element at the end (e.g. the 'a' field set to NULL or something).

Previous: Stefan BellerNext: Stefan Beller
Message 10 of 11 in “What's cooking in git.git (Sep 2016, #08; Tue, 27)”
  1. Junio C HamanoSep 27, 2016
  2. Stefan BellerOct 1, 2016
  3. Junio C HamanoOct 3, 2016
  4. Stefan BellerOct 3, 2016
  5. Junio C HamanoOct 3, 2016
  6. Junio C HamanoOct 3, 2016
  7. Stefan BellerOct 3, 2016
  8. Junio C HamanoOct 3, 2016
  9. Stefan BellerOct 3, 2016
  10. Junio C HamanoOct 4, 2016
  11. Stefan BellerOct 4, 2016

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.