From 7e09b1531faa260226e0d4f7c850660b7ccb2f04 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 27 Jul 2008 10:34:21 +0400 Subject: git-gui: Fix the Remote menu separator. It was positioned incorrectly (offset by one position) if the menu had a tear-off handle. Signed-off-by: Alexander Gavrilov Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index 7c27a43..ce941ad 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2925,6 +2925,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 -- cgit v0.10.2-6-g49f6 From 25b8fb1e499d0e198e491d10c7023a5f5589e837 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 27 Jul 2008 10:35:38 +0400 Subject: git-gui: Preserve scroll position on reshow_diff. It is especially useful for Stage/Unstage Line, because they invoke full state scan and diff reload, which originally would reset the scroll position to the top of the file. Signed-off-by: Alexander Gavrilov Signed-off-by: Shawn O. Pearce diff --git a/lib/diff.tcl b/lib/diff.tcl index 77990c5..52b79e4 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -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 {} { || [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 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 {}}} { $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 {}}} { -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} { 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}} { -- cgit v0.10.2-6-g49f6 From 79317e5df184773f3211503be49b8836b712facc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 29 Jul 2008 22:36:58 -0700 Subject: git-gui: Fix gitk search in $PATH to work on Windows Back in 15430be5a1 ("Look for gitk in $PATH, not $LIBEXEC/git-core") git-gui learned to use [_which gitk] to locate where gitk's script is as Git 1.6 will install gitk to $prefix/bin (in $PATH) and all of the other tools are in $gitexecdir. This failed on Windows because _which adds the ".exe" suffix as it searches for the program on $PATH, under the assumption that we can only execute something from Tcl if it is a proper Windows executable. When scanning for gitk on Windows we need to omit the ".exe" suffix. Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index ce941ad..14b2d9a 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -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} { } } + 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} { # -- 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"] -- cgit v0.10.2-6-g49f6 From f8f1acf339da302ea912c8dd114042a1ef6f994f Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 27 Jul 2008 14:23:30 -0700 Subject: git-gui: Correct installation of library to be $prefix/share We always wanted the library for git-gui to install into the $prefix/share directory, not $prefix/libexec/share. All of the files in our library are platform independent and may be reused across systems, like any other content stored in the share directory. Our computation of where our library should install to was broken when git itself started installing to $prefix/libexec/git-core, which was one level down from where we expected it to be. Signed-off-by: Steffen Prohaska Signed-off-by: Shawn O. Pearce diff --git a/Makefile b/Makefile index b19fb2d..c9d67fe 100644 --- a/Makefile +++ b/Makefile @@ -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 -- cgit v0.10.2-6-g49f6 From f57ddcc5ecf16d1fff4b6e222352c3220fe8120f Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 27 Jul 2008 18:49:42 +0200 Subject: git-gui (Windows): Switch to relative discovery of oguilib Instead of using an absolute path, git-gui can discover its gui library using a relative path from execdir. We want to use the relative path discovery on MinGW to avoid issues with translation of absolute paths. Signed-off-by: Steffen Prohaska Signed-off-by: Shawn O. Pearce diff --git a/Makefile b/Makefile index c9d67fe..55765c8 100644 --- a/Makefile +++ b/Makefile @@ -160,6 +160,7 @@ endif ifneq (,$(findstring MINGW,$(uname_S))) NO_MSGFMT=1 GITGUI_WINDOWS_WRAPPER := YesPlease + GITGUI_RELATIVE := 1 endif ifdef GITGUI_MACOSXAPP -- cgit v0.10.2-6-g49f6 From 5fc6edab76ea16c5fad7138389c2fcc2076534e7 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 27 Jul 2008 18:49:43 +0200 Subject: git-gui (Windows): Change wrapper to execdir 'libexec/git-core' git-gui needs bindir in PATH to be able to run 'git'. bindir however is not necessarily in PATH if started directly through a Windows shortcut. Therefore, we used to add the directory git-gui is located in. But with the new 'libexec/git-core' layout this directory is no longer identical to bindir. This commit modifies the wrapper script to discover the bindir and add it to PATH. Signed-off-by: Steffen Prohaska Signed-off-by: Shawn O. Pearce diff --git a/windows/git-gui.sh b/windows/git-gui.sh index 98f32c0..53c3a94 100644 --- a/windows/git-gui.sh +++ b/windows/git-gui.sh @@ -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] -- cgit v0.10.2-6-g49f6