diff --git a/cmd/gitbase/command/server.go b/cmd/gitbase/command/server.go index b13c20981..592bc73a4 100644 --- a/cmd/gitbase/command/server.go +++ b/cmd/gitbase/command/server.go @@ -362,10 +362,10 @@ func (c *Server) addDirectory(d directory) error { return nil } -type bareness int +type bareOpt int const ( - bareAuto bareness = iota + bareAuto bareOpt = iota bareOn bareOff ) @@ -375,7 +375,7 @@ type directory struct { Format string Bucket int Rooted bool - Bare bareness + Bare bareOpt } var ( @@ -421,11 +421,6 @@ func parseDirectory(dir directory) (directory, error) { dir.Format = val case "bare": - if val != "true" && val != "false" && val != "auto" { - logrus.Errorf("invalid value in bare, it can only "+ - "be true, false, or auto %v", val) - return dir, ErrInvalid - } switch val { case "true": dir.Bare = bareOn @@ -433,6 +428,10 @@ func parseDirectory(dir directory) (directory, error) { dir.Bare = bareOff case "auto": dir.Bare = bareAuto + default: + logrus.Errorf("invalid value in bare, it can only "+ + "be true, false, or auto %v", val) + return dir, ErrInvalid } case "rooted": diff --git a/cmd/gitbase/command/server_test.go b/cmd/gitbase/command/server_test.go index 35d561bf8..239512628 100644 --- a/cmd/gitbase/command/server_test.go +++ b/cmd/gitbase/command/server_test.go @@ -182,7 +182,7 @@ func TestDiscoverBare(t *testing.T) { tests := []struct { path string - bare bareness + bare bareOpt expected bool err bool }{