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

Re: BUG: "git checkout" displays Q-escaped commit titles

From
Jeff King <peff@peff.net>
Date
May 4, 2008, 19:45 UTC
Message-ID
<20080504194541.GD13029@sigill.intra.peff.net>
In-Reply-To
<7vlk2qsukd.fsf@gitster.siamese.dyndns.org>
On Sat, May 03, 2008 at 06:54:10PM -0700, Junio C Hamano wrote:
Show 8 quoted lines
> > .... It seems like pp_title_line should perhaps just be checking
> > for fmt == CMIT_FMT_EMAIL, but I'm not sure if that would break anything
> > else,...
> 
> Yeah, your patch obviously would fix the caller, as subject and
> after_subject should not be given unless you are doing FMT_EMAIL.  But I
> also think we should not even look at subject and after_subject unless fmt
> is CMIT_FMT_EMAIL inside pp_title_line().

It took a look, and that feels a little wrong, too; we end up with a function that ignores half of its parameters based on the value of one of the other parameters, which makes me feel that it really should be two separate functions.

So maybe there is some heavier refactoring to be done there. In general, I think pretty_print has gotten a bit messy because of the increase in the number of formats. We might do better to turn it "inside out": rather than going sequentially through and switching each stage on the format type, make a set of good utility functions and have each format type implemented as a function that builds out of the utility primitives.

I also think we can turn several of the formats into --pretty=format: aliases, which should make the code a lot simpler. I had also wanted to add a few features (one of them was giving pretty printing more context of the tree walk, so you could do things like --pretty=format:'Patch X/Y: %s' where X and Y would be substitutions for "current number in walk" and "total number in walk."

I can try to take a look at that sometime in the next week or so, though I expect it is major enough surgery to be for the next release cycle.

-Peff
Previous: Junio C Hamano
Message 4 of 4 in “BUG: "git checkout" displays Q-escaped commit titles”
  1. Teemu LikonenMay 2, 2008
  2. Jeff KingMay 2, 2008
  3. Junio C HamanoMay 4, 2008
  4. Jeff KingMay 4, 2008

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.