Skip to content

Commit 60c60b6

Browse files
committed
Merge branch 'py/git-git-extra-stuff'
Some changes were added directly to git.git's git-gui subtree, instead of being added to the separate git-gui repo and then being pulled back into git.git. This means those changes are now not in the git-gui tree. So pull them back into git-gui so we match with what git.git has (after they pull in the recently added commits). Most of the changes could be added back in via an octopus merge of all the missing branches. But there were two commits (faf420e and b71c6c3) which touched other parts of git.git along with git-gui, so they had to be added back in via a cherry-pick because directly pulling them in would also pull in all the ancestors of those commits, needlessly bloating git-gui with git.git's history. Thanks to Denton Liu <[email protected]> for providing me with a script to generate and merge all the branches that were missing, which made this task much easier. * py/git-git-extra-stuff: treewide: correct several "up-to-date" to "up to date" Fix build with core.autocrlf=true git-gui: call do_quit before destroying the main window git-gui: workaround ttk:style theme use git-gui: bind CTRL/CMD+numpad ENTER to do_commit git-gui: search for all current SSH key types git-gui: allow Ctrl+T to toggle multiple paths git-gui: fix exception when trying to stage with empty file list git-gui: avoid exception upon Ctrl+T in an empty list git gui: fix staging a second line to a 1-line file git-gui: prevent double UTF-8 conversion git-gui: sort entries in optimized tclIndex Replace Free Software Foundation address in license notices git-gui (MinGW): make use of MSys2's msgfmt
2 parents f7a8834 + faf420e commit 60c60b6

File tree

8 files changed

+74
-16
lines changed

8 files changed

