diff options
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 35 |
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 -} |