mirror of https://git.jolheiser.com/dotnix.git
fix: respect owner flag in clone command
Signed-off-by: jolheiser <john.olheiser@gmail.com>teamcity
parent
68b207f960
commit
7eea1dda6a
|
@ -33,7 +33,6 @@ def clone [
|
||||||
--forge (-f) = "github": string@"forge types" # Forge type (github, gitea, jojodev, codeberg)
|
--forge (-f) = "github": string@"forge types" # Forge type (github, gitea, jojodev, codeberg)
|
||||||
--owner (-o): string # Owner (default: current dir name)
|
--owner (-o): string # Owner (default: current dir name)
|
||||||
] {
|
] {
|
||||||
let owner = ($env.PWD | path basename)
|
|
||||||
mut id = 'gh'
|
mut id = 'gh'
|
||||||
if $forge == 'gitea' {
|
if $forge == 'gitea' {
|
||||||
$id = 'gt'
|
$id = 'gt'
|
||||||
|
@ -42,12 +41,18 @@ def clone [
|
||||||
} else if $forge == 'codeberg' {
|
} else if $forge == 'codeberg' {
|
||||||
$id = 'cb'
|
$id = 'cb'
|
||||||
}
|
}
|
||||||
|
mut namespace = ($env.PWD | path basename)
|
||||||
|
if $owner != '' {
|
||||||
|
$namespace = $owner
|
||||||
|
}
|
||||||
let origin = $'ssh:($id):jolheiser/($repo).git'
|
let origin = $'ssh:($id):jolheiser/($repo).git'
|
||||||
let upstream = $'($id):($owner)/($repo).git'
|
let upstream = $'($id):($namespace)/($repo).git'
|
||||||
^git clone $origin
|
^git clone $origin
|
||||||
cd $repo
|
cd $repo
|
||||||
^git remote add upstream $upstream
|
if $namespace != 'jolheiser' {
|
||||||
^git fetch upstream
|
^git remote add upstream $upstream
|
||||||
|
^git fetch upstream
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def fg [args ...string] {
|
def fg [args ...string] {
|
||||||
|
|
Loading…
Reference in New Issue