dashboard / git-pr / feat: range diff #16 rss

accepted · opened on 2024-08-19T21:12:53Z by erock
Help
# add changes to patch request
git format-patch main --stdout | ssh pr.pico.sh pr add 16
# add review to patch request
git format-patch main --stdout | ssh pr.pico.sh pr add --review 16
# remove patchset
ssh pr.pico.sh ps rm ps-x
# checkout all patches
ssh pr.pico.sh pr print 16 | git am -3
# print a diff between the last two patches in a patch request
ssh pr.pico.sh pr diff 16
# accept PR
ssh pr.pico.sh pr accept 16
# close PR
ssh pr.pico.sh pr close 16

Logs

erock created pr with ps-28 on 2024-08-18T15:28:14Z
erock added ps-29 on 2024-08-18T15:31:36Z
erock changed status on 2024-08-18T15:31:36Z {"status":"open"}
erock added ps-30 on 2024-08-18T16:05:53Z
erock changed status on 2024-08-18T16:05:53Z {"status":"open"}
erock changed pr name on 2024-08-18T16:06:30Z {"name":"feat: private obj store service"}
erock added ps-31 on 2024-08-18T16:39:07Z
erock changed status on 2024-08-18T16:39:07Z {"status":"open"}
erock added ps-32 on 2024-08-19T02:01:34Z
erock changed status on 2024-08-19T02:01:34Z {"status":"open"}
erock changed status on 2024-08-19T20:50:01Z {"status":"closed"}
erock changed status on 2024-11-06T15:04:22Z {"status":"accepted"}

Patchsets

ps-28 by erock on 2024-08-18T15:28:14Z
Range Diff ↕
1: 3bd44da ! 1: 9002592 chore(pgs): add validation to project names

@@ filehandlers/assets/handler.go
 
 	project := getProject(s)
 	projectName := shared.GetProjectName(entry)
+	err = shared.ValidateProjectName(projectName)
+	if err != nil {
+		return "", err
+	}
+
 	logger = logger.With("project", projectName)
 
 	// find, create, or update project if we haven't already done it

@@ pgs/cli.go
 func (c *Cmd) link(projectName, linkTo string) error {
 	c.Log.Info("user running `link` command", "user", c.User.Name, "project", projectName, "link", linkTo)
 
+	err := shared.ValidateProjectName(projectName)
+	if err != nil {
+		return err
+	}
+
 	projectDir := linkTo
-	_, err := c.Dbpool.FindProjectByName(c.User.ID, linkTo)
+	_, err = c.Dbpool.FindProjectByName(c.User.ID, linkTo)
 	if err != nil {
 		e := fmt.Errorf("(%s) project doesn't exist", linkTo)
 		return e

@@ shared/bucket.go
 	return fmt.Sprintf("static-%s", userID)
 }
 
+func ValidateProjectName(projectName string) error {
+	if projectName == "pico-private" {
+	if projectName == "pico-private" || projectName == "pico-imgs" {
+		return fmt.Errorf("%s is an invalid project name", projectName)
+	}
+	return nil
+}
+
 func GetProjectName(entry *utils.FileEntry) string {
 	if entry.Mode.IsDir() && strings.Count(entry.Filepath, string(os.PathSeparator)) == 0 {
 		return entry.Filepath
ps-29 by erock on 2024-08-18T15:31:36Z
Range Diff ↕
1: 9002592 = 1: 9002592 chore(pgs): add validation to project names
-: ------- > 2: cd17cf4 chore: update pobj
-: ------- > 3: a00def2 chore: complete impl
ps-30 by erock on 2024-08-18T16:05:53Z
Range Diff ↕
1: 9002592 = 1: 9002592 chore(pgs): add validation to project names
2: cd17cf4 = 2: cd17cf4 chore: update pobj
3: a00def2 = 3: a00def2 chore: complete impl
-: ------- > 4: 0ed7dc9 chore: update pobj
-: ------- > 5: 8ff1131 working!
ps-31 by erock on 2024-08-18T16:39:07Z
Range Diff ↕
1: 9002592 = 1: 9002592 chore(pgs): add validation to project names
2: cd17cf4 = 2: cd17cf4 chore: update pobj
3: a00def2 = 3: a00def2 chore: complete impl
4: 0ed7dc9 = 4: 0ed7dc9 chore: update pobj
5: 8ff1131 = 5: 8ff1131 working!
-: ------- > 6: 0c8ad0d chore(obj): prep service def
ps-32 by erock on 2024-08-19T02:01:34Z

chore(pgs): add validation to project names

filehandlers/assets/handler.go link
+5 -0
 1diff --git a/filehandlers/assets/handler.go b/filehandlers/assets/handler.go
 2index 22edce6..1c32d82 100644
 3--- a/filehandlers/assets/handler.go
 4+++ b/filehandlers/assets/handler.go
 5@@ -268,6 +268,11 @@ func (h *UploadAssetHandler) Write(s ssh.Session, entry *utils.FileEntry) (strin
 6 
 7 	project := getProject(s)
 8 	projectName := shared.GetProjectName(entry)
 9+	err = shared.ValidateProjectName(projectName)
10+	if err != nil {
11+		return "", err
12+	}
13+
14 	logger = logger.With("project", projectName)
15 
16 	// find, create, or update project if we haven't already done it
pgs/cli.go link
+6 -1
 1diff --git a/pgs/cli.go b/pgs/cli.go
 2index 0af5802..8e82241 100644
 3--- a/pgs/cli.go
 4+++ b/pgs/cli.go
 5@@ -374,8 +374,13 @@ func (c *Cmd) unlink(projectName string) error {
 6 func (c *Cmd) link(projectName, linkTo string) error {
 7 	c.Log.Info("user running `link` command", "user", c.User.Name, "project", projectName, "link", linkTo)
 8 
 9+	err := shared.ValidateProjectName(projectName)
10+	if err != nil {
11+		return err
12+	}
13+
14 	projectDir := linkTo
15-	_, err := c.Dbpool.FindProjectByName(c.User.ID, linkTo)
16+	_, err = c.Dbpool.FindProjectByName(c.User.ID, linkTo)
17 	if err != nil {
18 		e := fmt.Errorf("(%s) project doesn't exist", linkTo)
19 		return e
shared/bucket.go link
+7 -0
 1diff --git a/shared/bucket.go b/shared/bucket.go
 2index 1257b55..4c28d94 100644
 3--- a/shared/bucket.go
 4+++ b/shared/bucket.go
 5@@ -17,6 +17,13 @@ func GetAssetBucketName(userID string) string {
 6 	return fmt.Sprintf("static-%s", userID)
 7 }
 8 
 9+func ValidateProjectName(projectName string) error {
10+	if projectName == "pico-private" {
11+		return fmt.Errorf("%s is an invalid project name", projectName)
12+	}
13+	return nil
14+}
15+
16 func GetProjectName(entry *utils.FileEntry) string {
17 	if entry.Mode.IsDir() && strings.Count(entry.Filepath, string(os.PathSeparator)) == 0 {
18 		return entry.Filepath