pull: use merge-base --fork-point when appropriate
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
John Keeping committed
Dec 8, 2013 at 12:47 UTC
48059e405028ebf8a09c5a9aede89dfb460cce98
1 file changed
+1
-9
git-pull.sh
+1
-9
@@ -229,15 +229,7 @@ test true = "$rebase" && {
229
test -n "$curr_branch" &&
230
. git-parse-remote &&
231
remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
232
- oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
233
- for reflog in $(git rev-list -g $remoteref 2>/dev/null)
234
- do
235
- if test "$reflog" = "$(git merge-base $reflog $curr_branch)"
236
- then
237
- oldremoteref="$reflog"
238
- break
239
- fi
240
- done
232
+ oldremoteref=$(git merge-base --fork-point "$remoteref" $curr_branch)
233
}
234
orig_head=$(git rev-parse -q --verify HEAD)
235
git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$@" || exit 1