Skip to content

Commit 91f88e4

Browse files
authored
Merge pull request ceph#58355 from batrick/ceph-backport-fetchhead
script/ceph-backport: robustness adjustments for local git repo quirks Reviewed-by: Venky Shankar <[email protected]>
2 parents 4887e20 + a4123d0 commit 91f88e4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/script/ceph-backport.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ function cherry_pick_phase {
258258
fi
259259

260260
set -x
261-
git fetch "$upstream_remote"
261+
git fetch "$upstream_remote" "refs/heads/${milestone}"
262262

263263
if git show-ref --verify --quiet "refs/heads/$local_branch" ; then
264264
if [ "$FORCE" ] ; then
265265
if [ "$non_interactive" ] ; then
266266
git checkout "$local_branch"
267-
git reset --hard "${upstream_remote}/${milestone}"
267+
git reset --hard FETCH_HEAD
268268
else
269269
echo
270270
echo "A local branch $local_branch already exists and the --force option was given."
@@ -276,7 +276,7 @@ function cherry_pick_phase {
276276
[ "$yes_or_no_answer" ] && yes_or_no_answer="${yes_or_no_answer:0:1}"
277277
if [ "$yes_or_no_answer" = "y" ] ; then
278278
git checkout "$local_branch"
279-
git reset --hard "${upstream_remote}/${milestone}"
279+
git reset --hard FETCH_HEAD
280280
else
281281
info "OK, bailing out!"
282282
false
@@ -289,10 +289,10 @@ function cherry_pick_phase {
289289
false
290290
fi
291291
else
292-
git checkout "${upstream_remote}/${milestone}" -b "$local_branch"
292+
git checkout -b "$local_branch" FETCH_HEAD
293293
fi
294294

295-
git fetch "$upstream_remote" "pull/$original_pr/head:pr-$original_pr"
295+
git fetch "$upstream_remote" "$merge_commit_sha"
296296

297297
set +x
298298
maybe_restore_set_x

0 commit comments

Comments
 (0)