forked from forgejo/forgejo
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:
parent
c25303b11c
commit
f3833b7ce4
14 changed files with 641 additions and 69 deletions
|
@ -44,12 +44,18 @@ func addGitRefNameBindingRule() {
|
|||
}
|
||||
// Additional rules as described at https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
|
||||
if strings.HasPrefix(str, "/") || strings.HasSuffix(str, "/") ||
|
||||
strings.HasPrefix(str, ".") || strings.HasSuffix(str, ".") ||
|
||||
strings.HasSuffix(str, ".lock") ||
|
||||
strings.Contains(str, "..") || strings.Contains(str, "//") {
|
||||
strings.HasSuffix(str, ".") || strings.Contains(str, "..") ||
|
||||
strings.Contains(str, "//") {
|
||||
errs.Add([]string{name}, ErrGitRefName, "GitRefName")
|
||||
return false, errs
|
||||
}
|
||||
parts := strings.Split(str, "/")
|
||||
for _, part := range parts {
|
||||
if strings.HasSuffix(part, ".lock") || strings.HasPrefix(part, ".") {
|
||||
errs.Add([]string{name}, ErrGitRefName, "GitRefName")
|
||||
return false, errs
|
||||
}
|
||||
}
|
||||
|
||||
return true, errs
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue