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

Re: RFC: Using '--no-output-indicator-old' to only show new state

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 10, 2022, 20:40 UTC
Message-ID
<CAHk-=wg+n_-btzoyMqnDYsJxFYAyUh0Kb=TkpS8RiD_h3G=_cA@mail.gmail.com>
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
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 11 in “RFC: Using '--no-output-indicator-old' to only show new state”
  1. Linus TorvaldsMar 10, 2022
  2. Junio C HamanoMar 10, 2022
  3. Linus TorvaldsMar 10, 2022
  4. Junio C HamanoMar 10, 2022
  5. Linus TorvaldsMar 10, 2022
  6. Linus TorvaldsMar 11, 2022
  7. Ævar Arnfjörð BjarmasonMar 11, 2022
  8. parse-options: add per-option flag to stop abbreviationÆvar Arnfjörð Bjarmason, Mar 11, 2022
  9. Linus TorvaldsMar 11, 2022
  10. Linus TorvaldsMar 11, 2022
  11. Konstantin RyabitsevMar 11, 2022

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.