From a8f8074719bc83865fe1f7833314c8a90fc6271a Mon Sep 17 00:00:00 2001 From: nash Date: Tue, 19 Mar 2024 16:24:18 +0800 Subject: [PATCH] Adjust `gp` to reduce one `_git_status` call --- modules/git/git-v2.nu | 4 ++-- modules/kubernetes/kubernetes.nu | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/git/git-v2.nu b/modules/git/git-v2.nu index 92a2b6c02..f7e684524 100644 --- a/modules/git/git-v2.nu +++ b/modules/git/git-v2.nu @@ -210,11 +210,11 @@ export def gp [ } else { let m = if $merge { [] } else { [--rebase] } let a = if $autostash {[--autostash]} else {[]} - let branch = if ($branch | is-empty) { (_git_status).branch } else { $branch } + let prev = (_git_status).branch + let branch = if ($branch | is-empty) { $prev } else { $branch } let branch_repr = $'(ansi yellow)($branch)(ansi light_gray)' let lbs = git branch | lines | each { $in | str substring 2..} let rbs = (remote_branches) - let prev = (_git_status).branch if $"($remote)/($branch)" in $rbs { if $branch in $lbs { let bmsg = $'both local and remote have ($branch_repr) branch' diff --git a/modules/kubernetes/kubernetes.nu b/modules/kubernetes/kubernetes.nu index e75db2154..76aa489f7 100644 --- a/modules/kubernetes/kubernetes.nu +++ b/modules/kubernetes/kubernetes.nu @@ -207,6 +207,7 @@ export-env { listeners: { _: [spec listeners] name: [name] + hostname: [hostname] port: [port] protocol: [protocol] tls: [tls]