git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git List Mailing <git@vger.kernel.org>
Subject: Re: RFC: Using '--no-output-indicator-old' to only show new state
Date: Thu, 10 Mar 2022 12:40:06 -0800	[thread overview]
Message-ID: <CAHk-=wg+n_-btzoyMqnDYsJxFYAyUh0Kb=TkpS8RiD_h3G=_cA@mail.gmail.com> (raw)
In-Reply-To: <xmqqo82dd0qv.fsf@gitster.g>

On Thu, Mar 10, 2022 at 12:13 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Sounds like the "apply --no-add" in the opposite direction ;-)

I was thinking more the opposite of "--ours/theirs" when merging, but
yeah, I guess "--no-add" is technically even closer.

> I would find it handy myself, too, though I tend to read my patches
> after applying to my tree so the postimage is usually an invocation
> of "less" away for me.

Obviously just looking at the file itself is always an option, and I
do that too. But I traditionally do that "grep -v" trick as I'm
verifying the patch before sending it out (or before committing)
because it's such a nice way to limit the output just to the changed
parts.

> I do not think it is a bad idea to have an option to give only the
> postimage and another option to give only the preimage.  It would
> also trivially allow people to show the side-by-side diff in GUI.

I suspect people doing GUI's are happy just parsing the '-' and '+'
lines themselves, since they want both sides anyway.

For example, 'gitk' already has that diff/old/new checkbox, that does
exactly what my patch does.

And I doubt anybody wants gitk to re-run 'diff' just because somebody
clicked another option - it's only used to visualize the diff that was
already done differently.

Of course, I might be wrong. I didn't actually look at what 'gitk'
does. Maybe it _does_ re-run diff when you click that thing.

But that gitk behavior - which I also do use - is probably the best
way to explain the feature.  It's just that I also want to get that
"New version" behavior for plain "git diff" on the command line.

I don't know what a good command line option would be, though. I'd
like it to be somehat short, because the whole point of this is to be
a convenience feature.

So "--new/old"? "--pre/post"?

Or it could be something random, and tie it with the existing "-U"
option, where "-U+" would be "positive side only", and "-U5-" would be
"5 context lines, negative side only". Very dense and convenient,
maybe not all that intuitive?

                 Linus

  reply	other threads:[~2022-03-10 20:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 19:40 RFC: Using '--no-output-indicator-old' to only show new state Linus Torvalds
2022-03-10 20:13 ` Junio C Hamano
2022-03-10 20:40   ` Linus Torvalds [this message]
2022-03-10 21:26     ` Junio C Hamano
2022-03-10 22:13       ` Linus Torvalds
2022-03-11  0:01         ` Linus Torvalds
2022-03-11  7:48           ` Ævar Arnfjörð Bjarmason
2022-03-11  9:45             ` [PATCH] parse-options: add per-option flag to stop abbreviation Ævar Arnfjörð Bjarmason
2022-03-11 18:44               ` Linus Torvalds
2022-03-11 19:15             ` RFC: Using '--no-output-indicator-old' to only show new state Linus Torvalds
2022-03-11 19:42               ` Konstantin Ryabitsev

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

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

  git send-email \
    --in-reply-to='CAHk-=wg+n_-btzoyMqnDYsJxFYAyUh0Kb=TkpS8RiD_h3G=_cA@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
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 NNTP newsgroup(s).