Skip to content

Commit

Permalink
gitk: Fix "git gui blame" invocation when called from top-level direc…
Browse files Browse the repository at this point in the history
…tory

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 <markus.heidelberg@web.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Markus Heidelberg authored and Paul Mackerras committed Nov 14, 2009
1 parent 70a5fc4 commit a4390ac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,9 @@ proc index_sha1 {fname} {

# Turn an absolute path into one relative to the current directory
proc make_relative {f} {
if {[file pathtype $f] eq "relative"} {
return $f
}
set elts [file split $f]
set here [file split [pwd]]
set ei 0
Expand Down

0 comments on commit a4390ac

Please sign in to comment.