-
Notifications
You must be signed in to change notification settings - Fork 4
test issue #145
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
Closed
Closed
test issue #145
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
for range numConcurrentattempts to range over anint, which won’t compile in Go; as written,LoadRepoContextcan’t build/run.Severity: high
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.