Compare commits
2 Commits
6aecc8837c
...
111f72bf59
| Author | SHA1 | Date | |
|---|---|---|---|
| 111f72bf59 | |||
| 30fc9bf427 |
@@ -79,6 +79,17 @@ fresh_line_one() {
|
||||
# Check we are in a git repository
|
||||
local git=`${XDG_CACHE_HOME:-$HOME/.cache}/zsh/git-prompt`
|
||||
|
||||
# Truncate branch name from directory when already shown (e.g., worktrees)
|
||||
if [[ -n "$git" ]] && [[ -z $SANDBOX_HOME ]]; then
|
||||
local branch_name=$(git symbolic-ref --short HEAD 2>/dev/null)
|
||||
if [[ -n "$branch_name" ]]; then
|
||||
local dir=${(%):-%~}
|
||||
if [[ "$dir" == *"@${branch_name}"* ]]; then
|
||||
directory="%{%F{37}%}${dir/@${branch_name}/@}%{%f%}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If the last command failed, display its error code at the right
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
case $exit_code in
|
||||
|
||||
@@ -34,6 +34,12 @@ Manage git worktrees by branch name."
|
||||
local root=$(git rev-parse --show-toplevel)
|
||||
local wt_dest=${root:h}/${root:t}@${branch}
|
||||
git worktree add "$wt_dest" "$branch"
|
||||
if [ -f $root/.enter ] && [ -f $root/.exit ]; then
|
||||
ln -s $root/.enter $wt_dest/.enter
|
||||
ln -s $root/.exit $wt_dest/.exit
|
||||
_autoenv_authorized $PWD/.enter yes
|
||||
_autoenv_authorized $PWD/.exit yes
|
||||
fi
|
||||
;;
|
||||
rm|remove)
|
||||
local wt_path
|
||||
|
||||
Reference in New Issue
Block a user