Re: [PATCH] Add diff.context option to specify default context
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:45
Possibly related (same subject, not in this thread)
- 2016-06-15 · [PATCH] Add diff.context option to specify default context · Jeff Muizelaar <hidden>
Jeff Muizelaar [off-list ref] writes:
This adds a diff.context config option to allow specifying the number of lines of context. This is similar to Mercurial's 'unified' option.
Random thoughts.
* Please refer to Documentation/SubmittingPatches. Saving your
message in a mbox and applying it would produce this crap:
commit ba4c972eacb91058f1317dbcd4ff77b471fa938e
Author: Jeff Muizelaar [off-list ref]
Date: Fri Sep 14 14:16:03 2012 -0400
Add diff.context option to specify default context
This adds a diff.context config option to allow specifying
the number of lines of context. This is similar to Mercurial's
'unified' option.
commit 1bd81c75de6824c39852bc8516acd0733737ed83
Author: Jeff Muizelaar [off-list ref]
Date: Fri Sep 14 13:55:02 2012 -0400
[PATCH] Add diff.context option to specify default context
This adds a diff.context config option to allow specifying
the number of lines of context. This is similar to
Mercurial's
'unified' option.
which is not acceptable.
* Sign-off your patch.
* Citing similaritly to options in other systems does not add much
value for people who read the proposed log message. In this case,
I think the first sentence is written clearly enough that it is
sufficient without such clarification. If anything, it should
instead say:
diff: diff.context configuration gives default to -U
Introduce a configuration variable diff.context that tells
Porcelain commands to use a non-default number of context
lines instead of 3 (the default). With this variable, users
do not have to keep repeating "git log -U8" from the command
line; instead, it becomes sufficient to say "git config
diff.context 8" just once.
or something like that to make it clear that it is related to our
-U option.
* That relationship with the -U option may worth mentioning in the
documentation, not just in the log message.
* The configuration is read only in diff_ui_config and not in the
lower-level diff_config. What the patch does is the right thing.
It however needs to be documented in the patch to diff-config.txt
that it affects only the Porcelain commands, and does not break
plumbing commands.
* Tests? Minimally, the cases you may want to check are:
- What happens with various values set to this variable, and does
the code properly diagnose errors?
[diff]
context ;# boolean?
context = no
context = 0
context = -1
context = 8
- What happens when the variable is set and the command line gives
a different value with -U?
git config diff.context 8
git log -U4 -1
- Does it really keep plumbing intact?
git config diff.context 8
git diff-files -p
Thanks.