summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZsombor Gegesy <gzsombor@gmail.com>2025-01-13 05:52:54 +0100
committerEarl Warren <earl-warren@noreply.codeberg.org>2025-01-13 05:52:54 +0100
commitaf5d96e2cc8d92f13f3fd17763562f3f1ef4c863 (patch)
tree3519c859dbcbe1a30327d4285646178556b2577e
parentUpdate renovate Docker tag to v39.106.0 (forgejo) (#6550) (diff)
downloadforgejo-af5d96e2cc8d92f13f3fd17763562f3f1ef4c863.tar.xz
forgejo-af5d96e2cc8d92f13f3fd17763562f3f1ef4c863.zip
Do not report warning when git shows new reference (#6540)
## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests - I added test coverage for Go changes... - [X] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [X] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] I do not want this change to show in the release notes. - [ ] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6540 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Zsombor Gegesy <gzsombor@gmail.com> Co-committed-by: Zsombor Gegesy <gzsombor@gmail.com>
-rw-r--r--services/mirror/mirror_pull.go1
-rw-r--r--services/mirror/mirror_test.go4
2 files changed, 4 insertions, 1 deletions
diff --git a/services/mirror/mirror_pull.go b/services/mirror/mirror_pull.go
index 2d128919f9..53a2cff13f 100644
--- a/services/mirror/mirror_pull.go
+++ b/services/mirror/mirror_pull.go
@@ -174,6 +174,7 @@ func parseRemoteUpdateOutput(output, remoteName string) []*mirrorSyncResult {
newCommitID: shas[1],
})
+ case strings.HasPrefix(lines[i], " * [new ref]"): // new reference - nothing to do
default:
log.Warn("parseRemoteUpdateOutput: unexpected update line %q", lines[i])
}
diff --git a/services/mirror/mirror_test.go b/services/mirror/mirror_test.go
index 8ad524b608..860470522e 100644
--- a/services/mirror/mirror_test.go
+++ b/services/mirror/mirror_test.go
@@ -17,7 +17,9 @@ func Test_parseRemoteUpdateOutput(t *testing.T) {
- [deleted] (none) -> tag1
+ f895a1e...957a993 test2 -> origin/test2 (forced update)
957a993..a87ba5f test3 -> origin/test3
-`
+ * [new ref] refs/pull/27/merge -> refs/pull/27/merge
+ * [new ref] refs/pull/516/head -> refs/pull/516/head
+ `
results := parseRemoteUpdateOutput(output, "origin")
assert.Len(t, results, 6)
assert.EqualValues(t, "refs/tags/v0.1.8", results[0].refName.String())