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

Re: [PATCHv2 2/2] pull: support rebased upstream + fetch + pull --rebase

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 16, 2009, 08:51 UTC
Message-ID
<alpine.DEB.1.00.0907161035060.3155@pacific.mpi-cbg.de>
In-Reply-To
<1247731921-2290-1-git-send-email-santi@agolina.net>
Hi,
On Thu, 16 Jul 2009, Santi Béjar wrote:
> Use the fork commit of the current branch (where
> the tip of upstream branch used to be) as the upstream parameter of
> "git rebase". Compute it walking the reflog to find the first commit
> which is an ancestor of the current branch.
I finally understand what this patch is about.  Thanks.
Show 15 quoted lines
> diff --git a/git-pull.sh b/git-pull.sh
> index 4b78a0c..31d3945 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -125,9 +125,14 @@ test true = "$rebase" && {
>  	die "refusing to pull with rebase: your working tree is not up-to-date"
>  
>  	. git-parse-remote &&
> -	reflist="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
> -	oldremoteref="$(git rev-parse -q --verify \
> -		"$reflist")"
> +	remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
> +	num=0 &&
> +	while oldremoteref="$(git rev-parse -q --verify "$remoteref@{$num}")"
> +	do
How about
	oldremoteref="$(git rev-list --boundary HEAD --not \
			$(git rev-list -g $remoteref | sed 's/$/^@/') |
		sed -e '/^[^-]/d' -e q)"
Explanation: the "git rev-list -g $remoteref" lists the previous commits 
the remote ref pointed to, and the ^@ appended to them means all their 
parents.  Now, the outer rev-list says to take everything in HEAD but 
_not_ in those parents, showing the boundary commits.  The "sed" call 
lists the first such boundary commit (which must, by construction, be one 
of the commits shown by the first rev-list).

But maybe this is trying to be too clever, and we should not bother with it until git-pull is made a builtin?

Ciao, Dscho

Previous: Santi BéjarNext: Santi Béjar
Message 8 of 19 in “t5520-pull: Test for rebased upstream + fetch + pull --rebase”
  1. 1/2 t5520-pull: Test for rebased upstream + fetch + pull --rebaseSanti Béjar, Jul 16, 2009
  2. 2/2 pull: support rebased upstream + fetch + pull --rebaseSanti Béjar, Jul 16, 2009
  3. Junio C HamanoJul 16, 2009
  4. Santi BéjarJul 16, 2009
  5. 2/2 pull: support rebased upstream + fetch + pull --rebaseSanti Béjar, Jul 16, 2009
  6. 2/2 pull: support rebased upstream + fetch + pull --rebaseSanti Béjar, Jul 16, 2009
  7. Santi BéjarJul 16, 2009
  8. Johannes SchindelinJul 16, 2009
  9. Santi BéjarJul 16, 2009
  10. Johannes SchindelinJul 17, 2009
  11. Junio C HamanoJul 16, 2009
  12. Santi BéjarJul 16, 2009
  13. Santi BéjarJul 17, 2009
  14. Junio C HamanoJul 17, 2009
  15. Santi BéjarJul 17, 2009
  16. 2/2 pull: support rebased upstream + fetch + pull --rebaseSanti Béjar, Jul 18, 2009
  17. Junio C HamanoJul 18, 2009
  18. Santi BéjarJul 19, 2009
  19. 2/2 pull: support rebased upstream + fetch + pull --rebaseSanti Béjar, Jul 19, 2009

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.