From 193541e04c1dcaae6e681dfa17415317fa2fbba7 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 16 Apr 2026 18:13:28 +0800 Subject: [PATCH] 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 --- src/script/ceph-backport.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.47.3