-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Remove /refs/tags or /refs/heads from Gogs remote File() when using build.Ref #1889
Conversation
You need to call |
Right, forgot about that... Done. |
@@ -177,6 +178,12 @@ func (c *client) File(u *model.User, r *model.Repo, b *model.Build, f string) ([ | |||
buildRef := b.Commit | |||
if buildRef == "" { | |||
buildRef = b.Ref | |||
|
|||
// Remove refs/tags or refs/heads, Gogs needs a short ref | |||
refPath := strings.SplitAfterN(b.Ref, "/", 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about the following code for high performance?
refPath := strings.TrimPrefix(
strings.TrimPrefix(
b.Ref,
"refs/heads/",
),
"refs/tags/",
)
https://github.com/drone/drone/blob/master/remote/bitbucketserver/convert.go#L105-L111
@appleboy I agree; that implementation is better. I adopted it. |
I have tested this with gitea v 1.0 and works very nice. |
Missing Features on http://readme.drone.io/0.5/install/setup/gogs/ should probably be updated. |
@jhasse New document is here: http://readme.drone.io/admin/setup-gogs/ |
Drone incorrectly used the full Git ref to retrieve a file using the Gogs API.
This is now fixed by removing the path from the ref (when a ref is used to retrieve a file). Behavior when using a Sha is not changed.
This PR fixes issue #1870.