Pull Request ref not available immediatly after pushing #5647

Closed
opened 2025-11-02 06:31:50 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @kolaente on GitHub (Jun 27, 2020).

  • Gitea version (or commit ref): 1.13.0+dev-221-g6891b9030
  • Git version:
  • Operating system: official docker container
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Most of the time when I push an update to an existing PR in Gitea, a webhook for drone is fired immediatly even if the pull ref is not (yet) available. Thus, the drone clone step fails with something like this:

Initialized empty Git repository in /go/src/repo/.git/
+ git fetch origin +refs/heads/master:
From <repo url>
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
+ git checkout master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Already on 'master'
+ git fetch origin refs/pull/594/head:
fatal: Couldn't find remote ref refs/pull/594/head

The PR reflects that:
image

After a few seconds, it goes back to normal:
image

If I then manually restart the build in drone, everything works as expected.

It seems to be an issue with my server performance which takes the ref so long to be available, but IMHO Gitea should not fire the webhook until the ref is available.

Originally created by @kolaente on GitHub (Jun 27, 2020). - Gitea version (or commit ref): 1.13.0+dev-221-g6891b9030 - Git version: - Operating system: official docker container - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description Most of the time when I push an update to an existing PR in Gitea, a webhook for drone is fired immediatly even if the pull ref is not (yet) available. Thus, the drone clone step fails with something like this: ``` Initialized empty Git repository in /go/src/repo/.git/ + git fetch origin +refs/heads/master: From <repo url> * branch master -> FETCH_HEAD * [new branch] master -> origin/master + git checkout master Branch 'master' set up to track remote branch 'master' from 'origin'. Already on 'master' + git fetch origin refs/pull/594/head: fatal: Couldn't find remote ref refs/pull/594/head ``` The PR reflects that: ![image](https://user-images.githubusercontent.com/13721712/85926942-0453c400-b8a3-11ea-8b36-870a90edae86.png) After a few seconds, it goes back to normal: ![image](https://user-images.githubusercontent.com/13721712/85926970-36fdbc80-b8a3-11ea-8f20-c0627cf12123.png) If I then manually restart the build in drone, everything works as expected. It seems to be an issue with my server performance which takes the ref so long to be available, but IMHO Gitea should not fire the webhook until the ref is available.
GiteaMirror added the issue/staletype/bug labels 2025-11-02 06:31:50 -06:00
Author
Owner

@CirnoT commented on GitHub (Jun 27, 2020):

262fce6db4/services/pull/pull.go (L281) happens before 262fce6db4/services/pull/pull.go (L286) and even if it didn't, the head repo tasks are async.

@CirnoT commented on GitHub (Jun 27, 2020): https://github.com/go-gitea/gitea/blob/262fce6db4ab87e03926ac7a21bc5e4bea7ea815/services/pull/pull.go#L281 happens before https://github.com/go-gitea/gitea/blob/262fce6db4ab87e03926ac7a21bc5e4bea7ea815/services/pull/pull.go#L286 and even if it didn't, the head repo tasks are async.
Author
Owner

@stale[bot] commented on GitHub (Aug 27, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Aug 27, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Sep 11, 2020):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Sep 11, 2020): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5647