File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ git_open_file() {
121121 fi
122122
123123 repo_path=$( git_get_repo_path $remote )
124- prefix=$( git rev-parse --show-prefix 2> /dev/null)
124+ prefix=${GIT_PREFIX :- $ (git rev-parse --show-prefix 2>/ dev/ null)}
125125 file=$( [[ -n " $2 " ]] && echo " ${prefix} $2 " || echo " " )
126126 branch=$( [[ -n " $3 " ]] && echo " $3 " || git branch --show-current)
127127
Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ assert_value "https://github.com/chenasraf/git-open/blob/develop/test.zsh" $(git
7171describe " git_open_file from subdirectory"
7272assert_value " https://github.com/chenasraf/git-open/blob/$current_branch /tests/test.zsh" $( cd " ${0: A: h} " && git_open_file " " test.zsh)
7373
74+ describe " git_open_file from subdirectory (via git alias)"
75+ assert_value " https://github.com/chenasraf/git-open/blob/$current_branch /tests/test.zsh" $( GIT_PREFIX=tests/ git_open_file " " test.zsh)
76+
7477describe " git_open_commit"
7578assert_value " https://github.com/chenasraf/git-open/commit/1a4c2b6" $( git_open_commit " " 1a4c2b6)
7679assert_value " https://github.com/chenasraf/git-open/commit/$current_ref " $( git_open_commit)
You can’t perform that action at this time.
0 commit comments