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

Re: [PATCH 3/3] completion: match ctags symbol names in grep patterns

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 18, 2011, 07:55 UTC
Message-ID
<20111018075521.GB20976@elie.hsd1.il.comcast.net>
In-Reply-To
<7v8voiiwfo.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> Junio C Hamano wrote:
>>> +git_check = $(shell git ls-files >/dev/null 2>&1; echo $$?)
[...]
>> Neat.  I'd prefer something like
[...]
Show 5 quoted lines
>> that avoid punishing people who were using the makefile for some
>> purpose unrelated to tags and cscope, though. ;)
>
> Hmm, how would this punish anybody exactly (I just took the structure
> from the way how the auto-depend is done)?

As Matthieu mentioned, the code in $(shell ...) gets run once each time the makefile is loaded, adding to the runtime and possible failure modes of

	make clean

that does not care about the result. The dep_check test has that same problem, and I was a little nervous about that when we added it. But:

 i.   it seemed to be worth the convenience
 ii.  computing whether the compiler supports -MMD once each time $(CC)
      is launched would slow enough not to be an option
 iii. in the end, most uses of the makefile are to compile something,
      anyway, so it is not _that_ much of a waste.
 iv.  if someone finds the per-make-invocation to be too high, we
      could introduce a DONT_COMPUTE_HEADER_DEPENDENCIES variable that
      causes the check to be skipped by forcing that particular result.
Great.

In this new tags/cscope example, one could make an argument that running exactly once is similarly better than running as needed (as in (ii) above), by pointing out that

	make tags TAGS cscope

would have to check for a working "git ls-files" once instead of three times. But I don't buy it. :)

> Besides, you would need to have the whole thing in a subshell or
> something, as this is used as the upstream to "| xargs".
Good catch, thanks.
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 24 in “stupid git tricks”
  1. 0/3 stupid git tricksJeff King, Oct 18, 2011
  2. 1/3 contrib: add diff highlight scriptJeff King, Oct 18, 2011
  3. 2/3 contrib: add git-jump scriptJeff King, Oct 18, 2011
  4. 3/3 completion: match ctags symbol names in grep patternsJeff King, Oct 18, 2011
  5. Junio C HamanoOct 18, 2011
  6. Jonathan NiederOct 18, 2011
  7. Junio C HamanoOct 18, 2011
  8. Matthieu MoyOct 18, 2011
  9. Junio C HamanoOct 18, 2011
  10. Jonathan NiederOct 18, 2011
  11. Junio C HamanoOct 18, 2011
  12. Jeff KingOct 18, 2011
  13. SZEDER GáborOct 21, 2011
  14. Jeff KingOct 21, 2011
  15. 1/3 contrib: add diff highlight scriptJeff King, Oct 21, 2011
  16. 2/3 contrib: add git-jump scriptJeff King, Oct 21, 2011
  17. Jeff KingOct 21, 2011
  18. 3/3 completion: match ctags symbol names in grep patternsJeff King, Oct 21, 2011
  19. 4/3 completion: use __gitcomp_nl for ctag matchingJeff King, Oct 21, 2011
  20. SZEDER GáborOct 23, 2011
  21. Jeff KingOct 28, 2011
  22. SZEDER GáborOct 29, 2011
  23. Jeff KingNov 1, 2011
  24. Junio C HamanoNov 1, 2011

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.