Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement update branch API#32433

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lunny merged 11 commits intogo-gitea:mainfromkemzeb:feat-api-add-rename-branch
Dec 12, 2024

Conversation

@kemzeb
Copy link
Member

Resolves#22526.

Builds upon#23061.

@GiteaBotGiteaBot added the lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelNov 6, 2024
@github-actionsgithub-actionsbot added modifies/apiThis PR adds API routes or modifies them modifies/goPull requests that update Go code labelsNov 6, 2024
@silverwindsilverwind added the type/featureCompletely new functionality. Can only be merged if feature freeze is not active. labelNov 6, 2024
@kemzebkemzebforce-pushed thefeat-api-add-rename-branch branch from1beebeb to36829ecCompareNovember 17, 2024 02:12
@GiteaBotGiteaBot added lgtm/need 1This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelsNov 19, 2024
@lunnylunny added this to the1.23.0 milestoneNov 19, 2024
lunny pushed a commit that referenced this pull requestNov 20, 2024
Found while working on#32433.This branch will never be executed because we have would have alreadymade the same check a couple lines above.
Comment on lines +443 to +441
ifrepo.IsEmpty {
ctx.Error(http.StatusNotFound,"","Git Repository is empty.")
return
}

ifrepo.IsMirror {
ctx.Error(http.StatusForbidden,"","Git Repository is a mirror.")
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe these checks can be done inRenameBranch, and return different http status codes by catching errors?

Copy link
Member

Choose a reason for hiding this comment

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

Is this a blocked request?

Copy link
Contributor

@yp05327yp05327Dec 6, 2024
edited
Loading

Choose a reason for hiding this comment

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

No.
In the web UI, user can not rename branch in mirror/empty repo. So maybe it is ok to skip these checks.
But you can create a special request to do it. So I think it is better to move these checks to the functions in service level. I have also mentioned this problem in some issues/PRs. But it seems that it is acceptable in this project, so this is not a blocked request.
e.g. I can pick up a public mirror repo in Gitea.com, then I create a fake request to change the branch name or do somethings which is not expected and no checks for the web UI side, I'm not sure what will happen, but it is not LGTM.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can put that for another PRs. This PR is focused on adding the API endpoint.

BLumia reacted with thumbs up emoji
Copy link
MemberAuthor

@kemzebkemzebDec 7, 2024
edited
Loading

Choose a reason for hiding this comment

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

I originally found those checks in the other branch API implementations and believed it made sense to include them in here.

I do agree that this logic should be moved to the service layer. To me, the presentation layer (i.e. the API and web routes handlers) should just be concerned with presenting the response given what the service layer provides. From my experience it does look like we have sprinkled application logic into our middleware and our web/API route handlers, so it does become confusing when considering where it should be added.

But I also agree with doing this in a separate PR just to keeps our changes atomic (since I would also wan't to add service layer tests for these checks). I would be more than happy to do this once this one is merged.

@lunny
Copy link
Member

Please resolve the conflict.

@kemzebkemzeb changed the titleImplement rename branch APIImplement update branch APIDec 7, 2024
@kemzebkemzebforce-pushed thefeat-api-add-rename-branch branch from4445c70 to83e3528CompareDecember 7, 2024 01:20
@GiteaBotGiteaBot added lgtm/doneThis PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1This PR needs approval from one additional maintainer to be merged. labelsDec 7, 2024
@lunnylunny added the reviewed/wait-mergeThis pull request is part of the merge queue. It will be merged soon. labelDec 12, 2024
@lunnylunnyenabled auto-merge (squash)December 12, 2024 04:11
@lunnylunny merged commit01b1896 intogo-gitea:mainDec 12, 2024
26 checks passed
@GiteaBotGiteaBot removed the reviewed/wait-mergeThis pull request is part of the merge queue. It will be merged soon. labelDec 12, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull requestDec 13, 2024
* giteaofficial/main:  Fix bug of branch/tag selector in the issue sidebar (go-gitea#32744)  Fix lfs migration (go-gitea#32812)  Avoid MacOS keychain dialog in integration tests (go-gitea#32813)  Update actionlint.yaml  Detect whether action view branch was deleted (go-gitea#32764)  Add "n commits" link to contributors in contributors graph page (go-gitea#32799)  Fix "unicode escape" JS error (go-gitea#32806)  use dedicated runners for release artifacts (go-gitea#32811)  Make API "compare" accept commit IDs (go-gitea#32801)  Implement update branch API (go-gitea#32433)  Fix JS error when dropping a file to a editor without dropzone (go-gitea#32804)  chore: use errors.New to replace fmt.Errorf with no parameters (go-gitea#32800)
@kemzebkemzeb deleted the feat-api-add-rename-branch branchJanuary 2, 2025 22:11
@go-giteago-gitea locked asresolvedand limited conversation to collaboratorsMar 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@lunnylunnylunny approved these changes

@yp05327yp05327yp05327 left review comments

@wxiaoguangwxiaoguangwxiaoguang approved these changes

+1 more reviewer

@BLumiaBLumiaBLumia approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

lgtm/doneThis PR has enough approvals to get merged. There are no important open reservations anymore.modifies/apiThis PR adds API routes or modifies themmodifies/goPull requests that update Go codetype/featureCompletely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Milestone

1.23.0

Development

Successfully merging this pull request may close these issues.

Api for branch rename

7 participants

@kemzeb@lunny@wxiaoguang@BLumia@yp05327@silverwind@GiteaBot

[8]ページ先頭

©2009-2025 Movatter.jp