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

Add API for manipulating Git hooks #6436

Merged
merged 11 commits into from
Apr 17, 2019

Conversation

segevfiner
Copy link
Contributor

@segevfiner segevfiner commented Mar 26, 2019

❗️ Depends on go-gitea/go-sdk#156 (merged)
❗️ Depends on go-gitea/git#151 (merged)
(Depgo.mod must be updated when those are merged as I made it point to our fork for this to build)

This adds API for manipulating Git hooks which are only accessible via a web form ATM.

Signed-off-by: Segev Finer <segev@codeocean.com>
@lafriks lafriks added type/feature Completely new functionality. Can only be merged if feature freeze is not active. modifies/api This PR adds API routes or modifies them labels Mar 26, 2019
@lafriks lafriks added this to the 1.9.0 milestone Mar 26, 2019
Gopkg.toml Outdated Show resolved Hide resolved
Gopkg.toml Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 27, 2019
@segevfiner
Copy link
Contributor Author

Refreshed the PR with changes from master. The added replace directive in go.mod needs to be removed once the SDK PR is merged and the version of the SDK updated in the require directive.

@techknowlogick
Copy link
Member

@segevfiner I've just merged the SDK code. You can now update this PR with appropriate changes :)

@techknowlogick
Copy link
Member

This looks great! Thanks for PR 😄 Could you add some tests (ensure that githooks update after change, simple fetch of githooks return expected content, error when user who doesn't have access to githooks tries to access)?

@codecov-io
Copy link

codecov-io commented Apr 16, 2019

Codecov Report

Merging #6436 into master will increase coverage by 0.2%.
The diff coverage is 80.89%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #6436     +/-   ##
=========================================
+ Coverage   40.53%   40.74%   +0.2%     
=========================================
  Files         406      407      +1     
  Lines       54506    54680    +174     
=========================================
+ Hits        22095    22278    +183     
+ Misses      29373    29351     -22     
- Partials     3038     3051     +13
Impacted Files Coverage Δ
routers/api/v1/convert/convert.go 81.31% <100%> (+0.63%) ⬆️
routers/api/v1/api.go 73.06% <100%> (+0.66%) ⬆️
modules/context/api.go 50.61% <50%> (ø) ⬆️
routers/api/v1/repo/git_hook.go 78.7% <78.7%> (ø)
modules/git/utils.go 84.44% <0%> (+6.66%) ⬆️
modules/git/hook.go 50.72% <0%> (+50.72%) ⬆️
modules/git/repo_hook.go 100% <0%> (+100%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 827ab6b...b58d8f1. Read the comment docs.

@segevfiner
Copy link
Contributor Author

segevfiner commented Apr 16, 2019

This looks great! Thanks for PR 😄 Could you add some tests (ensure that githooks update after change, simple fetch of githooks return expected content, error when user who doesn't have access to githooks tries to access)?

@techknowlogick I want to add a Git hook to one of the fixture repos to test list/get, but to which one of the fixture repos should I add it too? Maybe a new one?

@sapk
Copy link
Member

sapk commented Apr 16, 2019

Looking at recent PR you can re-use the same repo (or add another similar) introduce in #6479
The test part for example : https://github.com/go-gitea/gitea/pull/6479/files#diff-b3cdbf4d78c522550fce21298c72c321

@segevfiner
Copy link
Contributor Author

segevfiner commented Apr 16, 2019

I added a bunch of tests.

EDIT: Whooops, build failure, will fix soon.

Co-Authored-By: segevfiner <segev208@gmail.com>
techknowlogick and others added 2 commits April 16, 2019 23:05
Co-Authored-By: segevfiner <segev208@gmail.com>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 16, 2019
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 17, 2019
@techknowlogick techknowlogick merged commit 3454836 into go-gitea:master Apr 17, 2019
@segevfiner segevfiner deleted the git-hook-api branch April 17, 2019 06:14
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants