Skip to content

Commit 48059e4

Browse files
johnkeepinggitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 07d406b commit 48059e4

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

git-pull.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,7 @@ test true = "$rebase" && {
229229
test -n "$curr_branch" &&
230230
. git-parse-remote &&
231231
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)
241233
}
242234
orig_head=$(git rev-parse -q --verify HEAD)
243235
git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$@" || exit 1

0 commit comments

Comments
 (0)