Browse Source

Forbid users to push "root" repositories

Guillaume J. Charmes 12 năm trước cách đây
mục cha
commit
b370acd679
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      commands.go

+ 3 - 1
commands.go

@@ -420,7 +420,9 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string
 
 	tmp := strings.SplitN(local, "/", 2)
 	if len(tmp) == 1 {
-		remote = srv.runtime.authConfig.Username + "/" + local
+		return fmt.Errorf(
+			"Impossible to push a \"root\" repository. Please rename your repository in <user>/<repo> (ex: %s/%s)",
+			srv.runtime.authConfig.Username, local)
 	} else {
 		remote = local
 	}