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

Re: [PATCH v5 2/3] diff: add --diff-line-prefix option for passing in a prefix

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 14, 2016, 21:21 UTC
Message-ID
<xmqqa8gfkpw1.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CA+P7+xp_sPk6P1qyyDfOgpkXU1GxWPivfSzvveS4PAvGb-=ggQ@mail.gmail.com>
Jacob Keller <jacob.keller@gmail.com> writes:
Show 16 quoted lines
> On Fri, Aug 12, 2016 at 2:58 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> On Fri, Aug 12, 2016 at 2:43 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
>>> Ok so the big problem here is that unlike with diff which has support
>>> for line-prefixes already due to needing it for graph mode, I can't
>>> figure out where to get the prefix added for log output.
>>
>> Doesn't the --graph mode show the graph lines already? I think most
>> if not all of that processing happens inside log-tree.c::show_log().
>
> Yes but the problem is how to get this additional prefix to be displayed for
>
> (a) non graph mode
> (b) for graph mode but display the prefix before the graph prefix
>
> It doesn't seem straight forward, and I haven't figured out how the
> graph code already works.

Because you only need "diff --line-prefix" to work while leaving "log --line-prefix" broken for the purpose of your immediate purpose to update "diff/log [--graph and other options] --submodule=<type>" to show "diff A B" in the submodule, I think it is OK to leave it broken, as long as it is clearly documented that "--line-prefix" should also apply to the log message part but the current code doesn't. Eventually, when somebody wants to add a new <type> that runs "log -p A..B" instead of "diff A B" in submodules and wants to make it interact well with "log --graph" at the superproject level, they need to fix the breakage you leave behind. That would be much better than "because I cannot figure out how to prefix on the log part, I'll name this --diff-line-prefix", which will force us to support that half-baked option forever while having to add a proper "--line-prefix" eventually anyway.

Previous: Jacob KellerNext: Jacob Keller
Message 7 of 10 in “diff.c: remove output_prefix_length field”
  1. 1/3 diff.c: remove output_prefix_length fieldJacob Keller, Aug 11, 2016
  2. 2/3 diff: add --diff-line-prefix option for passing in a prefixJacob Keller, Aug 11, 2016
  3. Junio C HamanoAug 12, 2016
  4. Jacob KellerAug 12, 2016
  5. Jacob KellerAug 12, 2016
  6. 3/3 diff: add SUBMODULE_DIFF format to display submodule diffJacob Keller, Aug 11, 2016
  7. Junio C HamanoAug 14, 2016
  8. Jacob KellerAug 15, 2016
  9. Junio C HamanoAug 15, 2016
  10. Jacob KellerAug 15, 2016

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.