File tree Expand file tree Collapse file tree 1 file changed +27
-12
lines changed Expand file tree Collapse file tree 1 file changed +27
-12
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- cph=$( git rev-list -n 1 CHERRY_PICK_HEAD 2> /dev/null)
4
-
5
3
set -o errexit
6
4
set -o pipefail
7
5
@@ -36,20 +34,37 @@ function pop() {
36
34
fi
37
35
printf ' popping: %s\n' " ${rc} "
38
36
39
- if [[ ! $cph ]]; then
40
- git cherry-pick --allow-empty --keep-redundant-commits -Xsubtree=" ${subtree_dir} " " ${rc} "
41
- else
42
- if [[ $cph != " ${rc} " ]]; then
43
- printf ' unexpected CHERRY_PICK_HEAD:\ngot %s\nexpected: %s\n' " ${cph} " " ${rc} "
44
- exit
45
- fi
46
- printf ' cherry-pick in progress for %s\n' " ${cph} "
47
- git add .
37
+ if ! git cherry-pick --allow-empty --keep-redundant-commits -Xsubtree=" ${subtree_dir} " " ${rc} " ; then
38
+ # Always blast away the vendor directory given OLM/registry still commit it into source control.
39
+ git rm -rf " ${subtree_dir} " /vendor 2> /dev/null || true
40
+
41
+ num_conflicts=$( git diff --name-only --diff-filter=U --relative | wc -l)
42
+ while [[ $num_conflicts != 0 ]] ; do
43
+ file=$( git diff --name-only --diff-filter=U --relative)
44
+
45
+ if [[ $file == * " go.mod" * ]]; then
46
+ git diff " ${subtree_dir} " /go.mod
47
+
48
+ git checkout --theirs " ${subtree_dir} " /go.mod
49
+ pushd " ${subtree_dir} "
50
+ go mod tidy
51
+ git add go.mod go.sum
52
+ popd
53
+ else
54
+ git checkout --theirs " $file "
55
+ git diff " $file "
56
+ git add " $file "
57
+ fi
58
+
59
+ num_conflicts=$( git diff --name-only --diff-filter=U --relative | wc -l)
60
+ echo " Number of merge conflicts remaining: $num_conflicts "
61
+ done
48
62
49
63
if [[ -z $( git status --porcelain) ]]; then
50
64
git commit --allow-empty
51
65
else
52
- git cherry-pick --continue
66
+ echo " Current cherry pick status: $( git status --porcelain) "
67
+ git -c core.editor=true cherry-pick --continue
53
68
fi
54
69
fi
55
70
You can’t perform that action at this time.
0 commit comments