1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-01-20 16:50:28 -05:00

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>
This commit is contained in:
Zsombor Gegesy 2025-01-13 04:52:54 +00:00 committed by Earl Warren
parent 011ac8df44
commit af5d96e2cc
2 changed files with 4 additions and 1 deletions

View file

@ -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])
}

View file

@ -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())