git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Mike McGranahan <mike@mcgwiz.com>,
	git@vger.kernel.org
Subject: Re: Patch text in git-add patch mode lacks whitespace highlighting
Date: Tue, 04 Feb 2020 10:29:53 -0800	[thread overview]
Message-ID: <xmqqlfpi8au6.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20200203145155.GA272077@coredump.intra.peff.net> (Jeff King's message of "Mon, 3 Feb 2020 09:51:55 -0500")

Jeff King <peff@peff.net> writes:

> If just the human-readable one, then many options that change the line
> count would be problems: diff.context, diff.interhunkcontext,
> diff.orderfile, etc.
>
> If both, then some options would be problematic for applying. Just
> looking over the list, these jump out at me:
>
>   - color.diff=always would obviously be an issue (though TBH I think
>     anybody doing that is inviting a lot of breakages anyway)
>
>   - diff.external would be a problem if it kicked in, though I think it
>     would require --ext-diff to actually do anything
>
>   - diff.submodule would generate diffs that can't be applied

What can truly help "git add -p" might be a new output mode from
"git diff", perhaps, in which instead of writing a stream of text
(with color codes intermixed), the output machinery makes a call to
API-user supplied callbacks to report ("type of output line", "the
payload", "list of coloring information") tuples for each line, so
that the API-user can synthesize _both_ versions it currently uses
with a single invocation of "diff"?  There may be tons of "output
line" types, like the diff header, hunk header, context, removed,
added, etc., and depending on the type, the form the payload takes
may be different (e.g. a context line may be just a plain text, a
hunk header line may be a five-tuple (pre- and post-context line
numbers and line countsm plus the function-header line text).

As long as the call the API-user makes to the diff machinery grabs
everything that is needed for both human and machine consumption in
a single call, there is no risk of getting confused by two sets of
inconsistent patch data.



  reply	other threads:[~2020-02-04 18:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 21:53 Patch text in git-add patch mode lacks whitespace highlighting Mike McGranahan
2020-01-31  9:19 ` Jeff King
2020-01-31  9:57   ` [PATCH] diff: move diff.wsErrorHighlight to "basic" config Jeff King
2020-02-01  0:48   ` Patch text in git-add patch mode lacks whitespace highlighting Mike McGranahan
2020-01-31 12:37 ` Johannes Schindelin
2020-02-01  0:49   ` Mike McGranahan
2020-02-01 11:02   ` Jeff King
2020-02-01 21:06     ` Johannes Schindelin
2020-02-03  8:54       ` Jeff King
2020-02-03 12:37         ` Johannes Schindelin
2020-02-03 14:51           ` Jeff King
2020-02-04 18:29             ` Junio C Hamano [this message]
2020-02-04 19:57               ` Jeff King
2020-02-04 19:04             ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqlfpi8au6.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=mike@mcgwiz.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).