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

Re: Itches with the current rev spec

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 29, 2013, 16:05 UTC
Message-ID
<7vobcxl3ui.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0=W_FxDwc3Tby=h90yc5i8UEuT7maERahFRDQU=hQ633g@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 6 quoted lines
>>  - If the UI language for "rebase" were designed following the
>>    "composition using common elements like ranges and revisions"
>>    school, it would have started from "rebase --onto=X A..B".
>
> I think you're looking at the whole issue backwards from the way I
> look at it.

I am not "looking at" anything. I was giving the historical background to explain how the current UI language came to be, but that was not to argue for keeping it to be the way it is, or even to justify that it is the right UI.

> Let's try to lay out some fundamental principles and
Very interesting.
Show 7 quoted lines
> 3. "Range" is not an inherent property of A..B or A...B.  There are no
> "revision ranges".
>
> 4. Every command is free to interpret positive and negative commits as
> it sees fit.  Since there is no ordering, it must never treat one
> negative commit differently from another negative commit, or one
> positive commit differently from another positive commit.

That world view is broken, isn't it? Perhaps you forgot to consider symmetric differences, where left positives and right positives have to be treated differently. "diff A B" and "diff B A" mean very different things, for that matter. A line of thought that begins with "there is no ordering" may be a "brave proposal", perhaps, but it is not "fundamental principles".

If you do not like the word "range", read it as a DAG.

"rebase requires three: onto, list and a ref" (by the way, it is not refspec, which has a specific meaning) is trapped by the limitation of its current UI language that came from the "workflow" school and missing what the operation really means.

rebase takes a DAG with one negative commit, and replays it to form an isomorphic DAG on top of another commit. At the essential level, it takes two pieces of information, such a DAG and an "onto" commit.

But in the current UI, the way to specify these two things are by giving three commits, i.e. --onto=ONTO ONE_NEGATIVE ONE_POSITIVE. The positive is used to specify which ref to update.

It is not far-fetched to allow rebase to handle a history with two branches A and B that share the common initial part (i.e. ^X A B) and replay that history on top of an unrelated point in history Y to transform:

             o---o---Y
            /
    ---o---X---C---C---A---A---A (tip of branch A)
                    \
                     B---B---B (tip of branch B)
into
             o---o---Y---C'--C'--A'--A'--A' (updated tip of branch A)
            /         \
    ---o---X           B'--B'--B' (updated tip of branch B)

But the "rebase one branch on a new base" UI that came from the "workflow" school is unable to express such an operation. The pieces of information we are using in the above are:

 * Where the bottom of the DAG being replayed is (i.e. X);
 * What refs are the top of the DAG (i.e. A and B);
 * Where the new bottom of the replayed DAG (i.e. Y).

So if we are refining the rebase UI, while making sure we can later extend it, we shouldn't start from "onto, list and a ref". We should start from "a single onto, a single bottom, and one or more refs that define tops".

> constraint remains: rebase _cannot_ make this --onto= parameter part
> of the normal rev spec

So what? Why do you even _need_ to mix up all positive revisions, some of which mean different things from others, into a single bag, only to later differenciate some as special (i.e. used as the onto commit) from the others (i.e. the tips in the DAG)? If something is special, you can say not just it is special and can say what it means by saying "this is where I want to replay the DAG on top".

A much larger issue is that the current setup_revisions() infrastructure does not let us express an operation that involves two or more DAGs. People sometimes wish to say an equivalent of

    git show $(git rev-list A..B) $(git rev-list C..D)
but obviously
    git show A..B C..D
is not the way to say it, and this limitation comes from it.
Previous: Yann DirsonNext: Ramkumar Ramachandra
Message 18 of 24 in “Itches with the current rev spec”
  1. Ramkumar RamachandraApr 25, 2013
  2. Ramkumar RamachandraApr 25, 2013
  3. Matthieu MoyApr 25, 2013
  4. Felipe ContrerasApr 25, 2013
  5. Ramkumar RamachandraApr 25, 2013
  6. Michael J GruberApr 29, 2013
  7. Andreas SchwabApr 25, 2013
  8. Ramkumar RamachandraApr 25, 2013
  9. Phil HordApr 25, 2013
  10. Yann DirsonApr 26, 2013
  11. Johannes SixtApr 26, 2013
  12. Ramkumar RamachandraApr 26, 2013
  13. Junio C HamanoApr 26, 2013
  14. Felipe ContrerasApr 26, 2013
  15. Junio C HamanoApr 26, 2013
  16. Ramkumar RamachandraApr 29, 2013
  17. Yann DirsonApr 29, 2013
  18. Junio C HamanoApr 29, 2013
  19. Ramkumar RamachandraApr 29, 2013
  20. Junio C HamanoApr 29, 2013
  21. Ramkumar RamachandraApr 29, 2013
  22. Ramkumar RamachandraApr 29, 2013
  23. Junio C HamanoApr 30, 2013
  24. Ramkumar RamachandraApr 29, 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.