-
Notifications
You must be signed in to change notification settings - Fork 4
test issue #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test issue #147
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright (c) 2026-present unTill Software Development Group B.V. | ||
| * @author Denis Gribanov | ||
| */ | ||
|
|
||
| package gitcmds | ||
|
|
||
| import "strings" | ||
|
|
||
| // LoadRepoContext gathers repository state needed by Dev() in minimal git round-trips. | ||
| // Phase 1 runs five independent local git commands concurrently. | ||
| // Phase 2 issues one gh API call that requires Org/Repo obtained in phase 1. | ||
| func LoadRepoContext(wd string) (*RepoContext, error) { | ||
| rc := &RepoContext{} | ||
|
|
||
| type result struct { | ||
| setFn func() | ||
| err error | ||
| } | ||
|
|
||
| const numConcurrent = 5 | ||
| ch := make(chan result, numConcurrent) | ||
|
|
||
| go func() { | ||
| v, err := HasRemote(wd, "upstream") | ||
| ch <- result{setFn: func() { rc.UpstreamExists = v }, err: err} | ||
| }() | ||
|
|
||
| go func() { | ||
| repo, org, err := GetRepoAndOrgName(wd) | ||
| ch <- result{setFn: func() { rc.Repo = repo; rc.Org = org }, err: err} | ||
| }() | ||
|
|
||
| go func() { | ||
| v, err := GetCurrentBranchName(wd) | ||
| ch <- result{setFn: func() { rc.CurrentBranch = v }, err: err} | ||
| }() | ||
|
|
||
| go func() { | ||
| v, err := GetMainBranch(wd) | ||
| ch <- result{setFn: func() { rc.MainBranch = v }, err: err} | ||
| }() | ||
|
|
||
| go func() { | ||
| v, err := HaveUncommittedChanges(wd) | ||
| ch <- result{setFn: func() { rc.HasUncommittedChanges = v }, err: err} | ||
| }() | ||
|
|
||
| for range numConcurrent { | ||
| r := <-ch | ||
| if r.err != nil { | ||
| return nil, r.err | ||
| } | ||
| r.setFn() | ||
| } | ||
|
|
||
| rc.IsMain = strings.EqualFold(rc.CurrentBranch, rc.MainBranch) | ||
|
|
||
| // Phase 2: gh API call needs Org/Repo from phase 1 | ||
| parentRepo, err := getParentRepoByOrgRepo(wd, rc.Org, rc.Repo) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| rc.ParentRepo = parentRepo | ||
|
|
||
| return rc, nil | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,6 +165,9 @@ func getListOfChangedFiles(wd, statusOutput string) ([]fileInfo, error) { | |
| oldSize = newFileSize | ||
| case `??`: | ||
| newFileSize, err2 = getFileSize(wd, name) | ||
| case `AD`: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gitcmds/status.go:168: Treating status Severity: medium 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Severity: low 🤖 Was this useful? React with 👍 or 👎 |
||
| // file was added, then removed -> consider it never existed | ||
| continue | ||
| default: | ||
| return nil, fmt.Errorf("unknown file status %s for file %s", statusCode, name) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,46 @@ | ||
| module github.com/untillpro/qs | ||
|
|
||
| go 1.26.0 | ||
| go 1.26.2 | ||
|
|
||
| require ( | ||
| github.com/atotto/clipboard v0.1.4 | ||
| github.com/coreos/go-semver v0.3.1 | ||
| github.com/fatih/color v1.18.0 | ||
| github.com/go-git/go-git/v5 v5.16.5 | ||
| github.com/fatih/color v1.19.0 | ||
| github.com/go-git/go-git/v5 v5.18.0 | ||
| github.com/google/uuid v1.6.0 | ||
| github.com/spf13/cobra v1.10.2 | ||
| github.com/stretchr/testify v1.11.1 | ||
| github.com/untillpro/goutils v0.0.0-20231201170327-3c33c6010100 | ||
| github.com/voedger/voedger v1.202405300917.1 | ||
| golang.org/x/mod v0.33.0 | ||
| golang.org/x/mod v0.35.0 | ||
| ) | ||
|
|
||
| require ( | ||
| dario.cat/mergo v1.0.2 // indirect | ||
| github.com/Microsoft/go-winio v0.6.2 // indirect | ||
| github.com/ProtonMail/go-crypto v1.3.0 // indirect | ||
| github.com/ProtonMail/go-crypto v1.4.1 // indirect | ||
| github.com/cloudflare/circl v1.6.3 // indirect | ||
| github.com/cyphar/filepath-securejoin v0.6.1 // indirect | ||
| github.com/davecgh/go-spew v1.1.1 // indirect | ||
| github.com/emirpasic/gods v1.18.1 // indirect | ||
| github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect | ||
| github.com/go-git/go-billy/v5 v5.7.0 // indirect | ||
| github.com/go-git/go-billy/v5 v5.8.0 // indirect | ||
| github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect | ||
| github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
| github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect | ||
| github.com/kevinburke/ssh_config v1.6.0 // indirect | ||
| github.com/klauspost/cpuid/v2 v2.3.0 // indirect | ||
| github.com/mattn/go-colorable v0.1.14 // indirect | ||
| github.com/mattn/go-isatty v0.0.20 // indirect | ||
| github.com/mattn/go-isatty v0.0.21 // indirect | ||
| github.com/pjbgf/sha1cd v0.5.0 // indirect | ||
| github.com/pmezard/go-difflib v1.0.0 // indirect | ||
| github.com/sergi/go-diff v1.4.0 // indirect | ||
| github.com/skeema/knownhosts v1.3.2 // indirect | ||
| github.com/spf13/pflag v1.0.10 // indirect | ||
| github.com/xanzy/ssh-agent v0.3.3 // indirect | ||
| golang.org/x/crypto v0.48.0 // indirect | ||
| golang.org/x/net v0.50.0 // indirect | ||
| golang.org/x/sys v0.41.0 // indirect | ||
| golang.org/x/crypto v0.50.0 // indirect | ||
| golang.org/x/net v0.53.0 // indirect | ||
| golang.org/x/sys v0.43.0 // indirect | ||
| gopkg.in/warnings.v0 v0.1.2 // indirect | ||
| gopkg.in/yaml.v3 v3.0.1 // indirect | ||
| ) |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gitcmds/gitcmds.go:485: Using
--jq ".parent.full_name"can return the literal stringnullfor non-fork repos, which would makelen(parentRepo) > 0checks mis-detect a fork and potentially break single-remote workflows.Severity: high
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.