Skip to content

Commit a4390ac

Browse files
marcowspaulusmack
authored andcommitted
gitk: Fix "git gui blame" invocation when called from top-level directory
When run in the top-level directory of a git repository, "git rev-parse --git-dir" doesn't return an absolute path, but merely ".git", so the selected file for "git gui blame" has a relative path. The function make_relative then tries to make the already relative path relative, which results in a path like "../../../../Makefile" with as many ".." as there are elements of [pwd]. This regression was introduced by commit 9712b81 (gitk: Fix bugs in blaming code, 2008-12-06), which fixed "git gui blame" when called from subdirs. This also fixes it for bare repositories. Signed-off-by: Markus Heidelberg <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 70a5fc4 commit a4390ac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

gitk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3378,6 +3378,9 @@ proc index_sha1 {fname} {
33783378

33793379
# Turn an absolute path into one relative to the current directory
33803380
proc make_relative {f} {
3381+
if {[file pathtype $f] eq "relative"} {
3382+
return $f
3383+
}
33813384
set elts [file split $f]
33823385
set here [file split [pwd]]
33833386
set ei 0

0 commit comments

Comments
 (0)