@@ -92,14 +92,14 @@ func (repo *Repository) CheckBranchName(name string) error {
92
92
93
93
// CreateNewBranch creates a new repository branch
94
94
func (repo * Repository ) CreateNewBranch (doer * User , oldBranchName , branchName string ) (err error ) {
95
+ repoWorkingPool .CheckIn (com .ToStr (repo .ID ))
96
+ defer repoWorkingPool .CheckOut (com .ToStr (repo .ID ))
97
+
95
98
// Check if branch name can be used
96
99
if err := repo .CheckBranchName (branchName ); err != nil {
97
100
return err
98
101
}
99
102
100
- repoWorkingPool .CheckIn (com .ToStr (repo .ID ))
101
- defer repoWorkingPool .CheckOut (com .ToStr (repo .ID ))
102
-
103
103
localPath := repo .LocalCopyPath ()
104
104
105
105
if err = discardLocalRepoBranchChanges (localPath , oldBranchName ); err != nil {
@@ -157,14 +157,14 @@ func (repo *Repository) updateLocalCopyToCommit(commit string) error {
157
157
158
158
// CreateNewBranchFromCommit creates a new repository branch
159
159
func (repo * Repository ) CreateNewBranchFromCommit (doer * User , commit , branchName string ) (err error ) {
160
+ repoWorkingPool .CheckIn (com .ToStr (repo .ID ))
161
+ defer repoWorkingPool .CheckOut (com .ToStr (repo .ID ))
162
+
160
163
// Check if branch name can be used
161
164
if err := repo .CheckBranchName (branchName ); err != nil {
162
165
return err
163
166
}
164
167
165
- repoWorkingPool .CheckIn (com .ToStr (repo .ID ))
166
- defer repoWorkingPool .CheckOut (com .ToStr (repo .ID ))
167
-
168
168
localPath := repo .LocalCopyPath ()
169
169
170
170
if err = repo .updateLocalCopyToCommit (commit ); err != nil {
0 commit comments