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

Re: [BUG] Highly inconsistent diff UI

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 29, 2013, 16:32 UTC
Message-ID
<7vhaipl2ks.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0n9xqQr30QWEuhuM9c1xrAJ=SpYVBjkiRk+tP5E7DtBGw@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 11 quoted lines
> Okay, so the point I was trying to make is:
>
> The range version of $(git merge-base A B) B is B ^$(git merge-base A
> B), and not B --not $(git merge-base --all A B) [which is equivalent
> to B ^A or A..B].
>
> Junio C Hamano wrote:
>> I dunno.  The description you gave was insufficient for me to answer
>> that question.
>
> Sorry about that.  I'll rewrite it as a set of commands:
[now that a few days have passed...]

Please don't. All of these clayoven, LICENSE, foom, loom are mere distraction.

	... goes and draws the diagram himself ...
   > $ git clone gh:artagnon/clayoven
   > $ cd clayoven
A  > $ git checkout -b pu master~10
   > $ echo "foom" >>LICENSE
B  > $ git commit -a -m "Change in pu"
C  > $ git checkout -b rebase.autostash master~5
   > $ echo "loom" >> clayoven.gemspec
D  > $ git commit -a -m "Change in rebase.autostash"
E  > $ git checkout master
F  > $ git merge pu
   > $ git checkout rebase.autostash
G  > $ git merge pu
   > $ echo "quux" >>Gemfile
H  > $ git commit -a -m  "Change 2 in rebase.autostash"
So you have this:
                        (pu)        (master-updated)
        .-----------------B--------------F
       /                   \            /
      /                 D---G---H      /
     /                 /              / 
 ---A-----------------C--------------E
  (master~10)     (master~5)      (master-old) 

In the beginning, master was at E, but at the end, it is moved to F. The tip of your topic is at H.

> $ git log rebase.autostash ^master
That is range "F..H", which lists "H G D".
> $ git log rebase.autostash --not $(git merge-base --all rebase.autostash master)

The merge bases between F and H are B and C, so that is range "^B ^C H", which again lists "H G D".

> $ git log rebase.autostash ^$(git merge-base rebase.autostash master)
Depending on which one of B or C is chosen it is either one of these:
 - range "^B H" which lists "H G D C"
 - range "^C H" which lists "H G D B"

neither of which is more useful than "H G D", as it shows irrelevant "other merge base" you did not pick.

> $ git diff rebase.autostash ^$(git merge-base rebase.autostash master)

This will show either "diff B H", which is work done by G and H, or "diff C H", which is work done by D thru H. In the former, "the work done by G" includes what was done by A..D, which are mostly irrelevant to explain what you did on your topic, but you asked for it. In the latter, "the work done by G" is what was done by A..B, which again are not what D and H did.

The example explains why you should not merge other's work to your topic branch [*1*], but does not say anything about usefulness of A...B vs A~B.

> To summarize: B ^(git merge-base A B) [the current ... syntax of git
> diff] has no exact equivalent in the log world.  

Nor does "log" need one. See how picking either B or C and omitting the other would produce worse result than excluding all merge bases, which log F..H would naturally does.

> Therefore, no matter
> which existing rev spec we overload, we can never get the current ...
> for diff in a consistent manner.
As "log" does not need any such thing, that is irrelevant, no?
> We certainly know that 'git diff A~B' is going to be useful,...

We certainly know it is an unnecessary "there is another way to spell the same thing we have been using for a long time".

You did not give anything new that hints that it might be worth spending time listening to you in this message. Should I do a "kill file for a few days" thing again?

[Footnote]

*1* Instead, you have a separate integration branch for testing that merges other's work and your topic.

Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 37 of 45 in “[BUG] Highly inconsistent diff UI”
  1. Ramkumar RamachandraApr 24, 2013
  2. Jonathan NiederApr 24, 2013
  3. Junio C HamanoApr 24, 2013
  4. Ramkumar RamachandraApr 24, 2013
  5. Jonathan NiederApr 24, 2013
  6. Junio C HamanoApr 24, 2013
  7. Ramkumar RamachandraApr 24, 2013
  8. Junio C HamanoApr 24, 2013
  9. Ramkumar RamachandraApr 24, 2013
  10. Junio C HamanoApr 24, 2013
  11. Ramkumar RamachandraApr 24, 2013
  12. Ramkumar RamachandraApr 24, 2013
  13. Junio C HamanoApr 24, 2013
  14. Ramkumar RamachandraApr 24, 2013
  15. Junio C HamanoApr 24, 2013
  16. Ramkumar RamachandraApr 24, 2013
  17. Thomas RastApr 24, 2013
  18. Ramkumar RamachandraApr 24, 2013
  19. Jonathan NiederApr 24, 2013
  20. Ramkumar RamachandraApr 24, 2013
  21. Thomas RastApr 25, 2013
  22. Ramkumar RamachandraApr 25, 2013
  23. Junio C HamanoApr 25, 2013
  24. Ramkumar RamachandraApr 25, 2013
  25. Jonathan NiederApr 25, 2013
  26. Junio C HamanoApr 25, 2013
  27. Duy NguyenApr 26, 2013
  28. Phil HordApr 24, 2013
  29. Junio C HamanoApr 24, 2013
  30. Ramkumar RamachandraApr 24, 2013
  31. Ramkumar RamachandraApr 24, 2013
  32. Junio C HamanoApr 25, 2013
  33. Ramkumar RamachandraApr 25, 2013
  34. Ramkumar RamachandraApr 25, 2013
  35. Ramkumar RamachandraApr 26, 2013
  36. Ramkumar RamachandraApr 26, 2013
  37. Junio C HamanoApr 29, 2013
  38. Ramkumar RamachandraApr 29, 2013
  39. Junio C HamanoApr 29, 2013
  40. Ramkumar RamachandraApr 29, 2013
  41. Ramkumar RamachandraApr 29, 2013
  42. Junio C HamanoApr 29, 2013
  43. Ramkumar RamachandraApr 29, 2013
  44. John KeepingApr 29, 2013
  45. Ramkumar RamachandraApr 25, 2013

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.