From cbf11ece5832af19c9279652187c975930b4a0cb Mon Sep 17 00:00:00 2001 From: Andriy Oblivantsev Date: Fri, 21 Aug 2026 20:54:34 +0100 Subject: [PATCH] fix(brain/import-git): single flaggy parser; best-effort repo skip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - one parser (positional repo + root/since/limit/db/dry-run) instead of double ParseArgs+Parse which rejected --dry-run - unreadable/empty repos (e.g. bare 'george') are skipped with a warning, not fatal — a wave must not die on one bad repo --- bin/brain/import-git.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/brain/import-git.go b/bin/brain/import-git.go index 62b665b..0f8c7ad 100644 --- a/bin/brain/import-git.go +++ b/bin/brain/import-git.go @@ -27,14 +27,16 @@ func main() { func run(args []string) int { var ( + c gitlog.CLI dbPath string dryRun bool ) - c, err := gitlog.ParseArgs(args) - if err != nil { - return cli.Fail(err) - } p := cli.New("brain-import-git") + p.Description = "read git history (go-git) and upsert commit leafs into the brain" + p.AddPositionalValue(&c.Repo, "repo", 1, false, "git repo path") + p.String(&c.Root, "", "root", "scan dir for git repos") + p.String(&c.Since, "", "since", "RFC3339 or YYYY-MM-DD") + p.Int(&c.Limit, "", "limit", "max commits per repo (0 = all)") p.String(&dbPath, "", "db", "path to kb.lbug (default var/kb.lbug)") p.Bool(&dryRun, "", "dry-run", "print counts only, write nothing") if err := cli.Parse(p, args); err != nil { @@ -80,8 +82,8 @@ func run(args []string) int { } cs, err := gitlog.Log(rp, opt) if err != nil { - fmt.Fprintf(os.Stderr, "brain-import-git: %s: %v\n", rp, err) - return 1 + fmt.Fprintf(os.Stderr, "brain-import-git: %s: skip: %v\n", name, err) + continue } for _, cm := range cs { l := gitlog.ToLeaf(cm, name)