-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add API Endpoint for Branch Creation #11607
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
Changes from all commits
2036f4b
19483e1
fc682dc
32e3057
f6100a1
c87a2b4
9651305
d84f9ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,9 @@ func CreateNewBranch(doer *models.User, repo *models.Repository, oldBranchName, | |
} | ||
|
||
if !git.IsBranchExist(repo.RepoPath(), oldBranchName) { | ||
return fmt.Errorf("OldBranch: %s does not exist. Cannot create new branch from this", oldBranchName) | ||
return models.ErrBranchDoesNotExist{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you checked every call to CreateNewBranch and made sure they handle your new error correctly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other place where CreateNewBranch is used is in routers/repo/branch.go CreateBranch function and uses the ctx.Repo.BranchName as the "OldBranchName". It does not "models.isErr" it but treats it as a ServerErr. Should we add a check there as well ? If so, should we do it in this PR or in another CL ? |
||
BranchName: oldBranchName, | ||
} | ||
} | ||
|
||
basePath, err := models.CreateTemporaryPath("branch-maker") | ||
|
Uh oh!
There was an error while loading. Please reload this page.