Skip to content

Commit 731ab1f

Browse files
committed
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.
2 parents c70115b + 5fc6eda commit 731ab1f

File tree

4 files changed

+36
-11
lines changed

4 files changed

+36
-11
lines changed

git-gui/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ ifndef gitexecdir
3434
endif
3535

3636
ifndef sharedir
37+
ifeq (git-core,$(notdir $(gitexecdir)))
38+
sharedir := $(dir $(patsubst %/,%,$(dir $(gitexecdir))))share
39+
else
3740
sharedir := $(dir $(gitexecdir))share
3841
endif
42+
endif
3943

4044
ifndef INSTALL
4145
INSTALL = install
@@ -156,6 +160,7 @@ endif
156160
ifneq (,$(findstring MINGW,$(uname_S)))
157161
NO_MSGFMT=1
158162
GITGUI_WINDOWS_WRAPPER := YesPlease
163+
GITGUI_RELATIVE := 1
159164
endif
160165

161166
ifdef GITGUI_MACOSXAPP

git-gui/git-gui.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ proc _git_cmd {name} {
317317
return $v
318318
}
319319

320-
proc _which {what} {
320+
proc _which {what args} {
321321
global env _search_exe _search_path
322322

323323
if {$_search_path eq {}} {
@@ -340,8 +340,14 @@ proc _which {what} {
340340
}
341341
}
342342
343+
if {[is_Windows] && [lsearch -exact $args -script] >= 0} {
344+
set suffix {}
345+
} else {
346+
set suffix $_search_exe
347+
}
348+
343349
foreach p $_search_path {
344-
set p [file join $p $what$_search_exe]
350+
set p [file join $p $what$suffix]
345351
if {[file exists $p]} {
346352
return [file normalize $p]
347353
}
@@ -1686,7 +1692,7 @@ proc do_gitk {revs} {
16861692
# -- Always start gitk through whatever we were loaded with. This
16871693
# lets us bypass using shell process on Windows systems.
16881694
#
1689-
set exe [_which gitk]
1695+
set exe [_which gitk -script]
16901696
set cmd [list [info nameofexecutable] $exe]
16911697
if {$exe eq {}} {
16921698
error_popup [mc "Couldn't find gitk in PATH"]
@@ -2925,6 +2931,7 @@ if {[is_enabled transport]} {
29252931
populate_fetch_menu
29262932
set n [expr {[.mbar.remote index end] - $n}]
29272933
if {$n > 0} {
2934+
if {[.mbar.remote type 0] eq "tearoff"} { incr n }
29282935
.mbar.remote insert $n separator
29292936
}
29302937
unset n

git-gui/lib/diff.tcl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ proc clear_diff {} {
1919
proc reshow_diff {} {
2020
global file_states file_lists
2121
global current_diff_path current_diff_side
22+
global ui_diff
2223

2324
set p $current_diff_path
2425
if {$p eq {}} {
@@ -28,7 +29,8 @@ proc reshow_diff {} {
2829
|| [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} {
2930
clear_diff
3031
} else {
31-
show_diff $p $current_diff_side
32+
set save_pos [lindex [$ui_diff yview] 0]
33+
show_diff $p $current_diff_side {} $save_pos
3234
}
3335
}
3436

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

55-
proc show_diff {path w {lno {}}} {
57+
proc show_diff {path w {lno {}} {scroll_pos {}}} {
5658
global file_states file_lists
5759
global is_3way_diff diff_active repo_config
5860
global ui_diff ui_index ui_workdir
@@ -151,6 +153,10 @@ proc show_diff {path w {lno {}}} {
151153
$ui_diff conf -state disabled
152154
set diff_active 0
153155
unlock_index
156+
if {$scroll_pos ne {}} {
157+
update
158+
$ui_diff yview moveto $scroll_pos
159+
}
154160
ui_ready
155161
return
156162
}
@@ -190,10 +196,10 @@ proc show_diff {path w {lno {}}} {
190196
-blocking 0 \
191197
-encoding binary \
192198
-translation binary
193-
fileevent $fd readable [list read_diff $fd]
199+
fileevent $fd readable [list read_diff $fd $scroll_pos]
194200
}
195201

196-
proc read_diff {fd} {
202+
proc read_diff {fd scroll_pos} {
197203
global ui_diff diff_active
198204
global is_3way_diff current_diff_header
199205

@@ -282,6 +288,10 @@ proc read_diff {fd} {
282288
close $fd
283289
set diff_active 0
284290
unlock_index
291+
if {$scroll_pos ne {}} {
292+
update
293+
$ui_diff yview moveto $scroll_pos
294+
}
285295
ui_ready
286296

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

git-gui/windows/git-gui.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ if { $argc >=2 && [lindex $argv 0] == "--working-dir" } {
88
incr argc -2
99
}
1010

11-
set gitguidir [file dirname [info script]]
12-
regsub -all ";" $gitguidir "\\;" gitguidir
13-
set env(PATH) "$gitguidir;$env(PATH)"
14-
unset gitguidir
11+
set bindir [file dirname \
12+
[file dirname \
13+
[file dirname [info script]]]]
14+
set bindir [file join $bindir bin]
15+
regsub -all ";" $bindir "\\;" bindir
16+
set env(PATH) "$bindir;$env(PATH)"
17+
unset bindir
1518
1619
source [file join [file dirname [info script]] git-gui.tcl]

0 commit comments

Comments
 (0)