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

Re: [TopGit PATCH] tg redepend: New command.

From
Jonathan Nieder <jrnieder@uchicago.edu>
Date
Aug 15, 2008, 18:20 UTC
Message-ID
<Pine.GSO.4.62.0808151241300.17250@harper.uchicago.edu>
In-Reply-To
<1218808427.25300.2.camel@heerbeest>
Hi,
Jan Nieuwenhuizen wrote:
Show 13 quoted lines
> As discussed previously
> 
>     http://kerneltrap.org/mailarchive/git/2008/8/13/2925144
> 
> Change a topgit branch's dependencies by doing a rebase-by-merge.
> 
> Signed-off-by: Jan Nieuwenhuizen <janneke@gnu.org>
> ---
>  Makefile       |    2 +-
>  README         |    5 ++
>  tg-redepend.sh |  154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 160 insertions(+), 1 deletions(-)
>  create mode 100644 tg-redepend.sh
[...]
> +		-h|--help)
> +			echo "Usage: tg [--add|--remove] DEPENDENCY..." >&2
s/tg/tg redepend/?
[...]
Show 5 quoted lines
> +# Create new base B' -- does not have to be a topgit branch, but that's easiest
> +if [ -z "$restarted" ]; then
> +	git branch -D $p_  > /dev/null 2>&1 || :
> +
> +	tg create $b_ $redeps

Why not move the base-creation code in tg-create.sh to a new function in tg.sh to use here?

[...]
Show 6 quoted lines
> +if [ "$restarted" != "merge" ]; then
> +	git checkout $(git rev-parse $p)
> +	if ! git merge --no-ff --no-commit $b_; then
> +		touch "$git_dir/top-merge"
> +		fail merge
> +	fi
[snip continuing-a-merge case]
> +fi
> +git read-tree -m -u $(git rev-parse $p_)
[snip topdeps juggling]
> +git commit -m "Rebased-using-merge onto new dependencies: $redeps."  > /dev/null 2>&1

I know I suggested that code before, but the merge with B' is wasted, so perhaps

	git checkout P
	head=$(git rev-parse --verify HEAD^0)
	result_tree=$(git log -1 --pretty=format:%T P')
	result_commit=$(git commit-tree "$result_tree" -p P -p B')
	git update-ref -m "commit (merge): tg-redepend" HEAD \
			"$result_commit" "$head" || ... (fail)
	test -x "$GIT_DIR/hooks/post-merge" && $GIT_DIR/hooks/post-merge 0

I'm not sure. Is there some more porcelain-ish way to do this (create a merge commit when you already know the resulting and parents)?

But with that change the entire restarted=merge branch would go away, so I hope there is a nice way to do it. I'll think more.

Hope that helps, Jonathan

Show 13 quoted lines
> +
> +git branch -f $p
> +git checkout $p
> +
> +tg delete $b_  > /dev/null 2>&1
> +git branch -D $p_
> +
> +info "Rebased-using-merge onto new dependencies: $redeps."
> +
> +# Local Variables:
> +# sh-basic-offset:8
> +# End:
> 
Previous: Bert WesargNext: Jan Nieuwenhuizen
Message 3 of 7 in “tg redepend: New command.”
  1. tg redepend: New command.Jan Nieuwenhuizen, Aug 15, 2008
  2. Bert WesargAug 15, 2008
  3. Jonathan NiederAug 15, 2008
  4. Jan NieuwenhuizenAug 18, 2008
  5. Bert WesargSep 1, 2008
  6. Jan NieuwenhuizenSep 1, 2008
  7. Bert WesargSep 1, 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.