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

Re: Making literal "20" symbolic

From
Junio C Hamano <junkio@cox.net>
Date
Nov 20, 2006, 10:54 UTC
Message-ID
<7v7ixq4ccc.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200611201049.41024.andyparkins@gmail.com>
Andy Parkins <andyparkins@gmail.com> writes:
Show 11 quoted lines
> I notice that there are a lot of uses of the literal 20 throughout git; I'd 
> like to change them (as appropriate) to HASH_WIDTH, or similar; and maybe 
> HASH_WIDTH_ASCII for the 40s.
>
> Is there a particular header file that is appropriate to put 
>
> #define HASH_WIDTH 20
> #define HASH_WIDTH_ASCII (HASH_WIDTH*2)
>
> Of course, I plan to review each instance to make sure I'm not changing a 
> non-hash width 20.

Probably in cache.h, close to where it defines is_null_sha1(), hashcmp(), and friends, is the right place.

There are few places that say 42 (because we have 40-hex at the beginning of line, followed by a single whitespace and then something should follow so line length must be at least 42 chars), so hunting them all would be a lot of work, but I do think this is a worthwhile cleanup.

Previous: Andy Parkins
Message 2 of 2 in “Making literal "20" symbolic”
  1. Andy ParkinsNov 20, 2006
  2. Junio C HamanoNov 20, 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.