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

Re: [PATCH RFC] cherry: support --abbrev option

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Mar 15, 2010, 23:16 UTC
Message-ID
<4B9EBFEB.5070108@lsrfire.ath.cx>
In-Reply-To
<40aa078e1003151530y19f10bf1l852a0e5230b11cb6@mail.gmail.com>
Am 15.03.2010 23:30, schrieb Erik Faye-Lund:
Show 6 quoted lines
> On Mon, Mar 15, 2010 at 6:08 PM, René Scharfe
>> If I use --no-abbrev, do I get 0 or 40 hash chars?  I didn't actually
>> test it, but I suspect an "if (!abbrev) abbrev = 40;" is needed somewhere.
> 
> "abbrev" is initialized to 40 when declared, so you get the same
> behavior as before by default.

Yes, but --no-abbrev sets it to zero. Which is OK, though, as I found out after actually testing your patch this time. A closer look at find_unique_abbrev() in sha1_name.c reveals that the function returns the full hash if len is either 40 or 0.

So you could initialize abbrev to zero and avoid the magic constant 40 there altogether. (Is this still nitpicking or already bikeshedding? ;)

René
Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 4 of 10 in “cherry: support --abbrev option”
  1. cherry: support --abbrev optionErik Faye-Lund, Mar 15, 2010
  2. René ScharfeMar 15, 2010
  3. Erik Faye-LundMar 15, 2010
  4. René ScharfeMar 15, 2010
  5. Erik Faye-LundMar 15, 2010
  6. René ScharfeMar 16, 2010
  7. Erik Faye-LundMar 16, 2010
  8. Junio C HamanoMar 16, 2010
  9. Junio C HamanoMar 15, 2010
  10. Erik Faye-LundMar 15, 2010

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.