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

Re: Is a given file known to git?

From
CDChristoph Duelli <duelli@melosgmbh.de>
Date
Mar 11, 2008, 09:41 UTC
Message-ID
<47D653CC.3070306@melosgmbh.de>
In-Reply-To
<47D652A9.4090304@viscovery.net>
Johannes Sixt schrieb:
Show 13 quoted lines
> Christoph Duelli schrieb:
>> Yes, thank you, Johannes and Shawn, this works.
>> (A bit slow, though: with this test enabled my script takes 77 secs;
>> without it it takes 0.3 secs. The time is spent in 9000 calls to the
>> above test (the rev-parse version). (ok, the fact that there is a Perl
>> system call around it might take some time, too).)
> 
> Oh, you said "a particular path from a bash script". If you had said "9000
> particular paths, and I have perl wrapped around it", then there might be
> (much) better solutions. Like parsing the output of "git ls-files
> --others" or "git ls-tree -r" into a hash and then lookup therein.
> 
> -- Hannes

Right you are ;-) I just assumed that such a test would be quick, so I didn't worry about speed back then. But yes, parsing the output of "igt ls-files" would solve that nicely.

Thank you.
-- 
Christoph Duelli
Previous: Johannes SixtNext: Junio C Hamano
Message 6 of 7 in “Is a given file known to git?”
  1. Christoph DuelliMar 11, 2008
  2. Shawn O. PearceMar 11, 2008
  3. Johannes SixtMar 11, 2008
  4. Christoph DuelliMar 11, 2008
  5. Johannes SixtMar 11, 2008
  6. Christoph DuelliMar 11, 2008
  7. Junio C HamanoMar 11, 2008

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.