Skip to content

Commit 1eb0545

Browse files
committed
Merge tag 'gitgui-0.20.0' of http://repo.or.cz/r/git-gui
git-gui 0.20.0 * tag 'gitgui-0.20.0' of http://repo.or.cz/r/git-gui: git-gui: set version 0.20 git-gui: sv.po: Update Swedish translation (547t0f0u) git-gui i18n: Updated Bulgarian translation (547t,0f,0u) git-gui: Makes chooser set 'gitdir' to the resolved path git-gui: Fixes chooser not accepting gitfiles git-gui: reinstate support for Tcl 8.4 git-gui: fix problem with gui.maxfilesdisplayed git-gui: fix verbose loading when git path contains spaces. git-gui/gitk: Do not depend on Cygwin's "kill" command on Windows git-gui: add configurable tab size to the diff view git-gui: Make git-gui lib dir configurable at runime git-gui i18n: Updated Bulgarian translation (520t,0f,0u) L10n: vi.po (543t): Init translation for Vietnamese git-gui: align the new recursive checkbox with the radiobuttons. git-gui: Add a 'recursive' checkbox in the clone menu.
2 parents 3d6bc9a + 4498b3a commit 1eb0545

File tree

10 files changed

+4888
-1971
lines changed

10 files changed

+4888
-1971
lines changed

git-gui/GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=0.19.GITGUI
4+
DEF_VER=0.20.GITGUI
55

66
LF='
77
'

git-gui/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
177177
echo then >>$@+ && \
178178
echo ' 'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
179179
echo else >>$@+ && \
180-
echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
180+
echo ' libdir="$${GIT_GUI_LIB_DIR:-$(libdir_SQ)}"' >>$@+ && \
181+
echo ' 'exec \"'$$libdir/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\" \
181182
'"$$0" "$$@"' >>$@+ && \
182183
echo fi >>$@+ && \
183184
chmod +x $@+ && \

git-gui/git-gui.sh

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ catch {rename send {}} ; # What an evil concept...
4949
##
5050
## locate our library
5151

