Merge branches 'js/msgfmt-on-windows', 'tz/fsf-address-update', 'jn/reproducible-build', 'ls/no-double-utf8-author-name', 'js/misc-git-gui-stuff', 'bb/ssh-key-files', 'bp/bind-kp-enter', 'cb/ttk-style' and 'py/call-do-quit-before-exit' of ../git into py/git-git-extra-stuff

This commit is contained in:
Pratyush Yadav 2019-09-19 23:22:03 +05:30
6 changed files with 72 additions and 15 deletions

View File

@ -161,7 +161,9 @@ ifeq ($(uname_S),Darwin)
endif
endif
ifneq (,$(findstring MINGW,$(uname_S)))
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
NO_MSGFMT=1
endif
GITGUI_WINDOWS_WRAPPER := YesPlease
GITGUI_RELATIVE := 1
endif
@ -252,7 +254,7 @@ $(ALL_MSGFILES): %.msg : %.po
lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
$(QUIET_INDEX)if echo \
$(foreach p,$(PRELOAD_FILES),source $p\;) \
auto_mkindex lib '*.tcl' \
auto_mkindex lib $(patsubst lib/%,%,$(sort $(ALL_LIBFILES))) \
| $(TCL_PATH) $(QUIET_2DEVNULL); then : ok; \
else \
echo >&2 " * $(TCL_PATH) failed; using unoptimized loading"; \

View File

@ -24,8 +24,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}]
along with this program; if not, see <http://www.gnu.org/licenses/>.}]
######################################################################
##
@ -2504,9 +2503,28 @@ proc toggle_or_diff {mode w args} {
set pos [split [$w index @$x,$y] .]
foreach {lno col} $pos break
} else {
if {$mode eq "toggle"} {
if {$w eq $ui_workdir} {
do_add_selection
set last_clicked {}
return
}
if {$w eq $ui_index} {
do_unstage_selection
set last_clicked {}
return
}
}
if {$last_clicked ne {}} {
set lno [lindex $last_clicked 1]
} else {
if {![info exists file_lists]
|| ![info exists file_lists($w)]
|| [llength $file_lists($w)] == 0} {
set last_clicked {}
return
}
set lno [expr {int([lindex [$w tag ranges in_diff] 0])}]
}
if {$mode eq "toggle"} {
@ -2517,7 +2535,13 @@ proc toggle_or_diff {mode w args} {
}
}
set path [lindex $file_lists($w) [expr {$lno - 1}]]
if {![info exists file_lists]
|| ![info exists file_lists($w)]
|| [llength $file_lists($w)] < $lno - 1} {
set path {}
} else {
set path [lindex $file_lists($w) [expr {$lno - 1}]]
}
if {$path eq {}} {
set last_clicked {}
return
@ -3028,8 +3052,23 @@ unset doc_path doc_url
wm protocol . WM_DELETE_WINDOW do_quit
bind all <$M1B-Key-q> do_quit
bind all <$M1B-Key-Q> do_quit
bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}
bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
set m1b_w_script {
set toplvl_win [winfo toplevel %W]
# If we are destroying the main window, we should call do_quit to take
# care of cleanup before exiting the program.
if {$toplvl_win eq "."} {
do_quit
} else {
destroy $toplvl_win
}
}
bind all <$M1B-Key-w> $m1b_w_script
bind all <$M1B-Key-W> $m1b_w_script
unset m1b_w_script
set subcommand_args {}
proc usage {} {
@ -3913,6 +3952,7 @@ bind . <$M1B-Key-equal> {show_more_context;break}
bind . <$M1B-Key-plus> {show_more_context;break}
bind . <$M1B-Key-KP_Add> {show_more_context;break}
bind . <$M1B-Key-Return> do_commit
bind . <$M1B-Key-KP_Enter> do_commit
foreach i [list $ui_index $ui_workdir] {
bind $i <Button-1> { toggle_or_diff click %W %x %y; break }
bind $i <$M1B-Button-1> { add_one_to_selection %W %x %y; break }

View File

@ -25,6 +25,8 @@ You are currently in the middle of a merge that has not been fully completed. Y
set msg {}
set parents [list]
if {[catch {
set name ""
set email ""
set fd [git_read cat-file commit $curHEAD]
fconfigure $fd -encoding binary -translation lf
# By default commits are assumed to be in utf-8
@ -34,9 +36,7 @@ You are currently in the middle of a merge that has not been fully completed. Y
lappend parents [string range $line 7 end]
} elseif {[string match {encoding *} $line]} {
set enc [string tolower [string range $line 9 end]]
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} {
set commit_author [list name $name email $email date $time]
}
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} { }
}
set msg [read $fd]
close $fd
@ -44,7 +44,13 @@ You are currently in the middle of a merge that has not been fully completed. Y
set enc [tcl_encoding $enc]
if {$enc ne {}} {
set msg [encoding convertfrom $enc $msg]
set name [encoding convertfrom $enc $name]
set email [encoding convertfrom $enc $email]
}
if {$name ne {} && $email ne {}} {
set commit_author [list name $name email $email date $time]
}
set msg [string trim $msg]
} err]} {
error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"]

View File

@ -724,6 +724,7 @@ proc apply_or_revert_range_or_line {x y revert} {
set hh [$ui_diff get $i_l "$i_l + 1 lines"]
set hh [lindex [split $hh ,] 0]
set hln [lindex [split $hh -] 1]
set hln [lindex [split $hln " "] 0]
# There is a special situation to take care of. Consider this
# hunk:

View File

@ -2,7 +2,10 @@
# Copyright (C) 2006, 2007 Shawn Pearce
proc find_ssh_key {} {
foreach name {~/.ssh/id_dsa.pub ~/.ssh/id_rsa.pub ~/.ssh/identity.pub} {
foreach name {
~/.ssh/id_dsa.pub ~/.ssh/id_ecdsa.pub ~/.ssh/id_ed25519.pub
~/.ssh/id_rsa.pub ~/.ssh/identity.pub
} {
if {[file exists $name]} {
set fh [open $name r]
set cont [read $fh]

View File

@ -1,6 +1,14 @@
# Functions for supporting the use of themed Tk widgets in git-gui.
# Copyright (C) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
proc ttk_get_current_theme {} {
# Handle either current Tk or older versions of 8.5
if {[catch {set theme [ttk::style theme use]}]} {
set theme $::ttk::currentTheme
}
return $theme
}
proc InitTheme {} {
# Create a color label style (bg can be overridden by widget option)
ttk::style layout Color.TLabel {
@ -28,10 +36,7 @@ proc InitTheme {} {
}
}
# Handle either current Tk or older versions of 8.5
if {[catch {set theme [ttk::style theme use]}]} {
set theme $::ttk::currentTheme
}
set theme [ttk_get_current_theme]
if {[lsearch -exact {default alt classic clam} $theme] != -1} {
# Simple override of standard ttk::entry to change the field
@ -248,7 +253,7 @@ proc tspinbox {w args} {
proc ttext {w args} {
global use_ttk
if {$use_ttk} {
switch -- [ttk::style theme use] {
switch -- [ttk_get_current_theme] {
"vista" - "xpnative" {
lappend args -highlightthickness 0 -borderwidth 0
}