3318
return {}
3319
}
3320
3321
+# Turn an absolute path into one relative to the current directory
3322
+proc make_relative {f} {
3323
+ set elts [file split $f]
3324
+ set here [file split [pwd]]
3325
+ set ei 0
3326
+ set hi 0
3327
+ set res {}
3328
+ foreach d $here {
3329
+ if {$ei < $hi || $ei >= [llength $elts] || [lindex $elts $ei] ne $d} {
3330
+ lappend res ".."
3331
+ } else {
3332
+ incr ei
3333
+ }
3334
+ incr hi
3335
+ }
3336
+ set elts [concat $res [lrange $elts $ei end]]
3337
+ return [eval file join $elts]
3338
+}
3339
+
3340
proc external_blame {parent_idx {line {}}} {
3322
- global flist_menu_file
3341
+ global flist_menu_file gitdir
3342
global nullid nullid2
3343
global parentlist selectedline currentid
3344
3357
if {$line ne {} && $line > 1} {
3358
lappend cmdline "--line=$line"
3359
}
3341
- lappend cmdline $base_commit $flist_menu_file
3360
+ set f [file join [file dirname $gitdir] $flist_menu_file]
3361
+ # Unfortunately it seems git gui blame doesn't like
3362
+ # being given an absolute path...
3363
+ set f [make_relative $f]
3364
+ lappend cmdline $base_commit $f
3365
+ puts "cmdline={$cmdline}"
3366
if {[catch {eval exec $cmdline &} err]} {
3367
error_popup "[mc "git gui blame: command failed:"] $err"
3368
}
3406
error_popup [mc "Error reading index: %s" $err]
3407
return
3408
}
3409
+ } else {
3410
+ set id $parents($curview,$currentid)
3411
}
3412
} else {
3413
set id [lindex $parents($curview,$currentid) $pi]
3424
} else {
3425
lappend blameargs $id
3426
}
3401
- lappend blameargs -- $flist_menu_file
3427
+ lappend blameargs -- [file join [file dirname $gitdir] $flist_menu_file]
3428
if {[catch {
3429
set f [open $blameargs r]
3430
} err]} {