52-
set oguilib {@@GITGUI_LIBDIR@@}
52+
if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
53+
set oguilib $::env(GIT_GUI_LIB_DIR)
54+
} else {
55+
set oguilib {@@GITGUI_LIBDIR@@}
56+
}
5357
set oguirel {@@GITGUI_RELATIVE@@}
5458
if {$oguirel eq {1}} {
5559
set oguilib [file dirname [file normalize $argv0]]
@@ -79,9 +83,9 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
7983
return [uplevel 1 real__auto_load $name $args]
8084
}
8185
rename source real__source
82-
proc source {name} {
83-
puts stderr "source $name"
84-
uplevel 1 real__source $name
86+
proc source {args} {
87+
puts stderr "source $args"
88+
uplevel 1 [linsert $args 0 real__source]
8589
}
8690
if {[tk windowingsystem] eq "win32"} { console show }
8791
}
@@ -666,9 +670,7 @@ proc kill_file_process {fd} {
666670
667671
catch {
668672
if {[is_Windows]} {
669-
# Use a Cygwin-specific flag to allow killing
670-
# native Windows processes
671-
exec kill -f $process
673+
exec taskkill /pid $process
672674
} else {
673675
exec kill $process
674676
}
@@ -908,6 +910,7 @@ set default_config(gui.fontdiff) [font configure font_diff]
908910
set default_config(gui.maxfilesdisplayed) 5000
909911
set default_config(gui.usettk) 1
910912
set default_config(gui.warndetachedcommit) 1
913+
set default_config(gui.tabsize) 8
911914
set font_descs {
912915
{fontui font_ui {mc "Main Font"}}
913916
{fontdiff font_diff {mc "Diff/Console Font"}}
@@ -1283,7 +1286,7 @@ load_config 0
12831286
apply_config
12841287
12851288
# v1.7.0 introduced --show-toplevel to return the canonical work-tree
1286-
if {[package vsatisfies $_git_version 1.7.0-]} {
1289+
if {[package vcompare $_git_version 1.7.0] >= 0} {
12871290
if { [is_Cygwin] } {
12881291
catch {set _gitworktree [exec cygpath --windows [git rev-parse --show-toplevel]]}
12891292
} else {
@@ -1539,7 +1542,7 @@ proc rescan_stage2 {fd after} {
15391542
close $fd
15401543
}
15411544
1542-
if {[package vsatisfies $::_git_version 1.6.3-]} {
1545+
if {[package vcompare $::_git_version 1.6.3] >= 0} {
15431546
set ls_others [list --exclude-standard]
15441547
} else {
15451548
set ls_others [list --exclude-per-directory=.gitignore]
@@ -1962,20 +1965,22 @@ proc display_all_files {} {
19621965
19631966
set to_display [lsort [array names file_states]]
19641967
set display_limit [get_config gui.maxfilesdisplayed]
1965-
if {[llength $to_display] > $display_limit} {
1966-
if {!$files_warning} {
1967-
# do not repeatedly warn:
1968-
set files_warning 1
1969-
info_popup [mc "Displaying only %s of %s files." \
1970-
$display_limit [llength $to_display]]
1971-
}
1972-
set to_display [lrange $to_display 0 [expr {$display_limit-1}]]
1973-
}
1968+
set displayed 0
19741969
foreach path $to_display {
19751970
set s $file_states($path)
19761971
set m [lindex $s 0]
19771972
set icon_name [lindex $s 1]
19781973
1974+
if {$displayed > $display_limit && [string index $m 1] eq {O} } {
1975+
if {!$files_warning} {
1976+
# do not repeatedly warn:
1977+
set files_warning 1
1978+
info_popup [mc "Display limit (gui.maxfilesdisplayed = %s) reached, not showing all %s files." \
1979+
$display_limit [llength $to_display]]
1980+
}
1981+
continue
1982+
}
1983+
19791984
set s [string index $m 0]
19801985
if {$s ne {U} && $s ne {_}} {
19811986
display_all_files_helper $ui_index $path \
@@ -1990,6 +1995,7 @@ proc display_all_files {} {
19901995
if {$s ne {_}} {
19911996
display_all_files_helper $ui_workdir $path \
19921997
$icon_name $s
1998+
incr displayed
19931999
}
19942000
}
19952001

git-gui/lib/choose_repository.tcl

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ field local_path {} ; # Where this repository is locally
1818
field origin_url {} ; # Where we are cloning from
1919
field origin_name origin ; # What we shall call 'origin'
2020
field clone_type hardlink ; # Type of clone to construct
21+
field recursive true ; # Recursive cloning flag
2122
field readtree_err ; # Error output from read-tree (if any)
2223
field sorted_recent ; # recent repositories (sorted)
2324

@@ -337,16 +338,31 @@ method _git_init {} {
337338
return 1
338339
}
339340

340-
proc _is_git {path} {
341+
proc _is_git {path {outdir_var ""}} {
342+
if {$outdir_var ne ""} {
343+
upvar 1 $outdir_var outdir
344+
}
345+
if {[file isfile $path]} {
346+
set fp [open $path r]
347+
gets $fp line
348+
close $fp
349+
if {[regexp "^gitdir: (.+)$" $line line link_target]} {
350+
set path [file join [file dirname $path] $link_target]
351+
set path [file normalize $path]
352+
}
353+
}
354+
341355
if {[file exists [file join $path HEAD]]
342356
&& [file exists [file join $path objects]]
343357
&& [file exists [file join $path config]]} {
358+
set outdir $path
344359
return 1
345360
}
346361
if {[is_Cygwin]} {
347362
if {[file exists [file join $path HEAD]]
348363
&& [file exists [file join $path objects.lnk]]
349364
&& [file exists [file join $path config.lnk]]} {
365+
set outdir $path
350366
return 1
351367
}
352368
}
@@ -525,6 +541,11 @@ method _do_clone {} {
525541
foreach r $w_types {
526542
pack $r -anchor w
527543
}
544+
${NS}::checkbutton $args.type_f.recursive \
545+
-text [mc "Recursively clone submodules too"] \
546+
-variable @recursive \
547+
-onvalue true -offvalue false
548+
pack $args.type_f.recursive -anchor w
528549
grid $args.type_l $args.type_f -sticky new
529550

530551
grid columnconfigure $args 1 -weight 1
@@ -952,6 +973,30 @@ method _do_clone_checkout {HEAD} {
952973
fileevent $fd readable [cb _readtree_wait $fd]
953974
}
954975

976+
method _do_validate_submodule_cloning {ok} {
977+
if {$ok} {
978+
$o_cons done $ok
979+
set done 1
980+
} else {
981+
_clone_failed $this [mc "Cannot clone submodules."]
982+
}
983+
}
984+
985+
method _do_clone_submodules {} {
986+
if {$recursive eq {true}} {
987+
destroy $w_body
988+
set o_cons [console::embed \
989+
$w_body \
990+
[mc "Cloning submodules"]]
991+
pack $w_body -fill both -expand 1 -padx 10
992+
$o_cons exec \
993+
[list git submodule update --init --recursive] \
994+
[cb _do_validate_submodule_cloning]
995+
} else {
996+
set done 1
997+
}
998+
}
999+
9551000
method _readtree_wait {fd} {
9561001
set buf [read $fd]
9571002
$o_cons update_meter $buf
@@ -982,7 +1027,7 @@ method _readtree_wait {fd} {
9821027
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
9831028
fileevent $fd_ph readable [cb _postcheckout_wait $fd_ph]
9841029
} else {
985-
set done 1
1030+
_do_clone_submodules $this
9861031
}
9871032
}
9881033

@@ -996,7 +1041,7 @@ method _postcheckout_wait {fd_ph} {
9961041
hook_failed_popup post-checkout $pch_error 0
9971042
}
9981043
unset pch_error
999-
set done 1
1044+
_do_clone_submodules $this
10001045
return
10011046
}
10021047
fconfigure $fd_ph -blocking 0
@@ -1063,7 +1108,7 @@ method _open_local_path {} {
10631108
}
10641109

10651110
method _do_open2 {} {
1066-
if {![_is_git [file join $local_path .git]]} {
1111+
if {![_is_git [file join $local_path .git] actualgit]} {
10671112
error_popup [mc "Not a Git repository: %s" [file tail $local_path]]
10681113
return
10691114
}
@@ -1076,7 +1121,7 @@ method _do_open2 {} {
10761121
}
10771122

10781123
_append_recentrepos [pwd]
1079-
set ::_gitdir .git
1124+
set ::_gitdir $actualgit
10801125
set ::_prefix {}
10811126
set done 1
10821127
}

git-gui/lib/diff.tcl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# git-gui diff viewer
22
# Copyright (C) 2006, 2007 Shawn Pearce
33

4+
proc apply_tab_size {{firsttab {}}} {
5+
global have_tk85 repo_config ui_diff
6+
7+
set w [font measure font_diff "0"]
8+
if {$have_tk85 && $firsttab != 0} {
9+
$ui_diff configure -tabs [list [expr {$firsttab * $w}] [expr {($firsttab + $repo_config(gui.tabsize)) * $w}]]
10+
} elseif {$have_tk85 || $repo_config(gui.tabsize) != 8} {
11+
$ui_diff configure -tabs [expr {$repo_config(gui.tabsize) * $w}]
12+
} else {
13+
$ui_diff configure -tabs {}
14+
}
15+
}
16+
417
proc clear_diff {} {
518
global ui_diff current_diff_path current_diff_header
619
global ui_index ui_workdir
@@ -105,6 +118,8 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {
105118

106119
set cont_info [list $scroll_pos $callback]
107120

121+
apply_tab_size 0
122+
108123
if {[string first {U} $m] >= 0} {
109124
merge_load_stages $path [list show_unmerged_diff $cont_info]
110125
} elseif {$m eq {_O}} {
@@ -401,7 +416,10 @@ proc read_diff {fd conflict_size cont_info} {
401416

402417
# -- Automatically detect if this is a 3 way diff.
403418
#
404-
if {[string match {@@@ *} $line]} {set is_3way_diff 1}
419+
if {[string match {@@@ *} $line]} {
420+
set is_3way_diff 1
421+
apply_tab_size 1
422+
}
405423

406424
if {$::current_diff_inheader} {
407425

git-gui/lib/option.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ proc do_options {} {
161161
{b gui.warndetachedcommit {mc "Warn before committing to a detached head"}}
162162
{s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}}
163163
{b gui.displayuntracked {mc "Show untracked files"}}
164+
{i-1..99 gui.tabsize {mc "Tab spacing"}}
164165
} {
165166
set type [lindex $option 0]
166167
set name [lindex $option 1]

git-gui/macosx/AppMain.tcl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
set gitexecdir {@@gitexecdir@@}
2-
set gitguilib {@@GITGUI_LIBDIR@@}
2+
if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
3+
set gitguilib $::env(GIT_GUI_LIB_DIR)
4+
} else {
5+
set gitguilib {@@GITGUI_LIBDIR@@}
6+
}
7+
38
set env(PATH) "$gitexecdir:$env(PATH)"
49

510
if {[string first -psn [lindex $argv 0]] == 0} {

0 commit comments

Comments
 (0)