diff options
author | Pratyush Yadav <me@yadavpratyush.com> | 2019-09-24 19:50:33 +0530 |
---|---|---|
committer | Pratyush Yadav <me@yadavpratyush.com> | 2019-09-24 20:00:36 +0530 |
commit | 60c60b627e81bf84e1cb01729d2ae882178f079d (patch) | |
tree | 3c5ac2f526f0b10cd0ccf4d11e644390849520b8 | |
parent | Merge branch 'bp/amend-toggle-bind' (diff) | |
parent | treewide: correct several "up-to-date" to "up to date" (diff) | |
download | tgif-60c60b627e81bf84e1cb01729d2ae882178f079d.tar.xz |
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 (faf420e05a and
b71c6c3b64) 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 <liu.denton@gmail.com> 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
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | git-gui.sh | 50 | ||||
-rw-r--r-- | lib/commit.tcl | 12 | ||||
-rw-r--r-- | lib/diff.tcl | 1 | ||||
-rw-r--r-- | lib/sshkey.tcl | 5 | ||||
-rw-r--r-- | lib/themed.tcl | 15 | ||||
-rw-r--r-- | po/README | 2 |
8 files changed, 74 insertions, 16 deletions
diff --git a/.gitattributes b/.gitattributes index 33d07c06bd..59cd41dbff 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ * encoding=US-ASCII git-gui.sh encoding=UTF-8 /po/*.po encoding=UTF-8 +/GIT-VERSION-GEN eol=lf @@ -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"; \ diff --git a/git-gui.sh b/git-gui.sh index c75b3e90bc..fd476b6999 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -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 } diff --git a/lib/commit.tcl b/lib/commit.tcl index 384f18f226..b516aa2990 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -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"] diff --git a/lib/diff.tcl b/lib/diff.tcl index 96288fcc33..958a0fa219 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -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: diff --git a/lib/sshkey.tcl b/lib/sshkey.tcl index aa6457bbb5..589ff8f78a 100644 --- a/lib/sshkey.tcl +++ b/lib/sshkey.tcl @@ -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] diff --git a/lib/themed.tcl b/lib/themed.tcl index 351a712c8c..88b3119a75 100644 --- a/lib/themed.tcl +++ b/lib/themed.tcl @@ -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 } @@ -165,7 +165,7 @@ to contribute an update. This may be because you would want to improve the translation of existing messages, or because the git-gui software itself was updated and there are new messages that need translation. -In any case, make sure you are up-to-date before starting your work: +In any case, make sure you are up to date before starting your work: $ git checkout master $ git pull |