Skip to content

Commit

Permalink
git-gui: Use prefix if blame is run in a subdirectory
Browse files Browse the repository at this point in the history
I think it was Andy Parkins who pointed out that git gui blame HEAD f
does not work if f is in a subdirectory and we are currently running
git-gui within that subdirectory.  This is happening because we did
not take the user's prefix into account when we computed the file
path in the repository.

We now assume the prefix as returned by rev-parse --show-prefix is
valid and we use that during the command line blame subcommand when
we apply the parameters.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  • Loading branch information
Shawn O. Pearce committed May 9, 2007
1 parent 685caf9 commit c612785
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,14 @@ unset -nocomplain v _junk act_maj act_min req_maj req_min
##
## repository setup

if { [catch {set _gitdir $env(GIT_DIR)}]
&& [catch {set _gitdir [git rev-parse --git-dir]} err]} {
if {[catch {
set _gitdir $env(GIT_DIR)
set _prefix {}
}]
&& [catch {
set _gitdir [git rev-parse --git-dir]
set _prefix [git rev-parse --show-prefix]
} err]} {
catch {wm withdraw .}
error_popup "Cannot find the git directory:\n\n$err"
exit 1
Expand Down Expand Up @@ -1590,7 +1596,7 @@ blame {
exit 1
}
set current_branch [lindex $argv 0]
blame::new $current_branch [lindex $argv 1]
blame::new $current_branch $_prefix[lindex $argv 1]
return
}
citool -
Expand Down

0 comments on commit c612785

Please sign in to comment.