Closed
Description
Description
Gitea webhook has already deleted git hash in list commits
, if a git push --force
is initiated after a git reset --hard
to a previous commit.
If this is an intended behaviour, please correct me.
Steps to reproduce
- Make a commit an a branch of your choice
- Push it on the server
git push
(initiates webhook with correctcommits
content) - Reset head of branch to a previous commit (e.g.
git reset --hard HEAD~1
) - Push the new branch head to gitea
git push --force
(initiates webhook with wrongcommits
content)
For example after step 2 described above we have the following commit hashes:
commit b44305a4f7cad8617cd2b5ac5d0251b05cf03fdb (HEAD -> master, origin/master)
commit da2c75d512a3f0aa36cc025723d9ea17631a6609
commit df4b604249f70ad99938f502ce7677da3a0cded6
Now we reset to da2c75d512a3f0aa36cc025723d9ea17631a6609
and push it to gitea.
Expected behaviour
Expectect JSON content of webhook (unrelevant data cut away) with git hash of the new branch head:
...
"ref": "refs/heads/master",
"before": "b44305a4f7cad8617cd2b5ac5d0251b05cf03fdb",
"after": "da2c75d512a3f0aa36cc025723d9ea17631a6609",
"compare_url": "https://try.gitea.io/bfueldner/testrepo/compare/b44305a4f7cad8617cd2b5ac5d0251b05cf03fdb...da2c75d512a3f0aa36cc025723d9ea17631a6609",
"commits": [
{
"id": "da2c75d512a3f0aa36cc025723d9ea17631a6609",
"message": "Add more text.\n",
"url": "https://try.gitea.io/bfueldner/testrepo/commit/da2c75d512a3f0aa36cc025723d9ea17631a6609",
...
}
],
...
Actual behaviour
The actual webhook contains the already deleted hash b44305a4f7cad8617cd2b5ac5d0251b05cf03fdb
as a commit. Triggered buildservers try to checkout an invalid hash and can not build the new head of the branch.
...
"ref": "refs/heads/master",
"before": "b44305a4f7cad8617cd2b5ac5d0251b05cf03fdb",
"after": "da2c75d512a3f0aa36cc025723d9ea17631a6609",
"compare_url": "https://try.gitea.io/bfueldner/testrepo/compare/b44305a4f7cad8617cd2b5ac5d0251b05cf03fdb...da2c75d512a3f0aa36cc025723d9ea17631a6609",
"commits": [
{
"id": "b44305a4f7cad8617cd2b5ac5d0251b05cf03fdb",
"message": "Delete readme file.\n",
"url": "https://try.gitea.io/bfueldner/testrepo/commit/b44305a4f7cad8617cd2b5ac5d0251b05cf03fdb",
...
}
],
...
System information
- Gitea version (or commit ref): 1.11.6
- Git version: 2.17.1 (should not be relevant)
- Operating system: Ubuntu 18.04.4 LTS
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (https://try.gitea.io/bfueldner/testrepo/settings/hooks/343)
- No
- Not relevant
- Log gist: Not relevant