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

Re: [TopGit PATCH] tg-create.sh: Introduce --add option to add a dependency.

From
Jonathan Nieder <jrnieder@uchicago.edu>
Date
Aug 13, 2008, 16:20 UTC
Message-ID
<Pine.GSO.4.62.0808131100280.1278@harper.uchicago.edu>
In-Reply-To
<1218637514.7561.30.camel@heerbeest>
Hi,
Jan Nieuwenhuizen wrote:
Show 6 quoted lines
> The bad thing is that this does not play well with tg undepend;
> it won't work to re-add a previously removed dependency.  This
> --add is implemented as a merge, and all merge commits are
> already present; it is only that lateron they are reverted.
> 
> Any ideas on how to fix that?

Interesting - I had imagined changing dependencies working in an entirely different way.

Let's say your history is
    B -- (some mess) -- P

where P is your current branch head, and B is the current top base, a merge of all your current dependencies. Now you change your dependencies drastically, and you end up with a new top base B'. Then ideally you want your new branch head P' to have the same tree as if you had run "git rebase --onto B' B P", but of course you want to preserve the history, so you could

	$ git checkout -b P' P
	$ git rebase --onto B' B
	$ git checkout P
	$ git merge --no-ff --no-commit B'   (*)
	$ git read-tree -u P'
	$ git commit
	$ git branch -D P'

or something like that. The line marked with a (*) doesn't work as it should in current git as far as I remember, but it would be a simple change. The point is to achieve the result

    B -- (some mess) -- old P -- P
                                /
                              B'

with the diff from B to old P being approximately the same as the diff from B' to P, even if we just dropped some dependencies.

The main problem I see with this story is that if B' is just B with some new changes added this is overly complicated. In other words, in the simple case of moving from (say) a patch based on master to a patch based on next, one would probably prefer

    B -- (some mess) -- old P -- P
     \                         /
      ---------------------- B'

and similarly for moving from depending on master+(one additional patch) to next+(that same patch).

Hope this helps, and sorry I don't have something more constructive to say. Thanks for starting this going.

Jonathan
Previous: Jan NieuwenhuizenNext: Jan Nieuwenhuizen
Message 2 of 5 in “tg-create.sh: Introduce --add option to add a dependency.”
  1. tg-create.sh: Introduce --add option to add a dependency.Jan Nieuwenhuizen, Aug 13, 2008
  2. Jonathan NiederAug 13, 2008
  3. Jan NieuwenhuizenAug 15, 2008
  4. Jonathan NiederAug 15, 2008
  5. Jan NieuwenhuizenAug 18, 2008

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.