+74
-16
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
* encoding=US-ASCII
33
git-gui.sh encoding=UTF-8
44
/po/*.po encoding=UTF-8
5+
/GIT-VERSION-GEN eol=lf

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ ifeq ($(uname_S),Darwin)
161161
endif
162162
endif
163163
ifneq (,$(findstring MINGW,$(uname_S)))
164+
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
164165
NO_MSGFMT=1
166+
endif
165167
GITGUI_WINDOWS_WRAPPER := YesPlease
166168
GITGUI_RELATIVE := 1
167169
endif
@@ -252,7 +254,7 @@ $(ALL_MSGFILES): %.msg : %.po
252254
lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
253255
$(QUIET_INDEX)if echo \
254256
$(foreach p,$(PRELOAD_FILES),source $p\;) \
255-
auto_mkindex lib '*.tcl' \
257+
auto_mkindex lib $(patsubst lib/%,%,$(sort $(ALL_LIBFILES))) \
256258
| $(TCL_PATH) $(QUIET_2DEVNULL); then : ok; \
257259
else \
258260
echo >&2 " * $(TCL_PATH) failed; using unoptimized loading"; \

git-gui.sh

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2424
GNU General Public License for more details.
2525

2626
You should have received a copy of the GNU General Public License
27-
along with this program; if not, write to the Free Software
28-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}]
27+
along with this program; if not, see <http://www.gnu.org/licenses/>.}]
2928

3029
######################################################################
3130
##
@@ -2504,9 +2503,28 @@ proc toggle_or_diff {mode w args} {
25042503
set pos [split [$w index @$x,$y] .]
25052504
foreach {lno col} $pos break
25062505
} else {
2506+
if {$mode eq "toggle"} {
2507+
if {$w eq $ui_workdir} {
2508+
do_add_selection
2509+
set last_clicked {}
2510+
return
2511+
}
2512+
if {$w eq $ui_index} {
2513+
do_unstage_selection
2514+
set last_clicked {}
2515+
return
2516+
}
2517+
}
2518+
25072519
if {$last_clicked ne {}} {
25082520
set lno [lindex $last_clicked 1]
25092521
} else {
2522+
if {![info exists file_lists]
2523+
|| ![info exists file_lists($w)]
2524+
|| [llength $file_lists($w)] == 0} {
2525+
set last_clicked {}
2526+
return
2527+
}
25102528
set lno [expr {int([lindex [$w tag ranges in_diff] 0])}]
25112529
}
25122530
if {$mode eq "toggle"} {
@@ -2517,7 +2535,13 @@ proc toggle_or_diff {mode w args} {
25172535
}
25182536
}
25192537
2520-
set path [lindex $file_lists($w) [expr {$lno - 1}]]
2538+
if {![info exists file_lists]
2539+
|| ![info exists file_lists($w)]
2540+
|| [llength $file_lists($w)] < $lno - 1} {
2541+
set path {}
2542+
} else {
2543+
set path [lindex $file_lists($w) [expr {$lno - 1}]]
2544+
}
25212545
if {$path eq {}} {
25222546
set last_clicked {}
25232547
return
@@ -3028,8 +3052,23 @@ unset doc_path doc_url
30283052
wm protocol . WM_DELETE_WINDOW do_quit
30293053
bind all <$M1B-Key-q> do_quit
30303054
bind all <$M1B-Key-Q> do_quit
3031-
bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}
3032-
bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
3055+
3056+
set m1b_w_script {
3057+
set toplvl_win [winfo toplevel %W]
3058+
3059+
# If we are destroying the main window, we should call do_quit to take
3060+
# care of cleanup before exiting the program.
3061+
if {$toplvl_win eq "."} {
3062+
do_quit
3063+
} else {
3064+
destroy $toplvl_win
3065+
}
3066+
}
3067+
3068+
bind all <$M1B-Key-w> $m1b_w_script
3069+
bind all <$M1B-Key-W> $m1b_w_script
3070+
3071+
unset m1b_w_script
30333072
30343073
set subcommand_args {}
30353074
proc usage {} {
@@ -3913,6 +3952,7 @@ bind . <$M1B-Key-equal> {show_more_context;break}
39133952
bind . <$M1B-Key-plus> {show_more_context;break}
39143953
bind . <$M1B-Key-KP_Add> {show_more_context;break}
39153954
bind . <$M1B-Key-Return> do_commit
3955+
bind . <$M1B-Key-KP_Enter> do_commit
39163956
foreach i [list $ui_index $ui_workdir] {
39173957
bind $i <Button-1> { toggle_or_diff click %W %x %y; break }
39183958
bind $i <$M1B-Button-1> { add_one_to_selection %W %x %y; break }

lib/commit.tcl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ You are currently in the middle of a merge that has not been fully completed. Y
2525
set msg {}
2626
set parents [list]
2727
if {[catch {
28+
set name ""
29+
set email ""
2830
set fd [git_read cat-file commit $curHEAD]
2931
fconfigure $fd -encoding binary -translation lf
3032
# By default commits are assumed to be in utf-8
@@ -34,17 +36,21 @@ You are currently in the middle of a merge that has not been fully completed. Y
3436
lappend parents [string range $line 7 end]
3537
} elseif {[string match {encoding *} $line]} {
3638
set enc [string tolower [string range $line 9 end]]
37-
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} {
38-
set commit_author [list name $name email $email date $time]
39-
}
39+
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} { }
4040
}
4141
set msg [read $fd]
4242
close $fd
4343

4444
set enc [tcl_encoding $enc]
4545
if {$enc ne {}} {
4646
set msg [encoding convertfrom $enc $msg]
47+
set name [encoding convertfrom $enc $name]
48+
set email [encoding convertfrom $enc $email]
4749
}
50+
if {$name ne {} && $email ne {}} {
51+
set commit_author [list name $name email $email date $time]
52+
}
53+
4854
set msg [string trim $msg]
4955
} err]} {
5056
error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"]

lib/diff.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ proc apply_or_revert_range_or_line {x y revert} {
724724
set hh [$ui_diff get $i_l "$i_l + 1 lines"]
725725
set hh [lindex [split $hh ,] 0]
726726
set hln [lindex [split $hh -] 1]
727+
set hln [lindex [split $hln " "] 0]
727728

728729
# There is a special situation to take care of. Consider this
729730
# hunk:

lib/sshkey.tcl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
# Copyright (C) 2006, 2007 Shawn Pearce
33

44
proc find_ssh_key {} {
5-
foreach name {~/.ssh/id_dsa.pub ~/.ssh/id_rsa.pub ~/.ssh/identity.pub} {
5+
foreach name {
6+
~/.ssh/id_dsa.pub ~/.ssh/id_ecdsa.pub ~/.ssh/id_ed25519.pub
7+
~/.ssh/id_rsa.pub ~/.ssh/identity.pub
8+
} {
69
if {[file exists $name]} {
710
set fh [open $name r]
811
set cont [read $fh]

lib/themed.tcl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Functions for supporting the use of themed Tk widgets in git-gui.
22
# Copyright (C) 2009 Pat Thoyts <[email protected]>
33

4+
proc ttk_get_current_theme {} {
5+
# Handle either current Tk or older versions of 8.5
6+
if {[catch {set theme [ttk::style theme use]}]} {
7+
set theme $::ttk::currentTheme
8+
}
9+
return $theme
10+
}
11+
412
proc InitTheme {} {
513
# Create a color label style (bg can be overridden by widget option)
614
ttk::style layout Color.TLabel {
@@ -28,10 +36,7 @@ proc InitTheme {} {
2836
}
2937
}
3038

31-
# Handle either current Tk or older versions of 8.5
32-
if {[catch {set theme [ttk::style theme use]}]} {
33-
set theme $::ttk::currentTheme
34-
}
39+
set theme [ttk_get_current_theme]
3540

3641
if {[lsearch -exact {default alt classic clam} $theme] != -1} {
3742
# Simple override of standard ttk::entry to change the field
@@ -248,7 +253,7 @@ proc tspinbox {w args} {
248253
proc ttext {w args} {
249254
global use_ttk
250255
if {$use_ttk} {
251-
switch -- [ttk::style theme use] {
256+
switch -- [ttk_get_current_theme] {
252257
"vista" - "xpnative" {
253258
lappend args -highlightthickness 0 -borderwidth 0
254259
}

po/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ to contribute an update. This may be because you would want to improve
165165
the translation of existing messages, or because the git-gui software
166166
itself was updated and there are new messages that need translation.
167167

168-
In any case, make sure you are up-to-date before starting your work:
168+
In any case, make sure you are up to date before starting your work:
169169

170170
$ git checkout master
171171
$ git pull

0 commit comments

Comments
 (0)