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

Re: git diff odds

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 26, 2008, 02:19 UTC
Message-ID
<alpine.LFD.1.00.0803251914150.2775@woody.linux-foundation.org>
In-Reply-To
<200803260100.m2Q10v2l005189@localhost.localdomain>
On Wed, 26 Mar 2008, Xavier Maillard wrote:
> 
> With LESS variable set as "-M", git diff displays escape sequence
> instead of the colored ouput (as requested in my .git/config =>
> color.diff=auto).

That's how 'less' works. It shows escape sequences as the escapes by default.

> If set to FRSX, it works perfectly.
It's the '-R' part that does the magic.
> Is this a bug ?
No, it's documented less behaviour. See "man less".

If you want to use "-M", you can mix it with R (or the other flags, for that matter) and use "LESS=MR" or "LESS=FRSXM" or whatever you like. But if you want less to pass through colors, you need that R there somewhere.

(You could use lower-case "r" too, but that's very dangerous, since it lets through _all_ escape sequences, including the ones that really screw up your terminal experience)

		Linus
Previous: Xavier MaillardNext: Xavier Maillard
Message 2 of 3 in “git diff odds”
  1. Xavier MaillardMar 26, 2008
  2. Linus TorvaldsMar 26, 2008
  3. Xavier MaillardMar 27, 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.