Fix: Opening files from diff line when not in project root

When trying to open a file from gd in $EDITOR (alt + e) the wrong file
was being opened when the command wasn't executed from the repository's
root directory.
This commit is contained in:
sandroid 2024-04-26 23:38:30 +02:00
parent 6f212fd2b2
commit 76ee5bf803
No known key found for this signature in database
GPG key ID: 91418C9982B8B76E

View file

@ -242,9 +242,11 @@ _forgit_diff_view() {
}
_forgit_edit_diffed_file() {
local input_line=$1
local input_line rootdir
input_line=$1
rootdir=$(git rev-parse --show-toplevel)
filename=$(echo "$input_line" | _forgit_get_single_file_from_diff_line)
$EDITOR "$filename" >/dev/tty </dev/tty
$EDITOR "$rootdir/$filename" >/dev/tty </dev/tty
}
_forgit_diff_enter() {