If the merge commit is already present in the local object store, there
is no need to fetch it from the upstream remote. Use git-cat-file to
check before fetching, avoiding unnecessary network traffic.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
git checkout -b "$local_branch" FETCH_HEAD
fi
- git fetch "$CEPH_UPSTREAM" "$merge_commit_sha"
+ if ! git cat-file -e "${merge_commit_sha}^{commit}" 2>/dev/null; then
+ git fetch "$CEPH_UPSTREAM" "$merge_commit_sha"
+ fi
set +x
maybe_restore_set_x