Add relative path fix to git-hub-browse
This commit is contained in:
parent
f5a8cb456b
commit
5d09b20421
1 changed files with 4 additions and 1 deletions
|
@ -12,6 +12,8 @@ if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
|||
return 1
|
||||
fi
|
||||
|
||||
root="$(command git rev-parse --show-toplevel)"
|
||||
|
||||
local remotes remote references reference file url
|
||||
|
||||
remote="${1:-origin}"
|
||||
|
@ -42,7 +44,8 @@ if [[ "$reference" == 'HEAD' ]]; then
|
|||
reference="$(command git rev-parse HEAD 2> /dev/null)"
|
||||
fi
|
||||
|
||||
file="$3"
|
||||
file="${3:-$(pwd)}"
|
||||
file="$(command realpath "$file" | sed "s|^$root||")"
|
||||
|
||||
if [[ -n "$url" ]]; then
|
||||
url="$url/tree/$reference/$file"
|
||||
|
|
Loading…
Reference in a new issue