Re: diff settings

9 messages, 5 authors, 2016-06-15 · open the first message on its own page

Re: diff settings

From: Teemu Likonen <hidden>
Date: 2016-06-15 22:46:01

Keith Cascio (2009-01-24 09:38 -0800) wrote:
How do I configure my local git so that diff always obeys a particular
option, e.g. "-w", without needing to type it on the command line each
time?
It seems that the answer is "no", but aliases are a work-around:

    git config --global alias.dff "diff -w"

Then "git dff" is your new "git diff -w". :-)

Re: diff settings

From: Keith Cascio <hidden>
Date: 2016-06-15 22:46:01

It seems that the answer is "no", but aliases are a work-around:

    git config --global alias.dff "diff -w"

Then "git dff" is your new "git diff -w". :-)
That feature is gonna come in handy.  It doesn't 100% fulfill my needs here but 
I like it!  Thanks, I did not know about alias.*

Re: diff settings

From: Ted Pavlic <hidden>
Date: 2016-06-15 22:46:01

quoted
     git config --global alias.dff "diff -w"

Then "git dff" is your new "git diff -w". :-)
That feature is gonna come in handy.  It doesn't 100% fulfill my needs here but
I like it!  Thanks, I did not know about alias.*
Mercurial has a "defaults.*" that does exactly what you want. That is, 
you can say

[defaults]
diff = -w

and "hg diff" will automatically do "hg diff -w". Such a feature might 
be a nice addition to git.

--Ted


-- 
Ted Pavlic [off-list ref]

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

Re: diff settings

From: Keith Cascio <hidden>
Date: 2016-06-15 22:46:01

On Sun, 25 Jan 2009, Ted Pavlic wrote:
Mercurial has a "defaults.*" that does exactly what you want. That is, you can
say

[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.

                            -- Keith

Re: diff settings

From: Ted Pavlic <hidden>
Date: 2016-06-15 22:46:01

quoted
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 [off-list ref]

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

Re: diff settings

From: Ted Pavlic <hidden>
Date: 2016-06-15 22:46:03

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 the other hand, having a "[defaults]" section that only applies when 
commands are called via "git" might be nice. That way you can use the 
"git-CMD" when you want to use CMD without the "[defaults]"... perhaps?)

-- 
Ted Pavlic [off-list ref]

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

Re: diff settings

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:46:03

Hi,

On Thu, 29 Jan 2009, Ted Pavlic wrote:
quoted
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 the other hand, having a "[defaults]" section that only applies when
commands are called via "git" might be nice. That way you can use the
"git-CMD" when you want to use CMD without the "[defaults]"... perhaps?)
Nope, the dash form is deprecated, and once y'all out there finally do not 
write it any more, we can start thinking about _not_ hardlinking the 
builtins to their dashed form anymore.

Believe it or not, we already have a distinction between what is called 
from scripts vs from humans: plumbing vs porcelain.  So you can set the 
defaults for porcelain as much as you want, but please leave plumbing 
alone.

Ciao,
Dscho

Re: diff settings

From: Keith Cascio <hidden>
Date: 2016-06-15 22:46:03

On Thu, 29 Jan 2009, Johannes Schindelin wrote:
we already have a distinction between what is called from scripts vs from 
humans: plumbing vs porcelain.  So you can set the defaults for porcelain as 
much as you want, but please leave plumbing alone.
May we consider "git diff" Porcelain and "git diff-{files,index,tree}" plumbing?

Re: diff settings

From: Nanako Shiraishi <hidden>
Date: 2016-06-15 22:46:03

Quoting Keith Cascio [off-list ref]:
On Thu, 29 Jan 2009, Johannes Schindelin wrote:
quoted
we already have a distinction between what is called from scripts vs from 
humans: plumbing vs porcelain.  So you can set the defaults for porcelain as 
much as you want, but please leave plumbing alone.
May we consider "git diff" Porcelain and "git diff-{files,index,tree}" plumbing?
Sure we may. To see the list of commands with categories, you can consult

http://www.kernel.org/pub/software/scm/git/docs/

Junio, I think you could have stated this a bit more clearly in your message

http://thread.gmane.org/gmane.comp.version-control.git/107069/focus=107165

to avoid confusion, especially when you know you are talking to somebody new to git.

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help