mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -76,6 +76,11 @@ func (r *Repository) CanEnableEditor() bool { | ||||
| 	return r.Repository.CanEnableEditor() && r.IsViewBranch && r.IsWriter() | ||||
| } | ||||
|  | ||||
| // CanCreateBranch returns true if repository is editable and user has proper access level. | ||||
| func (r *Repository) CanCreateBranch() bool { | ||||
| 	return r.Repository.CanCreateBranch() && r.IsWriter() | ||||
| } | ||||
|  | ||||
| // CanCommitToBranch returns true if repository is editable and user has proper access level | ||||
| //   and branch is not protected | ||||
| func (r *Repository) CanCommitToBranch(doer *models.User) (bool, error) { | ||||
| @@ -528,6 +533,7 @@ func RepoRef() macaron.Handler { | ||||
| 		ctx.Data["IsViewBranch"] = ctx.Repo.IsViewBranch | ||||
| 		ctx.Data["IsViewTag"] = ctx.Repo.IsViewTag | ||||
| 		ctx.Data["IsViewCommit"] = ctx.Repo.IsViewCommit | ||||
| 		ctx.Data["CanCreateBranch"] = ctx.Repo.CanCreateBranch() | ||||
|  | ||||
| 		ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount() | ||||
| 		if err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user