git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pull: use merge-base --fork-point when appropriate
@ 2013-12-08 12:47 John Keeping
  2013-12-10  1:58 ` Jonathan Nieder
  0 siblings, 1 reply; 2+ messages in thread
From: John Keeping @ 2013-12-08 12:47 UTC (permalink / raw)
  To: git; +Cc: Martin von Zweigbergk, Jonathan Nieder, Junio C Hamano,
	John Keeping

Since commit d96855f (merge-base: teach "--fork-point" mode, 2013-10-23)
we can replace a shell loop in git-pull with a single call to
git-merge-base.  So let's do so.

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 git-pull.sh | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/git-pull.sh b/git-pull.sh
index b946fd9..605e957 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -229,15 +229,7 @@ test true = "$rebase" && {
 	test -n "$curr_branch" &&
 	. git-parse-remote &&
 	remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
-	oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
-	for reflog in $(git rev-list -g $remoteref 2>/dev/null)
-	do
-		if test "$reflog" = "$(git merge-base $reflog $curr_branch)"
-		then
-			oldremoteref="$reflog"
-			break
-		fi
-	done
+	oldremoteref=$(git merge-base --fork-point "$remoteref" $curr_branch)
 }
 orig_head=$(git rev-parse -q --verify HEAD)
 git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$@" || exit 1
-- 
1.8.5.226.g0d60d77

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pull: use merge-base --fork-point when appropriate
  2013-12-08 12:47 [PATCH] pull: use merge-base --fork-point when appropriate John Keeping
@ 2013-12-10  1:58 ` Jonathan Nieder
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Nieder @ 2013-12-10  1:58 UTC (permalink / raw)
  To: John Keeping; +Cc: git, Martin von Zweigbergk, Junio C Hamano

John Keeping wrote:

> Since commit d96855f (merge-base: teach "--fork-point" mode, 2013-10-23)
> we can replace a shell loop in git-pull with a single call to
> git-merge-base.  So let's do so.
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
>  git-pull.sh | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)

Yay!  Looks good.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-10  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-08 12:47 [PATCH] pull: use merge-base --fork-point when appropriate John Keeping
2013-12-10  1:58 ` Jonathan Nieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).