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

Fix deletion of unprotected branches #2630

Merged
merged 5 commits into from
Oct 2, 2017

Conversation

daviian
Copy link
Member

@daviian daviian commented Sep 30, 2017

Targets #2629

PR only targets release v1.2 as it is already fixed on master

@lunny lunny added the type/bug label Sep 30, 2017
@lunny lunny added this to the 1.2.0 milestone Sep 30, 2017
@lunny
Copy link
Member

lunny commented Oct 1, 2017

LGTM

@tboerger tboerger added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Oct 1, 2017
Copy link
Member

@lafriks lafriks left a comment

Choose a reason for hiding this comment

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

But for unprotected protectBranch should be nil & CanPush should be used only for pushing code check not for branch deletion

@daviian
Copy link
Member Author

daviian commented Oct 1, 2017

@lafriks I can change internal api too. At the moment the internal api returns a protectedBranch with canPush: true if there is none.

@lafriks
Copy link
Member

lafriks commented Oct 1, 2017

I think that would be correct approach as this is also what master branch does

@daviian
Copy link
Member Author

daviian commented Oct 1, 2017

@lafriks done

@lafriks
Copy link
Member

lafriks commented Oct 1, 2017

@daviian please fix go fmt error

Signed-off-by: David Schneiderbauer <[email protected]>
@lafriks
Copy link
Member

lafriks commented Oct 1, 2017

LGTM

@tboerger tboerger 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 Oct 1, 2017
@@ -38,6 +38,11 @@ func (protectBranch *ProtectedBranch) BeforeUpdate() {
protectBranch.UpdatedUnix = time.Now().Unix()
}

// IsProtected returns if the branch is protected
func (protectBranch *ProtectedBranch) IsProtected() bool {
return protectBranch.ID > 0
Copy link
Member

Choose a reason for hiding this comment

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

@daviian you can change here to protectBranch != nil && protectBranch.ID > 0 and than you can remove that nil check above

Copy link
Member Author

@daviian daviian Oct 2, 2017

Choose a reason for hiding this comment

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

@lafriks Current implementation would reflect current master. But if you want, of course I can add the check inside the function.

Copy link
Member

Choose a reason for hiding this comment

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

@daviian ok, let it be this way than for now, this could be optimized in master than

@lafriks
Copy link
Member

lafriks commented Oct 2, 2017

LGTM

@lafriks lafriks merged commit e38e502 into go-gitea:release/v1.2 Oct 2, 2017
@daviian daviian deleted the bugfix/protected-branch branch October 2, 2017 20:38
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 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. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants