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

Re: [PATCH] Add diff.context option to specify default context

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 14, 2012, 21:06 UTC
Message-ID
<7vobl82u26.fsf@alter.siamese.dyndns.org>
In-Reply-To
<A74D9034-E5BA-4CD5-B621-1C388EF4CE2B@mozilla.com>
Jeff Muizelaar <jmuizelaar@mozilla.com> 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 <jmuizelaar@mozilla.com>
    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 <jmuizelaar@mozilla.com>
        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.
Previous: Jeff MuizelaarNext: Jeff Muizelaar
Message 2 of 8 in “Add diff.context option to specify default context”
  1. Add diff.context option to specify default contextJeff Muizelaar, Sep 14, 2012
  2. Junio C HamanoSep 14, 2012
  3. diff: diff.context configuration gives default to -UJeff Muizelaar, Sep 27, 2012
  4. Junio C HamanoSep 27, 2012
  5. Jeff KingSep 27, 2012
  6. diff: diff.context configuration gives default to -UJeff Muizelaar, Sep 27, 2012
  7. Junio C HamanoSep 27, 2012
  8. diff: diff.context configuration gives default to -UJeff Muizelaar, Oct 19, 2012

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.