-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Protected branches system #339
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
Conversation
Tracking issue is #32 |
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.
2 things for Gitea acceptance :)
cmd/update.go
Outdated
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.
Wrong module :)
models/protected_branch.go
Outdated
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.
These should be in CamelCase :)
models/protected_branch.go
Outdated
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.
It's 2016 (almost 2017!) :)
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.
Also Gitea Authors
;)
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.
+// Copyright 2016 The Gitea Authors. All rights reserved.
// Copyright 2014 The Gogs Authors. All rights reserved.
Please also take your time to document all new methods and functions. |
@denji please on next squash-rebase change the issue referenc from gogs/gogs#3921 to #32 (gitea issue) |
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 translate only languages you are familiar with, don't use something like Google translate.
conf/locale/locale_de-DE.ini
Outdated
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 don't use Google translate, these translations doesn't make sense at all
conf/locale/locale_en-US.ini
Outdated
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.
Branch protection
conf/locale/locale_en-US.ini
Outdated
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.
Enable protection
conf/locale/locale_en-US.ini
Outdated
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.
Disable protection
conf/locale/locale_fi-FI.ini
Outdated
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.
Is this also Google translate?
conf/locale/locale_sr-SP.ini
Outdated
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.
Is this also Google translate?
conf/locale/locale_sv-SE.ini
Outdated
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.
Is this also Google translate?
conf/locale/locale_tr-TR.ini
Outdated
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.
Is this also Google translate?
conf/locale/locale_zh-CN.ini
Outdated
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.
Is this also Google translate?
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.
I think yes
models/migrations/migrations.go
Outdated
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.
New migrations should always go into the last row
cmd/update.go
Outdated
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.
Don't need that? Than drop it?
cmd/update.go
Outdated
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.
I would say local variables start lowercase
modules/ssh/ssh.go
Outdated
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.
Why is this added?
cmd/serve.go
Outdated
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.
This is never used...
models/protected_branch.go
Outdated
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.
Prefix them GITEA_
, like this GITEA_USER_ID
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.
And I'd make it GITEA_PUSHER_ID
since that makes more sense IMO
I'd need to test this before I LG_TM. I'll see if I have some time to spare this weekend |
Such a feature indeed requires manual testing |
@tboerger for now at least ;) |
models/protected_branch.go
Outdated
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.
When has == 0
then err == nil
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.
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.
That's also a bug, I will send a PR to fix that.
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.
This line is OK.
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.
models/migrations/v15.go
Outdated
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.
this code is no meaning
cmd/update.go
Outdated
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.
"... Can't ..."
or "... Cannot ..."
?
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.
I'd go for can not
, since the others are abbreviations.
routers/repo/http.go
Outdated
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.
"... Can't ..."
or "... Cannot ..."
?
Please resolve the conflict and we could review and merge it. |
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.
Slight grammar fix 🙂
cmd/update.go
Outdated
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.
protected branches can not be pushed to
models/migrations/migrations.go
Outdated
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 don't need this migration, this is only required if you want to update content, the structure gets automatically migrated.
options/locale/locale_en-US.ini
Outdated
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 can not push
options/locale/locale_en-US.ini
Outdated
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.
maybe not use the term developers
...
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.
Sorry that I'm being a pain... :(
options/locale/locale_en-US.ini
Outdated
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.
Anyone with write permissions will be able to push directly to this branch. Are you sure?
LGTM |
It's ready now for review. |
// V16 -> v17 | ||
NewMigration("create repo unit table and add units for all repos", addUnitsToTables), | ||
// v17 -> v18 | ||
NewMigration("set protect branches updated with created", setProtectedBranchUpdatedWithCreated), |
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.
It's an entirely new struct, that doesn't need any migration because of the anyway executed sync function
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.
No. Sync on a migration is better safe. I have found the original method's bug, see #871. When you upgrade from an old version which haven't a column external_tracker_url, then a new version add this column by Sync not migration. but another new version will use this column, then the bug occupied.
For the record: Gogs got this via gogs/gogs@7e09d21 |
options/locale/TRANSLATORS
Outdated
Damaris Padieu <damizx AT hotmail DOT fr> | ||
Daniel Speichert <daniel AT speichert DOT pl> | ||
David Yzaguirre <dvdyzag AT gmail DOT com> | ||
Denis Denisov <denji0k AT gmail DOT com> |
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.
This should be added to all our repos ;)
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.
removed this.
options/locale/locale_ru-RU.ini
Outdated
settings.deploy_key_deletion=Удалить ключ развертывания | ||
settings.deploy_key_deletion_desc=Удаление ключа развертывания приведет к удалению всех связанных прав доступа к репозиторию. Вы хотите продолжить? | ||
settings.deploy_key_deletion_success=Ключ развертывания успешно удален! | ||
settings.branches=Ветки |
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.
Since we switched to crowdin this have to be done within crowdin, otherwise we get into issues while we try to sync it.
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.
removed this.
@@ -0,0 +1,99 @@ | |||
{{template "base/head" .}} |
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.
This file is generally not really good indented. Please fix the indentation.
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.
done.
templates/repo/settings/navbar.tmpl
Outdated
{{.i18n.Tr "repo.settings.collaboration"}} | ||
</a> | ||
{{if not .Repository.IsBare}} | ||
<a class="{{if .PageIsSettingsBranches}}active{{end}} item" href="{{.RepoLink}}/settings/branches"> |
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.
Indent by one level
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.
I have added some minor comments, but otherwise I'm fine with that.
cmd/update.go
Outdated
|
||
if protectBranch != nil { | ||
log.GitLogger.Fatal(2, "protected branches can not be pushed to") | ||
fail("protected branches can not be pushed to", "protected branches can not be pushed to") |
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.
is .Fatal not really fatal that you add a fail() call afterwards ?
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.
indeed a problem.
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.
done.
I've given this code a try but I'm refused any push, even to branches which are not protected.
The server (http.log) says:
|
Also, the "Delete" button doesn't work, despite endpoint returnin 200 OK the protected branches are still listed in the "Branches" page in repository setting. |
Yes. I'm fixing that. |
@strk please confirm. |
@lunny just tried but still doesn't work for me. I hit "Delete" on a protected branch and it still sits there. |
@strk please delete the old branch and fetch the newest branch. |
LGTM after rebasing to current master (70ae6d1) and testing briefly. Note that the Gogs version of protected branches has a more fine-grained configuration for branch protection, you can check it on try.gogs.io. |
@strk Yes. We will improve the protected branch on v1.2. |
gogs/gogs@7e09d21, #32 (
gogs/gogs#3921):org/:reponame/settings/branches
).