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

Re: [PATCH/RFC] gitweb: Great subroutines renaming

From
Junio C Hamano <junkio@cox.net>
Date
Aug 7, 2006, 22:00 UTC
Message-ID
<7v4pwo1a0r.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<eb8cdh$s6n$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> writes:
Show 17 quoted lines
> Currently after rename we have the following git_read_* functions
>
> * git_read_info_refs, which reads .git/info/refs directly and relies on it's
> format
> * git_read_hash which translates ref to hash by reading ref file
> (e.g. .git/refs/heads/master) which means that it doesn't support symrefs
> yet; but first, it should be easy to implement without invoking any git
> command, and second, there are usually no symrefs beside HEAD, and I'm not
> sure that git would work with non-HEAD symref.
> * git_read_refs (or rather git_readdir_refs) which reads .git/refs directory
> * git_read_projects (or rather git_readdir_projects) which checks for
> projects checking if HEAD file exists
> * git_read_description which reads .git/description; but in the future
> description might be stored in repository config
>
> What is also important is the fast that git_read_* functions are fast,
> with exception of git_read_info_refs...

Hmph. readdir-refs is quite bad for future compatibility, so is read_hash.

If you want _fast_ then make the implementation fast (or leave room to make it fast later); encoding the fastness assumption in the name IS WRONG.

For example, sub git_get_hash (not git_read_hash) can stay as (potentially buggy wrt symrefs) "reading from .git/refs/$thing" or could even be fixed to read from git-rev-parse (which is the kosher way). If it turns out to be a bottleneck, it could be rewritten using Git.xs. The same thing for read_refs which I think should be doing ls-remote on the repository if it wants to be kosher.

Show 7 quoted lines
>> The problem is when...
>
> With two scripts attached to the first post in this thread it would be
> simple to apply pre-rename patch, by converting gitweb to pre-rename using
> gitweb-unrename.sh script, then applying patch, then restoring new names
> using gitweb-rename.sh script, and finally comitting changes (or amending
> commit).

That assumes the rename be done now, and nobody introduces new functions following old naming convention in the meantime.

Previous: Jakub NarebskiNext: Jakub Narebski
Message 5 of 30 in “gitweb: Great subroutines renaming”
  1. gitweb: Great subroutines renamingJakub Narebski, Aug 7, 2006
  2. Junio C HamanoAug 7, 2006
  3. Jakub NarebskiAug 7, 2006
  4. Jakub NarebskiAug 7, 2006
  5. Junio C HamanoAug 7, 2006
  6. Jakub NarebskiAug 7, 2006
  7. Jakub NarebskiAug 7, 2006
  8. Junio C HamanoAug 7, 2006
  9. Jakub NarebskiAug 8, 2006
  10. Jakub NarebskiAug 8, 2006
  11. Junio C HamanoAug 8, 2006
  12. Jakub NarebskiAug 8, 2006
  13. Jakub NarebskiAug 8, 2006
  14. Jakub NarebskiAug 8, 2006
  15. Jakub NarebskiAug 9, 2006
  16. Junio C HamanoAug 9, 2006
  17. Jakub NarebskiAug 9, 2006
  18. Junio C HamanoAug 9, 2006
  19. Jakub NarebskiAug 8, 2006
  20. Jakub NarebskiAug 8, 2006
  21. Junio C HamanoAug 8, 2006
  22. Jakub NarebskiAug 8, 2006
  23. Jakub NarebskiAug 9, 2006
  24. Junio C HamanoAug 9, 2006
  25. Jakub NarebskiAug 10, 2006
  26. Jakub NarebskiAug 12, 2006
  27. Junio C HamanoAug 13, 2006
  28. Junio C HamanoAug 13, 2006
  29. Jakub NarebskiAug 13, 2006
  30. Junio C HamanoAug 14, 2006

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.