]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script/ceph-backport: skip fetch if merge commit already exists locally 68422/head
authorKefu Chai <k.chai@proxmox.com>
Thu, 16 Apr 2026 10:13:28 +0000 (18:13 +0800)
committerKefu Chai <k.chai@proxmox.com>
Thu, 16 Apr 2026 11:15:50 +0000 (19:15 +0800)
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>
src/script/ceph-backport.sh

index 4f90ff93cfa78ac9fcdf5c268dd33a3e2bf0a18a..85e861c9cda42fd71b0244325fc3be09d71ec2d1 100755 (executable)
@@ -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