...
This commit is contained in:
@@ -208,11 +208,7 @@ fn cmd_git_execute(cmd Command) ! {
|
||||
coderoot = os.environ()['CODEROOT']
|
||||
}
|
||||
|
||||
mut gs := gittools.get(coderoot: coderoot)!
|
||||
if coderoot.len > 0 {
|
||||
// is a hack for now
|
||||
gs = gittools.new(coderoot: coderoot)!
|
||||
}
|
||||
mut gs := gittools.new(coderoot: coderoot)!
|
||||
|
||||
// create the filter for doing group actions, or action on 1 repo
|
||||
mut filter := cmd.flags.get_string('filter') or { '' }
|
||||
|
||||
@@ -125,7 +125,7 @@ pub fn plbook_code_get(cmd Command) !string {
|
||||
pull := cmd.flags.get_bool('gitpull') or { false }
|
||||
// interactive := !cmd.flags.get_bool('script') or { false }
|
||||
|
||||
mut gs := gittools.get(coderoot: coderoot)!
|
||||
mut gs := gittools.new(coderoot: coderoot)!
|
||||
if url.len > 0 {
|
||||
mut repo := gs.get_repo(
|
||||
pull: pull
|
||||
|
||||
@@ -48,8 +48,8 @@ play_docusaurus.play(mut plbook)! // <-- new line, optional
|
||||
|
||||
| Problem | What to do |
|
||||
|---|---|
|
||||
| **Wrong API name** – the code uses **`gittools.get(gittools.GitStructureArgGet{})`** – there is no `GitStructureArgGet` struct in the git‑tools package. The correct type is **`gittools.GitStructureArgs`** (or the default `gittools.GitStructure` argument). | Replace `GitStructureArgGet` with the correct type (`gittools.GitStructureArgs`). |
|
||||
| **Missing import alias** – the file uses `gittools.get` and `gittools.new` but the import is just `import freeflowuniverse.herolib.develop.gittools`. That is fine, but for clarity rename the import to **`gittools`** (it already is) and use the same alias everywhere. |
|
||||
| **Wrong API name** – the code uses **`gittools.new(gittools.GitStructureArgGet{})`** – there is no `GitStructureArgGet` struct in the git‑tools package. The correct type is **`gittools.GitStructureArgs`** (or the default `gittools.GitStructure` argument). | Replace `GitStructureArgGet` with the correct type (`gittools.GitStructureArgs`). |
|
||||
| **Missing import alias** – the file uses `gittools.new` and `gittools.new` but the import is just `import freeflowuniverse.herolib.develop.gittools`. That is fine, but for clarity rename the import to **`gittools`** (it already is) and use the same alias everywhere. |
|
||||
| **Potential nil `gs`** – after a `git.clone` we do `gs = gittools.new(coderoot: coderoot)!`. This shadows the previous `gs` and loses the original configuration (e.g. `light`, `log`). The intent is to **re‑initialise** the `GitStructure` **only** when a `coderoot` is explicitly given. Keep the current flow but **document** the intention. |
|
||||
| **Unused variable `action_`** – the variable `action_` is used only for iteration. No problem. |
|
||||
| **Missing `gittools.GitCloneArgs`** – check that the struct is actually named `GitCloneArgs` in the git‑tools package. If not, change to the proper name. | Verify and, if needed, replace with the correct struct name (`gittools.GitCloneArgs`). |
|
||||
@@ -82,7 +82,7 @@ fn play_git(mut plbook PlayBook) ! {
|
||||
// ... (same as before)
|
||||
} else {
|
||||
// Default GitStructure (no args)
|
||||
gittools.get(gittools.GitStructureArgs{})!
|
||||
gittools.new(gittools.GitStructureArgs{})!
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
||||
@@ -27,12 +27,13 @@ fn play_core(mut plbook PlayBook) ! {
|
||||
mut playrunpath := action.params.get_default('path', '')!
|
||||
if playrunpath.len == 0 {
|
||||
action.name = 'pull'
|
||||
playrunpath = gittools.get_repo_path(
|
||||
mypath:=gittools.path(
|
||||
path: playrunpath
|
||||
git_url: action.params.get_default('git_url', '')!
|
||||
git_reset: action.params.get_default_false('git_reset')
|
||||
git_pull: action.params.get_default_false('git_pull')
|
||||
)!
|
||||
playrunpath = mypath.path
|
||||
}
|
||||
if playrunpath.len == 0 {
|
||||
return error("can't run a heroscript didn't find url or path.")
|
||||
|
||||
@@ -11,11 +11,11 @@ import freeflowuniverse.herolib.ui.console // For verbose error reporting
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
fn play_git(mut plbook PlayBook) ! {
|
||||
// -----------------------------------------------------------
|
||||
// !!git.define – configure the GitStructure
|
||||
// -----------------------------------------------------------
|
||||
|
||||
mut gs:=gittools.new()!
|
||||
|
||||
define_actions := plbook.find(filter: 'git.define')!
|
||||
mut gs := if define_actions.len > 0 {
|
||||
if define_actions.len > 0 {
|
||||
mut p := define_actions[0].params
|
||||
coderoot := p.get_default('coderoot', '')!
|
||||
light := p.get_default_true('light')
|
||||
@@ -25,19 +25,19 @@ fn play_git(mut plbook PlayBook) ! {
|
||||
ssh_key_path := p.get_default('ssh_key_path', '')!
|
||||
reload := p.get_default_false('reload')
|
||||
|
||||
gittools.new(
|
||||
gs=gittools.new(
|
||||
coderoot: coderoot
|
||||
light: light
|
||||
log: log
|
||||
debug: debug
|
||||
offline: offline
|
||||
ssh_key_path: ssh_key_path
|
||||
reload: reload
|
||||
)!
|
||||
} else {
|
||||
// Default GitStructure (no args)
|
||||
gittools.get()!
|
||||
}
|
||||
|
||||
if light || ssh_key_path.len > 0 {
|
||||
gs.config_set(light: light, ssh_key_path: ssh_key_path)!
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// !!git.clone – clone repositories
|
||||
|
||||
Reference in New Issue
Block a user