git:checkout-worktree: Improve name on recursion
When calling git-checkout-worktree from inside a temporary working tree (doesn't necessary need to be a recursive call, could be another shell too) the name would be very long. Fix this by using the folder name of the main working tree.
This commit is contained in:
@@ -27,7 +27,9 @@
|
|||||||
emulate -L zsh -o err_return -o no_unset
|
emulate -L zsh -o err_return -o no_unset
|
||||||
|
|
||||||
local REPO_NAME WORKTREE_PATH
|
local REPO_NAME WORKTREE_PATH
|
||||||
REPO_NAME="${$(git rev-parse --show-toplevel):t}"
|
# Use the folder name of the main working tree to make calls from another
|
||||||
|
# temporary working tree possible
|
||||||
|
REPO_NAME="${${${$(git rev-parse --git-dir):A}%%/.git*}:t}"
|
||||||
WORKTREE_PATH="$(mktemp -d -p "" "worktree.XXX.$REPO_NAME.${1//\//_}")"
|
WORKTREE_PATH="$(mktemp -d -p "" "worktree.XXX.$REPO_NAME.${1//\//_}")"
|
||||||
|
|
||||||
local errc ret=0
|
local errc ret=0
|
||||||
|
|||||||
Reference in New Issue
Block a user