From ffdba30a62159a12737cb42155ae133223d7c7dd Mon Sep 17 00:00:00 2001
From: Earl Warren <contact@earl-warren.org>
Date: Sat, 30 Mar 2024 09:44:19 +0100
Subject: [PATCH] [CI] backport strategy must fail when it conflicts

strategy: ort

The strategy is changed from "recursive" to "ort", which is the
default for git >= 2.43.2 and claims to reduce the likelyhood of
conflicts according to man git-merge:

> This has been reported to result in fewer merge conflicts without
> causing mismerges...

strategy-option: find-renames

The default option are the same for both strategies and "theirs" will:

> This option forces conflicting hunks to be auto-resolved
> cleanly by favoring their version.

"their" being whatever is not in the commits being cherry-picked.

In the context of Forgejo backports, this is not what is desired:
whenever a conflict happens it needs to be manually resolved and
prefering whatever is in the stable branch will not lead to a sane
backport.

It is changed back to "find-renames" which is documented to be the
default:

> Turn on rename detection, optionally setting the similarity
> threshold. This is the default.

Fixes: https://codeberg.org/forgejo/forgejo/issues/2886
---
 .forgejo/workflows/backport.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.forgejo/workflows/backport.yml b/.forgejo/workflows/backport.yml
index de6e987ab2..50e8785c12 100644
--- a/.forgejo/workflows/backport.yml
+++ b/.forgejo/workflows/backport.yml
@@ -77,9 +77,11 @@ jobs:
           echo "target-branch: ${{ fromJSON(steps.extract-targets.outputs.targets)[0] }}"
           echo "pull-request: ${{ github.event.pull_request.url }}"
 
-      - uses: https://code.forgejo.org/actions/git-backporting@v4.5.2
+      - uses: https://code.forgejo.org/actions/git-backporting@v4.6.0
         with:
           target-branch: ${{ fromJSON(steps.extract-targets.outputs.targets)[0] }}/forgejo
+          strategy: ort
+          strategy-option: find-renames
           no-squash: true
           auth: ${{ secrets.BACKPORT_TOKEN }}
           pull-request: ${{ github.event.pull_request.url }}