Skip to content

Skip push update when tag reference to blob/tree #23214

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

Closed

Conversation

adlternative
Copy link

Because git ref may reference to blob/tree, but
push update logic will treate the object as a commit.

Therefore, an error occurred when parsing the commit object, resulting in the loss of the webhook notification of this ref and other refs.

So we ignore the wrong type error here to let other common refs can do webhook normally.

Hope to fix #23213.

@adlternative adlternative force-pushed the tag-to-blob-push-update-error branch from 0c23ade to 80ebe2a Compare March 1, 2023 09:16
@adlternative adlternative changed the title Skip push update when tag to blob/tree Skip push update when tag reference to blob/tree Mar 1, 2023
@techknowlogick techknowlogick added type/bug outdated/backport/v1.19 This PR should be backported to Gitea 1.19 labels Mar 1, 2023
@techknowlogick techknowlogick added this to the 1.20.0 milestone Mar 1, 2023
@lunny
Copy link
Member

lunny commented Mar 2, 2023

Could we have a test for that?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 2, 2023
case "blob":
fallthrough
case "tree":
log.Debug("Special typ: %s", typ)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this log debug line will be useful. I think it can be dropped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're going to need to add this/handle this in the gogit variant code too

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I will remove it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're going to need to add this/handle this in the gogit variant code too

Well, you are right. I do a refactor for the getCommit() of gogit variant code in the latest patch.

@adlternative adlternative force-pushed the tag-to-blob-push-update-error branch 5 times, most recently from 06157d5 to ddc3f9f Compare March 2, 2023 11:17
Because git ref may reference to blob/tree, but
push update logic will treate the object as a commit.

Therefore, an error occurred when parsing the commit object,
resulting in the loss of the webhook notification of this ref
and other refs.

So we ignore the wrong type error here to let other common
refs can do webhook normally.

Hope to fix go-gitea#23213.

Signed-off-by: ZheNing Hu <[email protected]>
@adlternative adlternative force-pushed the tag-to-blob-push-update-error branch from ddc3f9f to ebc77a5 Compare March 2, 2023 11:18
@adlternative
Copy link
Author

adlternative commented Mar 2, 2023

Could we have a test for that?

Is here any good place to test this "push update"(webhook, post-receive)?

@adlternative adlternative requested review from zeripath and KN4CK3R and removed request for zeripath and KN4CK3R March 3, 2023 08:13
@lunny
Copy link
Member

lunny commented Mar 3, 2023

Could we have a test for that?

Is here any good place to test this "push update"(webhook, post-receive)?

You can add an integration test for that.

@delvh delvh removed this from the 1.20.0 milestone Jun 4, 2023
@wxiaoguang
Copy link
Contributor

-> Ignore trivial errors when updating push data #33864

A tag could point to anything, even a non-existing commit or non-blob.

So to be simple, I think we could have 2 choices:

  1. Ignore the error and only log it: Ignore trivial errors when updating push data #33864
  2. Or completely ignore the error, don't log it (I think a log doesn't harm, so I choose 1)

@wxiaoguang
Copy link
Contributor

Could we have a test for that?

#33864 is simple enough and I think we do not need to test it now (actually it's difficult to test it because we need to manually construct a bad git repo)

@wxiaoguang wxiaoguang added issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed outdated/backport/v1.19 This PR should be backported to Gitea 1.19 labels Mar 14, 2025
@wxiaoguang
Copy link
Contributor

Thank you for the PR, 🙏 I think the problem should have been addressed by #33864 , feel free to reopen if there would be new improvements.

@wxiaoguang wxiaoguang closed this Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Push update failed when git tag reference to a blob
8 participants