fix branch name panic with period

This commit is contained in:
Dustin Brown
2019-11-04 09:55:44 -08:00
parent 919e744a62
commit 758684a612
4 changed files with 10 additions and 9 deletions

View File

@@ -203,9 +203,8 @@ teardown() {
[ "$output" = "" ]
}
@test "unsupported branch characters" {
run dolt branch "are.dots.supported"
skip "branch names with . panic right now"
[ "$status" -eq 0 ]
[ "$output" = "" ]
}
@test "branch names do not support ." {
run dolt branch "dots.are.not.supported"
[ "$status" -eq 1 ]
[ "$output" = "fatal: 'dots.are.not.supported' is an invalid branch name." ]
}

View File

@@ -260,6 +260,8 @@ github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191003230430-3a1a09c79ada h1
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191003230430-3a1a09c79ada/go.mod h1:DdWE0ku/mNfuLsRJIrHeHpDtB7am+6oopxEsQKmVkx8=
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191017183442-4b9329eafa5b h1:fdht6iaUhHYJEfSUY1m1KAghyi6zfyfv+12gaSsaQ+o=
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191017183442-4b9329eafa5b/go.mod h1:DdWE0ku/mNfuLsRJIrHeHpDtB7am+6oopxEsQKmVkx8=
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191102000214-fa72192f51a9 h1:Pux1QrTx2Q2WF0Ayyz9doIlYJP/REAhfRP7mRyoiowE=
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191102000214-fa72192f51a9/go.mod h1:DdWE0ku/mNfuLsRJIrHeHpDtB7am+6oopxEsQKmVkx8=
github.com/liquidata-inc/ishell v0.0.0-20190514193646-693241f1f2a0 h1:phMgajKClMUiIr+hF2LGt8KRuUa2Vd2GI1sNgHgSXoU=
github.com/liquidata-inc/ishell v0.0.0-20190514193646-693241f1f2a0/go.mod h1:YC1rI9k5gx8D02ljlbxDfZe80s/iq8bGvaaQsvR+qxs=
github.com/liquidata-inc/mmap-go v1.0.3 h1:2LndAeAtup9rpvUmu4wZSYCsjCQ0Zpc+NqE+6+PnT7g=

View File

@@ -21,12 +21,12 @@ import (
// The following list of patterns are all forbidden in a branch name.
var InvalidBranchNameRegex = regexp.MustCompile(strings.Join([]string{
// Any appearance of a period, currently unsupported by noms layer
`[.*]`,
// Any appearance of the following characters: :, ?, [, \, ^, ~, SPACE, TAB, *
`:`, `\?`, `\[`, `\\`, `\^`, `~`, ` `, `\t`, `\*`,
// Any ASCII control character.
`[\x00-\x1f]`, `\x7f`,
// Any component starting with a "."
`\A\.`, `/\.`,
// Any component ending with ".lock"
`\.lock\z`, `\.lock\/`,
// An exact name of "", "HEAD" or "-"

View File

@@ -25,8 +25,8 @@ func TestBranchName(t *testing.T) {
assert.Equal(t, true, IsValidBranchName("☃️"))
assert.Equal(t, true, IsValidBranchName("user/in-progress/do-some-things"))
assert.Equal(t, true, IsValidBranchName("user/in-progress/{}"))
assert.Equal(t, true, IsValidBranchName("user/{/a.tt/}"))
assert.Equal(t, false, IsValidBranchName("user/{/a.tt/}"))
assert.Equal(t, false, IsValidBranchName(""))
assert.Equal(t, false, IsValidBranchName("this-is-a-..-test"))
assert.Equal(t, false, IsValidBranchName("this-is-a-@{-test"))