mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
Merge branch 'pt/git-gui' into maint
* pt/git-gui: git-gui: fix size and position of window panes on startup git-gui: mc cannot be used before msgcat has been loaded git-gui: use textconv filter for diff and blame git-gui: Avoid using the <<Copy>> binding as a menu accelerator on win32 git-gui: fix shortcut creation on cygwin git-gui: fix PATH environment for mingw development environment git-gui: fix usage of _gitworktree when creating shortcut for windows git-gui: fix "Explore Working Copy" for Windows again git-gui: fix usage of themed widgets variable git-gui: Handle failure of core.worktree to identify the working directory. git-gui: check whether systems nice command works or disable it
This commit is contained in:
commit
e9aa24123d
|
@ -38,7 +38,7 @@ if {[catch {package require Tcl 8.4} err]
|
||||||
tk_messageBox \
|
tk_messageBox \
|
||||||
-icon error \
|
-icon error \
|
||||||
-type ok \
|
-type ok \
|
||||||
-title [mc "git-gui: fatal error"] \
|
-title "git-gui: fatal error" \
|
||||||
-message $err
|
-message $err
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -269,6 +269,17 @@ proc is_config_true {name} {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc is_config_false {name} {
|
||||||
|
global repo_config
|
||||||
|
if {[catch {set v $repo_config($name)}]} {
|
||||||
|
return 0
|
||||||
|
} elseif {$v eq {false} || $v eq {0} || $v eq {no}} {
|
||||||
|
return 1
|
||||||
|
} else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proc get_config {name} {
|
proc get_config {name} {
|
||||||
global repo_config
|
global repo_config
|
||||||
if {[catch {set v $repo_config($name)}]} {
|
if {[catch {set v $repo_config($name)}]} {
|
||||||
|
@ -323,6 +334,8 @@ proc _trace_exec {cmd} {
|
||||||
puts stderr $d
|
puts stderr $d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#'" fix poor old emacs font-lock mode
|
||||||
|
|
||||||
proc _git_cmd {name} {
|
proc _git_cmd {name} {
|
||||||
global _git_cmd_path
|
global _git_cmd_path
|
||||||
|
|
||||||
|
@ -416,6 +429,9 @@ proc _lappend_nice {cmd_var} {
|
||||||
|
|
||||||
if {![info exists _nice]} {
|
if {![info exists _nice]} {
|
||||||
set _nice [_which nice]
|
set _nice [_which nice]
|
||||||
|
if {[catch {exec $_nice git version}]} {
|
||||||
|
set _nice {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if {$_nice ne {}} {
|
if {$_nice ne {}} {
|
||||||
lappend cmd $_nice
|
lappend cmd $_nice
|
||||||
|
@ -634,6 +650,7 @@ proc rmsel_tag {text} {
|
||||||
return $text
|
return $text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wm withdraw .
|
||||||
set root_exists 0
|
set root_exists 0
|
||||||
bind . <Visibility> {
|
bind . <Visibility> {
|
||||||
bind . <Visibility> {}
|
bind . <Visibility> {}
|
||||||
|
@ -782,6 +799,7 @@ set default_config(user.email) {}
|
||||||
|
|
||||||
set default_config(gui.encoding) [encoding system]
|
set default_config(gui.encoding) [encoding system]
|
||||||
set default_config(gui.matchtrackingbranch) false
|
set default_config(gui.matchtrackingbranch) false
|
||||||
|
set default_config(gui.textconv) true
|
||||||
set default_config(gui.pruneduringfetch) false
|
set default_config(gui.pruneduringfetch) false
|
||||||
set default_config(gui.trustmtime) false
|
set default_config(gui.trustmtime) false
|
||||||
set default_config(gui.fastcopyblame) false
|
set default_config(gui.fastcopyblame) false
|
||||||
|
@ -1155,6 +1173,9 @@ apply_config
|
||||||
# try to set work tree from environment, falling back to core.worktree
|
# try to set work tree from environment, falling back to core.worktree
|
||||||
if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
|
if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
|
||||||
set _gitworktree [get_config core.worktree]
|
set _gitworktree [get_config core.worktree]
|
||||||
|
if {$_gitworktree eq ""} {
|
||||||
|
set _gitworktree [file dirname [file normalize $_gitdir]]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if {$_prefix ne {}} {
|
if {$_prefix ne {}} {
|
||||||
if {$_gitworktree eq {}} {
|
if {$_gitworktree eq {}} {
|
||||||
|
@ -2098,7 +2119,7 @@ proc do_explore {} {
|
||||||
# freedesktop.org-conforming system is our best shot
|
# freedesktop.org-conforming system is our best shot
|
||||||
set explorer "xdg-open"
|
set explorer "xdg-open"
|
||||||
}
|
}
|
||||||
eval exec $explorer $_gitworktree &
|
eval exec $explorer [list [file nativename $_gitworktree]] &
|
||||||
}
|
}
|
||||||
|
|
||||||
set is_quitting 0
|
set is_quitting 0
|
||||||
|
@ -2901,6 +2922,7 @@ blame {
|
||||||
set current_branch $head
|
set current_branch $head
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wm deiconify .
|
||||||
switch -- $subcommand {
|
switch -- $subcommand {
|
||||||
browser {
|
browser {
|
||||||
if {$jump_spec ne {}} usage
|
if {$jump_spec ne {}} usage
|
||||||
|
@ -3405,6 +3427,19 @@ lappend diff_actions [list $ctxmsm entryconf [$ctxmsm index last] -state]
|
||||||
$ctxmsm add separator
|
$ctxmsm add separator
|
||||||
create_common_diff_popup $ctxmsm
|
create_common_diff_popup $ctxmsm
|
||||||
|
|
||||||
|
proc has_textconv {path} {
|
||||||
|
if {[is_config_false gui.textconv]} {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
set filter [gitattr $path diff set]
|
||||||
|
set textconv [get_config [join [list diff $filter textconv] .]]
|
||||||
|
if {$filter ne {set} && $textconv ne {}} {
|
||||||
|
return 1
|
||||||
|
} else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} {
|
proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} {
|
||||||
global current_diff_path file_states
|
global current_diff_path file_states
|
||||||
set ::cursorX $x
|
set ::cursorX $x
|
||||||
|
@ -3440,7 +3475,8 @@ proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} {
|
||||||
|| {__} eq $state
|
|| {__} eq $state
|
||||||
|| {_O} eq $state
|
|| {_O} eq $state
|
||||||
|| {_T} eq $state
|
|| {_T} eq $state
|
||||||
|| {T_} eq $state} {
|
|| {T_} eq $state
|
||||||
|
|| [has_textconv $current_diff_path]} {
|
||||||
set s disabled
|
set s disabled
|
||||||
} else {
|
} else {
|
||||||
set s normal
|
set s normal
|
||||||
|
@ -3460,29 +3496,44 @@ $main_status show [mc "Initializing..."]
|
||||||
|
|
||||||
# -- Load geometry
|
# -- Load geometry
|
||||||
#
|
#
|
||||||
catch {
|
proc on_ttk_pane_mapped {w pane pos} {
|
||||||
set gm $repo_config(gui.geometry)
|
bind $w <Map> {}
|
||||||
wm geometry . [lindex $gm 0]
|
after 0 [list after idle [list $w sashpos $pane $pos]]
|
||||||
if {$use_ttk} {
|
|
||||||
.vpane sashpos 0 [lindex $gm 1]
|
|
||||||
.vpane.files sashpos 0 [lindex $gm 2]
|
|
||||||
} else {
|
|
||||||
.vpane sash place 0 \
|
|
||||||
[lindex $gm 1] \
|
|
||||||
[lindex [.vpane sash coord 0] 1]
|
|
||||||
.vpane.files sash place 0 \
|
|
||||||
[lindex [.vpane.files sash coord 0] 0] \
|
|
||||||
[lindex $gm 2]
|
|
||||||
}
|
}
|
||||||
unset gm
|
proc on_tk_pane_mapped {w pane x y} {
|
||||||
|
bind $w <Map> {}
|
||||||
|
after 0 [list after idle [list $w sash place $pane $x $y]]
|
||||||
|
}
|
||||||
|
proc on_application_mapped {} {
|
||||||
|
global repo_config use_ttk
|
||||||
|
bind . <Map> {}
|
||||||
|
set gm $repo_config(gui.geometry)
|
||||||
|
if {$use_ttk} {
|
||||||
|
bind .vpane <Map> \
|
||||||
|
[list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
|
||||||
|
bind .vpane.files <Map> \
|
||||||
|
[list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
|
||||||
|
} else {
|
||||||
|
bind .vpane <Map> \
|
||||||
|
[list on_tk_pane_mapped %W 0 \
|
||||||
|
[lindex $gm 1] \
|
||||||
|
[lindex [.vpane sash coord 0] 1]]
|
||||||
|
bind .vpane.files <Map> \
|
||||||
|
[list on_tk_pane_mapped %W 0 \
|
||||||
|
[lindex [.vpane.files sash coord 0] 0] \
|
||||||
|
[lindex $gm 2]]
|
||||||
|
}
|
||||||
|
wm geometry . [lindex $gm 0]
|
||||||
|
}
|
||||||
|
if {[info exists repo_config(gui.geometry)]} {
|
||||||
|
bind . <Map> [list on_application_mapped]
|
||||||
|
wm geometry . [lindex $repo_config(gui.geometry) 0]
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Load window state
|
# -- Load window state
|
||||||
#
|
#
|
||||||
catch {
|
if {[info exists repo_config(gui.wmstate)]} {
|
||||||
set gws $repo_config(gui.wmstate)
|
catch {wm state . $repo_config(gui.wmstate)}
|
||||||
wm state . $gws
|
|
||||||
unset gws
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Key Bindings
|
# -- Key Bindings
|
||||||
|
|
|
@ -449,11 +449,28 @@ method _load {jump} {
|
||||||
|
|
||||||
$status show [mc "Reading %s..." "$commit:[escape_path $path]"]
|
$status show [mc "Reading %s..." "$commit:[escape_path $path]"]
|
||||||
$w_path conf -text [escape_path $path]
|
$w_path conf -text [escape_path $path]
|
||||||
|
|
||||||
|
set do_textconv 0
|
||||||
|
if {![is_config_false gui.textconv] && [git-version >= 1.7.2]} {
|
||||||
|
set filter [gitattr $path diff set]
|
||||||
|
set textconv [get_config [join [list diff $filter textconv] .]]
|
||||||
|
if {$filter ne {set} && $textconv ne {}} {
|
||||||
|
set do_textconv 1
|
||||||
|
}
|
||||||
|
}
|
||||||
if {$commit eq {}} {
|
if {$commit eq {}} {
|
||||||
set fd [open $path r]
|
if {$do_textconv ne 0} {
|
||||||
|
set fd [open |[list $textconv $path] r]
|
||||||
|
} else {
|
||||||
|
set fd [open $path r]
|
||||||
|
}
|
||||||
fconfigure $fd -eofchar {}
|
fconfigure $fd -eofchar {}
|
||||||
} else {
|
} else {
|
||||||
set fd [git_read cat-file blob "$commit:$path"]
|
if {$do_textconv ne 0} {
|
||||||
|
set fd [git_read cat-file --textconv "$commit:$path"]
|
||||||
|
} else {
|
||||||
|
set fd [git_read cat-file blob "$commit:$path"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fconfigure $fd \
|
fconfigure $fd \
|
||||||
-blocking 0 \
|
-blocking 0 \
|
||||||
|
|
|
@ -100,12 +100,17 @@ constructor pick {} {
|
||||||
$opts insert end [mc "Clone Existing Repository"] link_clone
|
$opts insert end [mc "Clone Existing Repository"] link_clone
|
||||||
$opts insert end "\n"
|
$opts insert end "\n"
|
||||||
if {$m_repo ne {}} {
|
if {$m_repo ne {}} {
|
||||||
|
if {[tk windowingsystem] eq "win32"} {
|
||||||
|
set key L
|
||||||
|
} else {
|
||||||
|
set key C
|
||||||
|
}
|
||||||
$m_repo add command \
|
$m_repo add command \
|
||||||
-command [cb _next clone] \
|
-command [cb _next clone] \
|
||||||
-accelerator $M1T-C \
|
-accelerator $M1T-$key \
|
||||||
-label [mc "Clone..."]
|
-label [mc "Clone..."]
|
||||||
bind $top <$M1B-c> [cb _next clone]
|
bind $top <$M1B-[string tolower $key]> [cb _next clone]
|
||||||
bind $top <$M1B-C> [cb _next clone]
|
bind $top <$M1B-[string toupper $key]> [cb _next clone]
|
||||||
}
|
}
|
||||||
|
|
||||||
$opts tag conf link_open -foreground blue -underline 1
|
$opts tag conf link_open -foreground blue -underline 1
|
||||||
|
|
|
@ -55,7 +55,7 @@ proc handle_empty_diff {} {
|
||||||
|
|
||||||
set path $current_diff_path
|
set path $current_diff_path
|
||||||
set s $file_states($path)
|
set s $file_states($path)
|
||||||
if {[lindex $s 0] ne {_M}} return
|
if {[lindex $s 0] ne {_M} || [has_textconv $path]} return
|
||||||
|
|
||||||
# Prevent infinite rescan loops
|
# Prevent infinite rescan loops
|
||||||
incr diff_empty_count
|
incr diff_empty_count
|
||||||
|
@ -280,6 +280,9 @@ proc start_show_diff {cont_info {add_opts {}}} {
|
||||||
lappend cmd diff-files
|
lappend cmd diff-files
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if {![is_config_false gui.textconv] && [git-version >= 1.6.1]} {
|
||||||
|
lappend cmd --textconv
|
||||||
|
}
|
||||||
|
|
||||||
if {[string match {160000 *} [lindex $s 2]]
|
if {[string match {160000 *} [lindex $s 2]]
|
||||||
|| [string match {160000 *} [lindex $s 3]]} {
|
|| [string match {160000 *} [lindex $s 3]]} {
|
||||||
|
|
|
@ -148,6 +148,7 @@ proc do_options {} {
|
||||||
{b gui.trustmtime {mc "Trust File Modification Timestamps"}}
|
{b gui.trustmtime {mc "Trust File Modification Timestamps"}}
|
||||||
{b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
|
{b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
|
||||||
{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
|
{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
|
||||||
|
{b gui.textconv {mc "Use Textconv For Diffs and Blames"}}
|
||||||
{b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}}
|
{b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}}
|
||||||
{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
|
{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
|
||||||
{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}
|
{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}
|
||||||
|
|
|
@ -16,7 +16,7 @@ proc do_windows_shortcut {} {
|
||||||
[info nameofexecutable] \
|
[info nameofexecutable] \
|
||||||
[file normalize $::argv0] \
|
[file normalize $::argv0] \
|
||||||
] \
|
] \
|
||||||
[file normalize [$_gitworktree]]
|
[file normalize $_gitworktree]
|
||||||
} err]} {
|
} err]} {
|
||||||
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ proc do_cygwin_shortcut {} {
|
||||||
$sh -c \
|
$sh -c \
|
||||||
"CHERE_INVOKING=1 source /etc/profile;[sq $me] &" \
|
"CHERE_INVOKING=1 source /etc/profile;[sq $me] &" \
|
||||||
] \
|
] \
|
||||||
[file normalize [$_gitworktree]]
|
[file normalize $_gitworktree]
|
||||||
} err]} {
|
} err]} {
|
||||||
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ method _oneline_pack {} {
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor two_line {path} {
|
constructor two_line {path} {
|
||||||
|
global NS
|
||||||
set w $path
|
set w $path
|
||||||
set w_l $w.l
|
set w_l $w.l
|
||||||
set w_c $w.c
|
set w_c $w.c
|
||||||
|
|
|
@ -18,9 +18,9 @@ proc win32_create_lnk {lnk_path lnk_exec lnk_dir} {
|
||||||
eval [list exec wscript.exe \
|
eval [list exec wscript.exe \
|
||||||
/E:jscript \
|
/E:jscript \
|
||||||
/nologo \
|
/nologo \
|
||||||
[file join $oguilib win32_shortcut.js] \
|
[file nativename [file join $oguilib win32_shortcut.js]] \
|
||||||
$lnk_path \
|
$lnk_path \
|
||||||
[file join $oguilib git-gui.ico] \
|
[file nativename [file join $oguilib git-gui.ico]] \
|
||||||
$lnk_dir \
|
$lnk_dir \
|
||||||
$lnk_exec] $lnk_args
|
$lnk_exec] $lnk_args
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,11 @@ if { $argc >=2 && [lindex $argv 0] == "--working-dir" } {
|
||||||
incr argc -2
|
incr argc -2
|
||||||
}
|
}
|
||||||
|
|
||||||
set bindir [file dirname \
|
set basedir [file dirname \
|
||||||
[file dirname \
|
[file dirname \
|
||||||
[file dirname [info script]]]]
|
[file dirname [info script]]]]
|
||||||
set bindir [file join $bindir bin]
|
set bindir [file join $basedir bin]
|
||||||
|
set bindir "$bindir;[file join $basedir mingw bin]"
|
||||||
regsub -all ";" $bindir "\\;" bindir
|
regsub -all ";" $bindir "\\;" bindir
|
||||||
set env(PATH) "$bindir;$env(PATH)"
|
set env(PATH) "$bindir;$env(PATH)"
|
||||||
unset bindir
|
unset bindir
|
||||||
|
|
Loading…
Reference in a new issue