Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitea webhook commits wrong hash on HEAD reset #11802

Closed
2 of 7 tasks
bfueldner opened this issue Jun 8, 2020 · 2 comments · Fixed by #16283
Closed
2 of 7 tasks

Gitea webhook commits wrong hash on HEAD reset #11802

bfueldner opened this issue Jun 8, 2020 · 2 comments · Fixed by #16283
Labels

Comments

@bfueldner
Copy link

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

  1. Make a commit an a branch of your choice
  2. Push it on the server git push (initiates webhook with correct commits content)
  3. Reset head of branch to a previous commit (e.g. git reset --hard HEAD~1)
  4. Push the new branch head to gitea git push --force (initiates webhook with wrong commits 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

@stale
Copy link

stale bot commented Aug 16, 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 stale bot added the issue/stale label Aug 16, 2020
@6543
Copy link
Member

6543 commented Aug 16, 2020

nop stale

@stale stale bot removed the issue/stale label Aug 16, 2020
6543 pushed a commit that referenced this issue Jun 30, 2021
Use `..` instead of `...` with `rev-list`. In combination with #16282 the receiver can get the correct commit. The behaviour is now like Github.

fixes #11802
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue Aug 10, 2021
Use `..` instead of `...` with `rev-list`. In combination with go-gitea#16282 the receiver can get the correct commit. The behaviour is now like Github.

fixes go-gitea#11802
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants