mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-27 20:26:09 +01:00
Backport #22118 Moved files in a patch will result in git apply returning: ``` error: {filename}: No such file or directory ``` This wasn't handled by the git apply patch code. This PR adds handling for this. Fix #22083 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
parent
6f323d13dd
commit
721e422fa7
|
@ -52,6 +52,8 @@ var patchErrorSuffices = []string{
|
||||||
": patch does not apply",
|
": patch does not apply",
|
||||||
": already exists in working directory",
|
": already exists in working directory",
|
||||||
"unrecognized input",
|
"unrecognized input",
|
||||||
|
": No such file or directory",
|
||||||
|
": does not exist in index",
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestPatch will test whether a simple patch will apply
|
// TestPatch will test whether a simple patch will apply
|
||||||
|
@ -415,6 +417,7 @@ func checkConflicts(ctx context.Context, pr *issues_model.PullRequest, gitRepo *
|
||||||
scanner := bufio.NewScanner(stderrReader)
|
scanner := bufio.NewScanner(stderrReader)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
|
log.Trace("PullRequest[%d].testPatch: stderr: %s", pr.ID, line)
|
||||||
if strings.HasPrefix(line, prefix) {
|
if strings.HasPrefix(line, prefix) {
|
||||||
conflict = true
|
conflict = true
|
||||||
filepath := strings.TrimSpace(strings.Split(line[len(prefix):], ":")[0])
|
filepath := strings.TrimSpace(strings.Split(line[len(prefix):], ":")[0])
|
||||||
|
|
Loading…
Reference in a new issue