-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 agit flow support in gitea #14295
Conversation
ref: https://git-repo.info/en/2020/03/agit-flow-and-git-repo/ example: ```Bash git checkout -b test echo "test" >> README.md git commit -m "test" git push origin HEAD:refs/for/master -o topic=test ``` Signed-off-by: a1012112796 <1012112796@qq.com>
* master: [skip ci] Updated licenses and gitignores
736f1b8
to
a757ed5
Compare
Codecov Report
@@ Coverage Diff @@
## master #14295 +/- ##
==========================================
- Coverage 42.21% 42.03% -0.19%
==========================================
Files 767 768 +1
Lines 81624 82118 +494
==========================================
+ Hits 34458 34515 +57
- Misses 41531 41944 +413
- Partials 5635 5659 +24
Continue to review full report at Codecov.
|
@jiangxin Could we ask you to help to review this PR? |
* master: Fixed irritating error message related to go version (go-gitea#14611) Use OldRef instead of CommitSHA for DeleteBranch comments (go-gitea#14604) Add information on how to build statically (go-gitea#14594) [skip ci] Updated translations via Crowdin Exclude the current dump file from the dump (go-gitea#14606) Remove spurious DataAsync Error logging (go-gitea#14599) [API] Add delete release by tag & fix unreleased inconsistency (go-gitea#14563) Fix rate limit bug when downloading assets on migrating from github (go-gitea#14564) [API] Add affected files of commits to commit struct (go-gitea#14579)
* master: Add support for ref parameter to get raw file API (go-gitea#14602)
cmd/hook.go
Outdated
|
||
const VersionHead string = "version=1" | ||
|
||
if !strings.HasPrefix(rs.Data, VersionHead) { |
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.
You should split rs.Data
by the NUL character ('\0'). Part one is version, and part two is capabilities.
cmd/hook.go
Outdated
|
||
hasPushOptions := false | ||
response := []byte(VersionHead) | ||
if strings.Contains(rs.Data, "push-options") { |
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.
You should split capabilities using space character, and try to match each capability.
If there is a new capability called "push-options-v2", using string.Contains
is wrong.
It's not good to have a merge commit for others to review, so please rebase your topic. |
@jiangxin Thanks for your carefully check, I will change them soon. |
@jiangxin Another question, I know your designed style to create pull request is |
When push to an empty repository, an error returned |
Another two problems:
|
Maybe you should rewrite the gitea hooks on migrations if git version matched. |
I think just add a note on blog is enough |
@a1012112796 well since we check for the git version and assume if it is high enough we do recive proc-receive. |
Willn't, Because will check permission in |
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.
Please change more PullRequestStyle
to PullRequestFlow
, otherwise LGTM
make L-G-T-M work. |
🚀 |
* feature: add agit flow support ref: https://git-repo.info/en/2020/03/agit-flow-and-git-repo/ example: ```Bash git checkout -b test echo "test" >> README.md git commit -m "test" git push origin HEAD:refs/for/master -o topic=test ``` Signed-off-by: a1012112796 <1012112796@qq.com> * fix lint * simplify code add fix some nits * update merge help message * Apply suggestions from code review. Thanks @jiangxin * add forced-update message * fix lint * splite writePktLine * add refs/for/<target-branch>/<topic-branch> support also * Add test code add fix api * fix lint * fix test * skip test if git version < 2.29 * try test with git 2.30.1 * fix permission check bug * fix some nit * logic implify and test code update * fix bug * apply suggestions from code review * prepare for merge Signed-off-by: Andrew Thornton <art27@cantab.net> * fix permission check bug - test code update - apply suggestions from code review @zeripath Signed-off-by: a1012112796 <1012112796@qq.com> * fix bug when target branch isn't exist * prevent some special push and fix some nits * fix lint * try splite * Apply suggestions from code review - fix permission check - handle user rename * fix version negotiation * remane * fix template * handle empty repo * ui: fix branch link under the title * fix nits Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
…ndard refs There was an inadvertent breaking change in go-gitea#15629 meaning that notes refs and other git extension refs will be automatically rejected. Further following go-gitea#14295 and go-gitea#15629 the pre-recieve hook code is untenably long and too complex. This PR refactors the hook code and removes the incorrect forced rejection of non-standard refs. Fix go-gitea#16688 Signed-off-by: Andrew Thornton <art27@cantab.net>
…ndard refs (#16705) * Clean-up HookPreReceive and restore functionality for pushing non-standard refs There was an inadvertent breaking change in #15629 meaning that notes refs and other git extension refs will be automatically rejected. Further following #14295 and #15629 the pre-recieve hook code is untenably long and too complex. This PR refactors the hook code and removes the incorrect forced rejection of non-standard refs. Fix #16688 Signed-off-by: Andrew Thornton <art27@cantab.net>
ref: https://git-repo.info/en/2020/03/agit-flow-and-git-repo/
examle:
NOTICE: All existed repositories will not have the new hooks, you have to rewrite the hooks via admin panel.