diff --git a/bin/git-bulk b/bin/git-bulk index e3bdd66d..111cccfc 100755 --- a/bin/git-bulk +++ b/bin/git-bulk @@ -120,7 +120,14 @@ function wsnameToCurrent () { while read -r workspace; do if [ -z "$workspace" ]; then continue; fi parseWsName "$workspace" - if echo "$PWD" | grep -o -q "$rwsdir"; then wsname="$rwsname" && return; fi + # compatibility with environment variable inside .gitconfig: + # use combination of `eval` and `realpath` to: + # 1. dereference possible environment variable contained in $rwsdir + # 2. match workspaces even across different symlinks + rwsdir_rp=$(eval realpath $rwsdir 2>/dev/null) + pwd_rp=$(eval realpath $PWD 2>/dev/null) + # if pwd and workspace directory match, use this workspace name as current workspace + if [[ "$pwd_rp" =~ "$rwsdir_rp" ]]; then wsname="$rwsname" && return; fi done <<< "$(listall)" # when here then not in workspace dir echo 1>&2 "error: you are not in a workspace directory. your registered workspaces are:" && \