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

Re: 'git branch' when origin branch with same name exists

From
Andreas Ericsson <ae@op5.se>
Date
Jun 20, 2012, 08:31 UTC
Message-ID
<4FE18A6B.9020207@op5.se>
In-Reply-To
<4FE0B1A1.9030509@desrt.ca>
On 06/19/2012 07:06 PM, Ryan Lortie wrote:
Show 12 quoted lines
> 
>> Anyway, this will make each call to git-branch to perform a crawl
>> over the refs/heads hierarchy which, I think, is not worth the
>> result.
> 
> I know branching is lightweight with git, but I don't understand that
> the operation is so performance-critical that a enumerating a
> directory and doing a few stats would be a huge issue...
> 
> If it is decided to only check the 'origin' remote then we're talking
> about one single stat() syscall.
> 

Not really. I don't remember which repository it was, but the "packed-refs" feature came about as a result of one repository having in excess of 120k refs. So your "a few stat() calls" could well end up nuking performance totally for someone else, and "one stat call for origin" is only true if origin only has one ref, which is obviously not the case for some of the larger projects.

In general, assuming everyone else uses a piece of software the same way you do is a recipe for creating poorly performing programs.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Ryan LortieNext: Thomas Rast
Message 9 of 19 in “'git branch' when origin branch with same name exists”
  1. Ryan LortieJun 19, 2012
  2. jaseem abidJun 19, 2012
  3. Michael SchubertJun 19, 2012
  4. Ryan LortieJun 19, 2012
  5. Philippe VaucherJun 19, 2012
  6. Angus HammondJun 19, 2012
  7. Konstantin KhomoutovJun 19, 2012
  8. Ryan LortieJun 19, 2012
  9. Andreas EricssonJun 20, 2012
  10. Thomas RastJun 19, 2012
  11. Junio C HamanoJun 19, 2012
  12. Ryan LortieJun 19, 2012
  13. Junio C HamanoJun 19, 2012
  14. Ryan LortieJun 19, 2012
  15. Phil HordJun 19, 2012
  16. Junio C HamanoJun 20, 2012
  17. Matthieu MoyJun 20, 2012
  18. Junio C HamanoJun 20, 2012
  19. Junio C HamanoJun 19, 2012

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.