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

Re: misleading diff-hunk header

From
Stefano Lattarini <stefano.lattarini@gmail.com>
Date
Aug 26, 2012, 10:43 UTC
Message-ID
<5039FDD7.2090800@gmail.com>
In-Reply-To
<5038CB66.1040006@tim.thechases.com>
On 08/25/2012 02:56 PM, Tim Chase wrote:
Show 16 quoted lines
> On 08/24/12 23:29, Junio C Hamano wrote:
>> Tim Chase <git@tim.thechases.com> writes:
>>> If the documented purpose of "diff -p" (and by proxy
>>> diff.{type}.xfuncname) is to show the name of the *function*
>>> containing the changed lines,....
>>
>> Yeah, the documentation is misleading, but I do not offhand think of
>> a better phrasing. Perhaps you could send in a patch to improve it.
>>
>> How does GNU manual explain the option?
> 
> Tersely. :-)
> 
>        -p  --show-c-function
>               Show which C function each change is in.
>

That's in the manpage, which is basically just a copy of the output from "diff --help". In the texinfo manual (which is the real documentation), there are additional explanations, saying, among other things:

    To show in which functions differences occur for C and similar languages,
    you can use the --show-c-function (-p) option. This option automatically
    defaults to the context output format (see Context Format), with the
    default number of lines of context. You can override that number with
    -C lines elsewhere in the command line. You can override both the format
    and the number with -U lines elsewhere in the command line.
    The -p option is equivalent to -F '^[[:alpha:]$_]' if the unified format
    is specified, otherwise -c -F '^[[:alpha:]$_]' (see Specified Headings).
    GNU diff provides this option for the sake of convenience.
    ...
    The --show-function-line (-F) option finds the nearest unchanged line
    that precedes each hunk of differences and matches the given regular
    expression.
You can find more information in the on-line documentation:
  <http://www.gnu.org/software/diffutils/manual/diffutils.html>
HTH,
  Stefano
Previous: Tim ChaseNext: Junio C Hamano
Message 13 of 14 in “misleading diff-hunk header”
  1. Tim ChaseAug 21, 2012
  2. Thomas RastAug 21, 2012
  3. Tim ChaseAug 21, 2012
  4. Johannes SixtAug 21, 2012
  5. Junio C HamanoAug 21, 2012
  6. Junio C HamanoAug 21, 2012
  7. Jeff KingAug 24, 2012
  8. Tim ChaseAug 24, 2012
  9. Jeff KingAug 24, 2012
  10. Tim ChaseAug 25, 2012
  11. Junio C HamanoAug 25, 2012
  12. Tim ChaseAug 25, 2012
  13. Stefano LattariniAug 26, 2012
  14. Junio C HamanoAug 26, 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.