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

[PATCH] pull: use merge-base --fork-point when appropriate

From
John Keeping <john@keeping.me.uk>
Date
Dec 8, 2013, 12:47 UTC
Message-ID
<b208a2edcaf47bf1a97ec19718854dc1b3646828.1386506845.git.john@keeping.me.uk>

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
Next: Jonathan Nieder
Message 1 of 2 in “pull: use merge-base --fork-point when appropriate”
  1. pull: use merge-base --fork-point when appropriateJohn Keeping, Dec 8, 2013
  2. Jonathan NiederDec 10, 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.