diff options
Diffstat (limited to 'git-gui/git-gui.sh')
-rwxr-xr-x | git-gui/git-gui.sh | 109 |
1 files changed, 78 insertions, 31 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index 153f85da06..11048c7a0e 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -49,7 +49,11 @@ catch {rename send {}} ; # What an evil concept... ## ## locate our library -set oguilib {@@GITGUI_LIBDIR@@} +if { [info exists ::env(GIT_GUI_LIB_DIR) ] } { + set oguilib $::env(GIT_GUI_LIB_DIR) +} else { + set oguilib {@@GITGUI_LIBDIR@@} +} set oguirel {@@GITGUI_RELATIVE@@} if {$oguirel eq {1}} { set oguilib [file dirname [file normalize $argv0]] @@ -79,9 +83,9 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} { return [uplevel 1 real__auto_load $name $args] } rename source real__source - proc source {name} { - puts stderr "source $name" - uplevel 1 real__source $name + proc source {args} { + puts stderr "source $args" + uplevel 1 [linsert $args 0 real__source] } if {[tk windowingsystem] eq "win32"} { console show } } @@ -666,9 +670,7 @@ proc kill_file_process {fd} { catch { if {[is_Windows]} { - # Use a Cygwin-specific flag to allow killing - # native Windows processes - exec kill -f $process + exec taskkill /pid $process } else { exec kill $process } @@ -894,6 +896,7 @@ set default_config(gui.textconv) true set default_config(gui.pruneduringfetch) false set default_config(gui.trustmtime) false set default_config(gui.fastcopyblame) false +set default_config(gui.maxrecentrepo) 10 set default_config(gui.copyblamethreshold) 40 set default_config(gui.blamehistoryctx) 7 set default_config(gui.diffcontext) 5 @@ -907,11 +910,13 @@ set default_config(gui.fontdiff) [font configure font_diff] set default_config(gui.maxfilesdisplayed) 5000 set default_config(gui.usettk) 1 set default_config(gui.warndetachedcommit) 1 +set default_config(gui.tabsize) 8 set font_descs { {fontui font_ui {mc "Main Font"}} {fontdiff font_diff {mc "Diff/Console Font"}} } set default_config(gui.stageuntracked) ask +set default_config(gui.displayuntracked) true ###################################################################### ## @@ -1281,8 +1286,12 @@ load_config 0 apply_config # v1.7.0 introduced --show-toplevel to return the canonical work-tree -if {[package vsatisfies $_git_version 1.7.0]} { - set _gitworktree [git rev-parse --show-toplevel] +if {[package vcompare $_git_version 1.7.0] >= 0} { + if { [is_Cygwin] } { + catch {set _gitworktree [exec cygpath --windows [git rev-parse --show-toplevel]]} + } else { + set _gitworktree [git rev-parse --show-toplevel] + } } else { # try to set work tree from environment, core.worktree or use # cdup to obtain a relative path to the top of the worktree. If @@ -1533,7 +1542,7 @@ proc rescan_stage2 {fd after} { close $fd } - if {[package vsatisfies $::_git_version 1.6.3]} { + if {[package vcompare $::_git_version 1.6.3] >= 0} { set ls_others [list --exclude-standard] } else { set ls_others [list --exclude-per-directory=.gitignore] @@ -1550,18 +1559,27 @@ proc rescan_stage2 {fd after} { set buf_rdf {} set buf_rlo {} - set rescan_active 3 + set rescan_active 2 ui_status [mc "Scanning for modified files ..."] - set fd_di [git_read diff-index --cached -z [PARENT]] + if {[git-version >= "1.7.2"]} { + set fd_di [git_read diff-index --cached --ignore-submodules=dirty -z [PARENT]] + } else { + set fd_di [git_read diff-index --cached -z [PARENT]] + } set fd_df [git_read diff-files -z] - set fd_lo [eval git_read ls-files --others -z $ls_others] fconfigure $fd_di -blocking 0 -translation binary -encoding binary fconfigure $fd_df -blocking 0 -translation binary -encoding binary - fconfigure $fd_lo -blocking 0 -translation binary -encoding binary + fileevent $fd_di readable [list read_diff_index $fd_di $after] fileevent $fd_df readable [list read_diff_files $fd_df $after] - fileevent $fd_lo readable [list read_ls_others $fd_lo $after] + + if {[is_config_true gui.displayuntracked]} { + set fd_lo [eval git_read ls-files --others -z $ls_others] + fconfigure $fd_lo -blocking 0 -translation binary -encoding binary + fileevent $fd_lo readable [list read_ls_others $fd_lo $after] + incr rescan_active + } } proc load_message {file {encoding {}}} { @@ -1947,20 +1965,22 @@ proc display_all_files {} { set to_display [lsort [array names file_states]] set display_limit [get_config gui.maxfilesdisplayed] - if {[llength $to_display] > $display_limit} { - if {!$files_warning} { - # do not repeatedly warn: - set files_warning 1 - info_popup [mc "Displaying only %s of %s files." \ - $display_limit [llength $to_display]] - } - set to_display [lrange $to_display 0 [expr {$display_limit-1}]] - } + set displayed 0 foreach path $to_display { set s $file_states($path) set m [lindex $s 0] set icon_name [lindex $s 1] + if {$displayed > $display_limit && [string index $m 1] eq {O} } { + if {!$files_warning} { + # do not repeatedly warn: + set files_warning 1 + info_popup [mc "Display limit (gui.maxfilesdisplayed = %s) reached, not showing all %s files." \ + $display_limit [llength $to_display]] + } + continue + } + set s [string index $m 0] if {$s ne {U} && $s ne {_}} { display_all_files_helper $ui_index $path \ @@ -1975,6 +1995,7 @@ proc display_all_files {} { if {$s ne {_}} { display_all_files_helper $ui_workdir $path \ $icon_name $s + incr displayed } } @@ -2654,6 +2675,16 @@ if {![is_bare]} { .mbar.repository add command \ -label [mc "Explore Working Copy"] \ -command {do_explore} +} + +if {[is_Windows]} { + .mbar.repository add command \ + -label [mc "Git Bash"] \ + -command {eval exec [auto_execok start] \ + [list "Git Bash" bash --login -l &]} +} + +if {[is_Windows] || ![is_bare]} { .mbar.repository add separator } @@ -3203,13 +3234,29 @@ unset i # -- Diff and Commit Area # -${NS}::frame .vpane.lower -height 300 -width 400 -${NS}::frame .vpane.lower.commarea -${NS}::frame .vpane.lower.diff -relief sunken -borderwidth 1 -pack .vpane.lower.diff -fill both -expand 1 -pack .vpane.lower.commarea -side bottom -fill x -.vpane add .vpane.lower -if {!$use_ttk} {.vpane paneconfigure .vpane.lower -sticky nsew} +if {$have_tk85} { + ${NS}::panedwindow .vpane.lower -orient vertical + ${NS}::frame .vpane.lower.commarea + ${NS}::frame .vpane.lower.diff -relief sunken -borderwidth 1 -height 500 + .vpane.lower add .vpane.lower.diff + .vpane.lower add .vpane.lower.commarea + .vpane add .vpane.lower + if {$use_ttk} { + .vpane.lower pane .vpane.lower.diff -weight 1 + .vpane.lower pane .vpane.lower.commarea -weight 0 + } else { + .vpane.lower paneconfigure .vpane.lower.diff -stretch always + .vpane.lower paneconfigure .vpane.lower.commarea -stretch never + } +} else { + frame .vpane.lower -height 300 -width 400 + frame .vpane.lower.commarea + frame .vpane.lower.diff -relief sunken -borderwidth 1 + pack .vpane.lower.diff -fill both -expand 1 + pack .vpane.lower.commarea -side bottom -fill x + .vpane add .vpane.lower + .vpane paneconfigure .vpane.lower -sticky nsew +} # -- Commit Area Buttons # |