From: Kefu Chai Date: Thu, 16 Apr 2026 10:13:28 +0000 (+0800) Subject: script/ceph-backport: skip fetch if merge commit already exists locally X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=193541e04c1dcaae6e681dfa17415317fa2fbba7;p=ceph.git script/ceph-backport: skip fetch if merge commit already exists locally 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 --- diff --git a/src/script/ceph-backport.sh b/src/script/ceph-backport.sh index 4f90ff93cfa7..85e861c9cda4 100755 --- a/src/script/ceph-backport.sh +++ b/src/script/ceph-backport.sh @@ -294,7 +294,9 @@ function cherry_pick_phase { 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