@matheusbsbs / matheus-bagliano / commits / c6127856eb
Fork 0

git-gui: Use prefix if blame is run in a subdirectory

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>

Shawn O. Pearce committed May 8, 2007 at 21:58 UTC c6127856eb318157121b0aeab150c074e9eeb3de
1 file changed +9 -3
git-gui.sh
+9 -3
@@ -261,8 +261,14 @@ unset -nocomplain v _junk act_maj act_min req_maj req_min
261 ##
262 ## repository setup
263
264 -if { [catch {set _gitdir $env(GIT_DIR)}]
265 - && [catch {set _gitdir [git rev-parse --git-dir]} err]} {
264 +if {[catch {
265 + set _gitdir $env(GIT_DIR)
266 + set _prefix {}
267 + }]
268 + && [catch {
269 + set _gitdir [git rev-parse --git-dir]
270 + set _prefix [git rev-parse --show-prefix]
271 + } err]} {
272 catch {wm withdraw .}
273 error_popup "Cannot find the git directory:\n\n$err"
274 exit 1
@@ -1590,7 +1596,7 @@ blame {
1596 exit 1
1597 }
1598 set current_branch [lindex $argv 0]
1593 - blame::new $current_branch [lindex $argv 1]
1599 + blame::new $current_branch $_prefix[lindex $argv 1]
1600 return
1601 }
1602 citool -