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,8 @@ git_open_file() {
121121 fi
122122
123123 repo_path=$( git_get_repo_path $remote )
124- file=$( [[ -n " $2 " ]] && echo " $2 " || echo " " )
124+ prefix=$( git rev-parse --show-prefix 2> /dev/null)
125+ file=$( [[ -n " $2 " ]] && echo " ${prefix} $2 " || echo " " )
125126 branch=$( [[ -n " $3 " ]] && echo " $3 " || git branch --show-current)
126127
127128 case " $remote_type " in
Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ describe "git_open_file"
6868assert_value " https://github.com/chenasraf/git-open/blob/$current_branch /test.zsh" $( git_open_file " " test.zsh)
6969assert_value " https://github.com/chenasraf/git-open/blob/develop/test.zsh" $( git_open_file " " test.zsh develop)
7070
71+ describe " git_open_file from subdirectory"
72+ assert_value " https://github.com/chenasraf/git-open/blob/$current_branch /tests/test.zsh" $( cd " ${0: A: h} " && git_open_file " " test.zsh)
73+
7174describe " git_open_commit"
7275assert_value " https://github.com/chenasraf/git-open/commit/1a4c2b6" $( git_open_commit " " 1a4c2b6)
7376assert_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