git-pr
created pr with
1.1
cmds
checkout latest patchset:
ssh pr.pico.sh print 1 | git am -3checkout any patchset in a patch request:
ssh pr.pico.sh print 1.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 1
Patchset
1.1
chore: remove dead code
Eric Bower
2024-07-18T18:02:40ZSemantic diff summary
0 added,
1 modified,
0 signature changed,
1 removed
across 1 analyzed file
+0
-111
util.go
#
| ... | ... | @@ -211,112 +209,3 @@ func calcContentSha(diffFiles []*gitdiff.File, header *gitdiff.PatchHeader) stri | |
| 211 | 209 | shaStr := hex.EncodeToString(sha[:]) | |
| 212 | 210 | return shaStr | |
| 213 | 211 | } | |
| 214 | - | ||
| 215 | - | func AuthorDateToTime(date string, logger *slog.Logger) time.Time { | |
| 216 | - | // TODO: convert sql column to DATETIME | |
| 217 | - | ds, err := time.Parse("2006-01-02T15:04:05Z", date) | |
| 218 | - | if err != nil { | |
| 219 | - | logger.Error( | |
| 220 | - | "cannot parse author date for patch", | |
| 221 | - | "datetime", date, | |
| 222 | - | "err", err, | |
| 223 | - | ) | |
| 224 | - | return time.Now() | |
| 225 | - | } | |
| 226 | - | return ds | |
| 227 | - | } | |
| 228 | - | ||
| 229 | - | /* func filterPatches(ranger *Ranger, patches []*Patch) []*Patch { | |
| 230 | - | if ranger.Left == ranger.Right { | |
| 231 | - | return []*Patch{patches[ranger.Left]} | |
| 232 | - | } | |
| 233 | - | return patches[ranger.Left:ranger.Right] | |
| 234 | - | } | |
| 235 | - | ||
| 236 | - | type Ranger struct { | |
| 237 | - | Left int | |
| 238 | - | Right int | |
| 239 | - | } | |
| 240 | - | ||
| 241 | - | func parseRange(rnge string, sliceLen int) (*Ranger, error) { | |
| 242 | - | items := strings.Split(rnge, ":") | |
| 243 | - | left := 0 | |
| 244 | - | var err error | |
| 245 | - | if items[0] != "" { | |
| 246 | - | left, err = strconv.Atoi(items[0]) | |
| 247 | - | if err != nil { | |
| 248 | - | return nil, fmt.Errorf("first value before `:` must provide number") | |
| 249 | - | } | |
| 250 | - | } | |
| 251 | - | ||
| 252 | - | if left < 0 { | |
| 253 | - | return nil, fmt.Errorf("first value must be >= 0") | |
| 254 | - | } | |
| 255 | - | ||
| 256 | - | if left >= sliceLen { | |
| 257 | - | return nil, fmt.Errorf("first value must be less than number of patches") | |
| 258 | - | } | |
| 259 | - | ||
| 260 | - | if len(items) == 1 { | |
| 261 | - | return &Ranger{ | |
| 262 | - | Left: left, | |
| 263 | - | Right: left, | |
| 264 | - | }, nil | |
| 265 | - | } | |
| 266 | - | ||
| 267 | - | if items[1] == "" { | |
| 268 | - | return &Ranger{Left: left, Right: sliceLen - 1}, nil | |
| 269 | - | } | |
| 270 | - | ||
| 271 | - | right, err := strconv.Atoi(items[1]) | |
| 272 | - | if err != nil { | |
| 273 | - | return nil, fmt.Errorf("second value after `:` must provide number") | |
| 274 | - | } | |
| 275 | - | ||
| 276 | - | if left > right { | |
| 277 | - | return nil, fmt.Errorf("second value must be greater than first value") | |
| 278 | - | } | |
| 279 | - | ||
| 280 | - | if right >= sliceLen { | |
| 281 | - | return nil, fmt.Errorf("second value must be less than number of patches") | |
| 282 | - | } | |
| 283 | - | ||
| 284 | - | return &Ranger{ | |
| 285 | - | Left: left, | |
| 286 | - | Right: right, | |
| 287 | - | }, nil | |
| 288 | - | } */ | |
| 289 | - | ||
| 290 | - | /* func gitServiceCommands(sesh ssh.Session, be *Backend, cmd, repoName string) error { | |
| 291 | - | name := utils.SanitizeRepo(repoName) | |
| 292 | - | // git bare repositories should end in ".git" | |
| 293 | - | // https://git-scm.com/docs/gitrepository-layout | |
| 294 | - | repoID := be.RepoID(name) | |
| 295 | - | reposDir := be.ReposDir() | |
| 296 | - | err := git.EnsureWithin(reposDir, repoID) | |
| 297 | - | if err != nil { | |
| 298 | - | return err | |
| 299 | - | } | |
| 300 | - | repoPath := filepath.Join(reposDir, repoID) | |
| 301 | - | serviceCmd := git.ServiceCommand{ | |
| 302 | - | Stdin: sesh, | |
| 303 | - | Stdout: sesh, | |
| 304 | - | Stderr: sesh.Stderr(), | |
| 305 | - | Dir: repoPath, | |
| 306 | - | Env: sesh.Environ(), | |
| 307 | - | } | |
| 308 | - | ||
| 309 | - | if cmd == "git-receive-pack" { | |
| 310 | - | err := git.ReceivePack(sesh.Context(), serviceCmd) | |
| 311 | - | if err != nil { | |
| 312 | - | return err | |
| 313 | - | } | |
| 314 | - | } else if cmd == "git-upload-pack" { | |
| 315 | - | err := git.UploadPack(sesh.Context(), serviceCmd) | |
| 316 | - | if err != nil { | |
| 317 | - | return err | |
| 318 | - | } | |
| 319 | - | } | |
| 320 | - | ||
| 321 | - | return nil | |
| 322 | - | } */ |