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

Re: [PATCH v2 2/3] pretty: make %H/%h dependent on --abbrev[-commit]

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 26, 2010, 03:38 UTC
Message-ID
<20100426033813.GA30544@progeny.tock>
In-Reply-To
<20100426033147.GB14421@coredump.intra.peff.net>
Jeff King wrote:
Show 29 quoted lines
> On Sun, Apr 25, 2010 at 10:11:37PM -0500, Jonathan Nieder wrote:
>
>> Here’s an alternative implementation of the more controversial half of
>> your patch, for your amusement.  The big downside is that it requires
>> one to specify --abbrev-commit before the --format option.
>
> That is not insurmountable, as we could just check after the parsing
> stage. But there is a worse problem:
>
>> +static void abbreviate_commit_hashes(char *fmt)
>> +{
>> +	char *p;
>> +	for (p = fmt; p != NULL; p = strchr(p + 1, '%')) {
>> +		p++;
>> +		switch (*p) {
>> +		case 'H':
>> +			*p = 'h';
>> +			break;
>> +		case 'P':
>> +			*p = 'p';
>> +			break;
>> +		case 'T':
>> +		default:
>> +			break;
>> +		}
>> +	}
>> +}
>
> You parse '%%H' incorrectly.
I’m pretty sure I don’t.
> I would really rather not see ad-hoc
> parsers for the format like this, but rather use or extend strbuf_expand
> as appropriate. That would make things less painful if and when we
> decide to tweak the syntax.
However, this point still applies.
Jonathan
Previous: Jeff KingNext: Jonathan Nieder
Message 10 of 27 in “pretty: format aliases”
  1. 0/3 pretty: format aliasesWill Palmer, Apr 25, 2010
  2. 1/3 pretty: add conditional %C?colorname placeholdersWill Palmer, Apr 25, 2010
  3. 2/3 pretty: make %H/%h dependent on --abbrev[-commit]Will Palmer, Apr 25, 2010
  4. 3/3 pretty: add aliases for pretty formatsWill Palmer, Apr 25, 2010
  5. Jonathan NiederApr 26, 2010
  6. Will PalmerApr 26, 2010
  7. Will PalmerApr 26, 2010
  8. Jonathan NiederApr 26, 2010
  9. Jeff KingApr 26, 2010
  10. Jonathan NiederApr 26, 2010
  11. Jonathan NiederApr 26, 2010
  12. Jeff KingApr 26, 2010
  13. Jeff KingApr 26, 2010
  14. Will PalmerApr 26, 2010
  15. Jonathan NiederApr 26, 2010
  16. 1/4 t4201 (shortlog): guard setup with test_expect_successJonathan Nieder, Apr 26, 2010
  17. 2/4 t4201 (shortlog): Test output format with multiple authorsJonathan Nieder, Apr 26, 2010
  18. 3/4 shortlog: Document and test --format optionJonathan Nieder, Apr 26, 2010
  19. 4/4 pretty: Respect --abbrev optionJonathan Nieder, Apr 26, 2010
  20. Will PalmerApr 26, 2010
  21. Jonathan NiederApr 26, 2010
  22. Will PalmerApr 26, 2010
  23. Jonathan NiederApr 26, 2010
  24. Jonathan NiederApr 26, 2010
  25. Jeff KingApr 26, 2010
  26. Jonathan NiederApr 26, 2010
  27. Jeff KingApr 26, 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.