summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-10-15 22:59:24 +0300
committerGitHub <noreply@github.com>2017-10-15 22:59:24 +0300
commitf3833b7ce4dc78095194808c6e07d8ae133e7ab5 (patch)
treecdcb53731d4523f068a6e532bf5da9e2759f8cb2 /models/repo.go
parentc25303b11c323045718a5af373c11f5807f77fb7 (diff)
downloadgitea-f3833b7ce4dc78095194808c6e07d8ae133e7ab5.tar.gz
gitea-f3833b7ce4dc78095194808c6e07d8ae133e7ab5.zip
Create new branch from branch selection dropdown (#2130)
* Create new branch from branch selection dropdown and rewrite it to VueJS * Make updateLocalCopyToCommit as not exported * Move branch name validation to model * Fix possible race condition
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/models/repo.go b/models/repo.go
index 9819d4b77a..293f251d3e 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -2426,38 +2426,3 @@ func (repo *Repository) GetUserFork(userID int64) (*Repository, error) {
}
return &forkedRepo, nil
}
-
-// __________ .__
-// \______ \____________ ____ ____ | |__
-// | | _/\_ __ \__ \ / \_/ ___\| | \
-// | | \ | | \// __ \| | \ \___| Y \
-// |______ / |__| (____ /___| /\___ >___| /
-// \/ \/ \/ \/ \/
-//
-
-// CreateNewBranch creates a new repository branch
-func (repo *Repository) CreateNewBranch(doer *User, oldBranchName, branchName string) (err error) {
- repoWorkingPool.CheckIn(com.ToStr(repo.ID))
- defer repoWorkingPool.CheckOut(com.ToStr(repo.ID))
-
- localPath := repo.LocalCopyPath()
-
- if err = discardLocalRepoBranchChanges(localPath, oldBranchName); err != nil {
- return fmt.Errorf("discardLocalRepoChanges: %v", err)
- } else if err = repo.UpdateLocalCopyBranch(oldBranchName); err != nil {
- return fmt.Errorf("UpdateLocalCopyBranch: %v", err)
- }
-
- if err = repo.CheckoutNewBranch(oldBranchName, branchName); err != nil {
- return fmt.Errorf("CreateNewBranch: %v", err)
- }
-
- if err = git.Push(localPath, git.PushOptions{
- Remote: "origin",
- Branch: branchName,
- }); err != nil {
- return fmt.Errorf("Push: %v", err)
- }
-
- return nil
-}