Browse Source

Merge git://repo.or.cz/git-gui

* git://repo.or.cz/git-gui:
  git-gui (Windows): Change wrapper to execdir 'libexec/git-core'
  git-gui (Windows): Switch to relative discovery of oguilib
  git-gui: Correct installation of library to be $prefix/share
  git-gui: Fix gitk search in $PATH to work on Windows
  git-gui: Preserve scroll position on reshow_diff.
  git-gui: Fix the Remote menu separator.
maint
Junio C Hamano 17 years ago
parent
commit
731ab1f55e
  1. 5
      git-gui/Makefile
  2. 13
      git-gui/git-gui.sh
  3. 18
      git-gui/lib/diff.tcl
  4. 11
      git-gui/windows/git-gui.sh

5
git-gui/Makefile

@ -34,8 +34,12 @@ ifndef gitexecdir @@ -34,8 +34,12 @@ ifndef gitexecdir
endif

ifndef sharedir
ifeq (git-core,$(notdir $(gitexecdir)))
sharedir := $(dir $(patsubst %/,%,$(dir $(gitexecdir))))share
else
sharedir := $(dir $(gitexecdir))share
endif
endif

ifndef INSTALL
INSTALL = install
@ -156,6 +160,7 @@ endif @@ -156,6 +160,7 @@ endif
ifneq (,$(findstring MINGW,$(uname_S)))
NO_MSGFMT=1
GITGUI_WINDOWS_WRAPPER := YesPlease
GITGUI_RELATIVE := 1
endif

ifdef GITGUI_MACOSXAPP

13
git-gui/git-gui.sh

@ -317,7 +317,7 @@ proc _git_cmd {name} { @@ -317,7 +317,7 @@ proc _git_cmd {name} {
return $v
}

proc _which {what} {
proc _which {what args} {
global env _search_exe _search_path

if {$_search_path eq {}} {
@ -340,8 +340,14 @@ proc _which {what} { @@ -340,8 +340,14 @@ proc _which {what} {
}
}

if {[is_Windows] && [lsearch -exact $args -script] >= 0} {
set suffix {}
} else {
set suffix $_search_exe
}

foreach p $_search_path {
set p [file join $p $what$_search_exe]
set p [file join $p $what$suffix]
if {[file exists $p]} {
return [file normalize $p]
}
@ -1686,7 +1692,7 @@ proc do_gitk {revs} { @@ -1686,7 +1692,7 @@ proc do_gitk {revs} {
# -- Always start gitk through whatever we were loaded with. This
# lets us bypass using shell process on Windows systems.
#
set exe [_which gitk]
set exe [_which gitk -script]
set cmd [list [info nameofexecutable] $exe]
if {$exe eq {}} {
error_popup [mc "Couldn't find gitk in PATH"]
@ -2925,6 +2931,7 @@ if {[is_enabled transport]} { @@ -2925,6 +2931,7 @@ if {[is_enabled transport]} {
populate_fetch_menu
set n [expr {[.mbar.remote index end] - $n}]
if {$n > 0} {
if {[.mbar.remote type 0] eq "tearoff"} { incr n }
.mbar.remote insert $n separator
}
unset n

18
git-gui/lib/diff.tcl

@ -19,6 +19,7 @@ proc clear_diff {} { @@ -19,6 +19,7 @@ proc clear_diff {} {
proc reshow_diff {} {
global file_states file_lists
global current_diff_path current_diff_side
global ui_diff

set p $current_diff_path
if {$p eq {}} {
@ -28,7 +29,8 @@ proc reshow_diff {} { @@ -28,7 +29,8 @@ proc reshow_diff {} {
|| [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} {
clear_diff
} else {
show_diff $p $current_diff_side
set save_pos [lindex [$ui_diff yview] 0]
show_diff $p $current_diff_side {} $save_pos
}
}

@ -52,7 +54,7 @@ A rescan will be automatically started to find other files which may have the sa @@ -52,7 +54,7 @@ A rescan will be automatically started to find other files which may have the sa
rescan ui_ready 0
}

proc show_diff {path w {lno {}}} {
proc show_diff {path w {lno {}} {scroll_pos {}}} {
global file_states file_lists
global is_3way_diff diff_active repo_config
global ui_diff ui_index ui_workdir
@ -151,6 +153,10 @@ proc show_diff {path w {lno {}}} { @@ -151,6 +153,10 @@ proc show_diff {path w {lno {}}} {
$ui_diff conf -state disabled
set diff_active 0
unlock_index
if {$scroll_pos ne {}} {
update
$ui_diff yview moveto $scroll_pos
}
ui_ready
return
}
@ -190,10 +196,10 @@ proc show_diff {path w {lno {}}} { @@ -190,10 +196,10 @@ proc show_diff {path w {lno {}}} {
-blocking 0 \
-encoding binary \
-translation binary
fileevent $fd readable [list read_diff $fd]
fileevent $fd readable [list read_diff $fd $scroll_pos]
}

proc read_diff {fd} {
proc read_diff {fd scroll_pos} {
global ui_diff diff_active
global is_3way_diff current_diff_header

@ -282,6 +288,10 @@ proc read_diff {fd} { @@ -282,6 +288,10 @@ proc read_diff {fd} {
close $fd
set diff_active 0
unlock_index
if {$scroll_pos ne {}} {
update
$ui_diff yview moveto $scroll_pos
}
ui_ready

if {[$ui_diff index end] eq {2.0}} {

11
git-gui/windows/git-gui.sh

@ -8,9 +8,12 @@ if { $argc >=2 && [lindex $argv 0] == "--working-dir" } { @@ -8,9 +8,12 @@ if { $argc >=2 && [lindex $argv 0] == "--working-dir" } {
incr argc -2
}

set gitguidir [file dirname [info script]]
regsub -all ";" $gitguidir "\\;" gitguidir
set env(PATH) "$gitguidir;$env(PATH)"
unset gitguidir
set bindir [file dirname \
[file dirname \
[file dirname [info script]]]]
set bindir [file join $bindir bin]
regsub -all ";" $bindir "\\;" bindir
set env(PATH) "$bindir;$env(PATH)"
unset bindir

source [file join [file dirname [info script]] git-gui.tcl]

Loading…
Cancel
Save