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

Re: diff settings

From
Ted Pavlic <ted@tedpavlic.com>
Date
Jan 26, 2009, 02:06 UTC
Message-ID
<497D1AB7.7000208@tedpavlic.com>
In-Reply-To
<alpine.GSO.2.00.0901251307030.12651@kiwi.cs.ucla.edu>
Show 8 quoted lines
>> Mercurial has a "defaults.*" that does exactly what you want. That is, you can
>> [defaults]
>> diff = -w
>> and "hg diff" will automatically do "hg diff -w". Such a feature might be a
>> nice addition to git.
> Thank you, that is very interesting.  I just submitted a patch this morning that
> does exactly what you describe, but I called it "primer" instead of "defaults"
> because it seemed more explicit.  Check it out.

I saw that. However, in Mercurial's case, the [defaults] section applies to all commands (including new ones introduced by extensions). That is, it looks like your patch adds a diff.primer, but Mercurial would add a primer.* that allows you to have a primer.diff, primer.commit, etc.

For example, wouldn't it be nice to have something like...

[defaults] diff = -w commit = -a

etc.? Right now the only way you can do that is with aliases (e.g., I have an alias from "ci" to "commit -a").

This task is pretty easy in Mercurial because Mercurial porcelains are implemented as modules that are all executed through the central "hg" command. This isn't the case with git.

(on a somewhat unrelated note, Mercurial does have a [diff] section that allows for, say, forcing the use of git diff and other things)

--Ted
-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.
Previous: Keith CascioNext: Ted Pavlic
Message 7 of 13 in “diff settings”
  1. Keith CascioJan 24, 2009
  2. Jeff KingJan 24, 2009
  3. Teemu LikonenJan 24, 2009
  4. Keith CascioJan 24, 2009
  5. Ted PavlicJan 25, 2009
  6. Keith CascioJan 25, 2009
  7. Ted PavlicJan 26, 2009
  8. Ted PavlicJan 29, 2009
  9. Johannes SchindelinJan 29, 2009
  10. Keith CascioJan 29, 2009
  11. Nanako ShiraishiJan 29, 2009
  12. Ted PavlicJan 31, 2009
  13. Keith CascioJan 31, 2009

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.