Skip to content

Commit c3105f7

Browse files
committed
Improve git:cherry-pick-by-patch command
Let AI to apply changes manually for conflicted files. Example: in the repo https://github.com/openshift/csi-operator.git , there is a commit (`9fa7ded32d45e71eb6715855ffc7f34852f375de`) in the branch `release-4.17`. The command `patch` failed in the branch `release-4.16`: ``` $ git show 9fa7ded32d45e71eb6715855ffc7f34852f375de | patch -p1 --no-backup-if-mismatch ... patching file assets/overlays/azure-disk/generated/hypershift/manifests.yaml Hunk #1 FAILED at 13. ``` However, AI assistant is smart enough to resolve the conflict manually. The result of imporved cherry-pick-by-patch is here: openshift/csi-operator@b236f6c
1 parent a50fc18 commit c3105f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugins/git/commands/cherry-pick-by-patch.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ Fail, if there is no `commit_hash` in the current repository checkout.
3737
```bash
3838
git show commit_hash | patch -p1 --no-backup-if-mismatch
3939
```
40-
and check if exit code is zero. Fail if exit code is not zero.
40+
and check if exit code is zero. If exit code is not zero, find confilcted files in the output and apply
41+
changes for them from the patch manually. Print file names which required manual changes. Fail workload
42+
if you cannot apply any required change manually.
4143

4244
2. Find files removed from local checkout by the patch command and execute `git rm` for them.
4345

0 commit comments

Comments
 (0)