From 492595cfc70f97cd99d4c460db1ba01b73dab932 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 25 Jul 2017 10:35:57 +0200 Subject: git-gui (MinGW): make use of MSys2's msgfmt When Git for Windows was still based on MSys1, we had no gettext, ergo no msgfmt, either. Therefore, we introduced a small and simple Tcl script to perform the same task. However, with MSys2, we no longer need that because we have a proper msgfmt executable. Plus, the po2msg.sh script somehow manages to hang when run in parallel in Git for Windows' SDK (symptom: the Continuous Testing tasks timing out). Two reasons to use real msgfmt.exe instead. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index fe30be38dc..918a8de369 100644 --- a/Makefile +++ b/Makefile @@ -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 -- cgit v1.2.3 From 63100874c1653dd6a137f74143eda322550eabc7 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Tue, 7 Nov 2017 00:39:33 -0500 Subject: Replace Free Software Foundation address in license notices The mailing address for the FSF has changed over the years. Rather than updating the address across all files, refer readers to gnu.org, as the GNU GPL documentation now suggests for license notices. The mailing address is retained in the full license files (COPYING and LGPL-2.1). Signed-off-by: Todd Zullinger Signed-off-by: Junio C Hamano --- git-gui.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 5bc21b878d..ed24aa9d2f 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 .}] ###################################################################### ## -- cgit v1.2.3 From 474642b4a47c74a1f277955d7387d1886546fa01 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 16 Nov 2016 16:37:17 -0500 Subject: git-gui: sort entries in optimized tclIndex auto_mkindex expands wildcards in directory order, which depends on the underlying filesystem. To improve build reproducibility, sort the list of *.tcl files in the Makefile. The unoptimized loading case was previously fixed in gitgui-0.21.0~14 (git-gui: sort entries in tclIndex, 2015-01-26). Signed-off-by: Anders Kaseorg Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fe30be38dc..f94b3e13d6 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,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"; \ -- cgit v1.2.3 From 331450f18a7fd298ddd6b85cc5e8ed9dba09f9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= Date: Tue, 5 Dec 2017 15:23:26 +0100 Subject: git-gui: prevent double UTF-8 conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert author's name and e-mail address from the UTF-8 (or any other) encoding in load_last_commit function the same way commit message is converted. Amending commits in git-gui without such conversion breaks UTF-8 strings. For example, "\305\201ukasz" (as written by git cat-file) becomes "\303\205\302\201ukasz" in an amended commit. Signed-off-by: Łukasz Stelmach Signed-off-by: Junio C Hamano --- lib/commit.tcl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/commit.tcl b/lib/commit.tcl index 83620b7cbc..75ea965dac 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"] -- cgit v1.2.3 From 6d02c1e20471cd8b6923c82e8faacfe43a75b1e1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 9 Jan 2018 15:32:54 +0100 Subject: git gui: fix staging a second line to a 1-line file When a 1-line file is augmented by a second line, and the user tries to stage that single line via the "Stage Line" context menu item, we do not want to see "apply: corrupt patch at line 5". The reason for this error was that the hunk header looks like this: @@ -1 +1,2 @@ but the existing code expects the original range always to contain a comma. This problem is easily fixed by cutting the string "1 +1,2" (that Git GUI formerly mistook for the starting line) at the space. This fixes https://github.com/git-for-windows/git/issues/515 Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- lib/diff.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/diff.tcl b/lib/diff.tcl index 4cae10a4c7..68c4a6c736 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -698,6 +698,7 @@ proc apply_range_or_line {x y} { 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: -- cgit v1.2.3 From 2365e5b17411d50129462c2a1919bedc4fa64c68 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 9 Jan 2018 15:32:58 +0100 Subject: git-gui: avoid exception upon Ctrl+T in an empty list Previously unstaged files can be staged by clicking on them and then pressing Ctrl+T. Conveniently, the next unstaged file is selected automatically so that the unstaged files can be staged by repeatedly pressing Ctrl+T. When a user hits Ctrl+T one time too many, though, Git GUI used to throw this exception: expected number but got "" expected number but got "" while executing "expr {int([lindex [$w tag ranges in_diff] 0])}" (procedure "toggle_or_diff" line 13) invoked from within "toggle_or_diff toggle .vpane.files.workdir.list " (command bound to event) Let's just avoid that by skipping the operation when there are no more files to stage. This fixes https://github.com/git-for-windows/git/issues/1060 Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- git-gui.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index 5bc21b878d..3ce2e04bc5 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2505,6 +2505,10 @@ proc toggle_or_diff {mode w args} { if {$last_clicked ne {}} { set lno [lindex $last_clicked 1] } else { + if {[llength $file_lists($w)] == 0} { + set last_clicked {} + return + } set lno [expr {int([lindex [$w tag ranges in_diff] 0])}] } if {$mode eq "toggle"} { -- cgit v1.2.3 From 2cd9179c14dc830247a84a602caac42afa0fcf8f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 9 Jan 2018 15:33:01 +0100 Subject: git-gui: fix exception when trying to stage with empty file list If there is nothing to stage, there is nothing to stage. Let's not try to, even if the file list contains nothing at all. This fixes https://github.com/git-for-windows/git/issues/1075 Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- git-gui.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 3ce2e04bc5..b3c14acbdf 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2505,7 +2505,9 @@ proc toggle_or_diff {mode w args} { if {$last_clicked ne {}} { set lno [lindex $last_clicked 1] } else { - if {[llength $file_lists($w)] == 0} { + if {![info exists file_lists] + || ![info exists file_lists($w)] + || [llength $file_lists($w)] == 0} { set last_clicked {} return } @@ -2519,7 +2521,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 -- cgit v1.2.3 From 76756d67061076c046973bff2089ad49f5dc2eb6 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 9 Jan 2018 15:33:04 +0100 Subject: git-gui: allow Ctrl+T to toggle multiple paths It is possible to select multiple files in the "Unstaged Changes" and the "Staged Changes" lists. But when hitting Ctrl+T, surprisingly only one entry is handled, not all selected ones. Let's just use the same code path as for the "Stage To Commit" and the "Unstage From Commit" menu items. This fixes https://github.com/git-for-windows/git/issues/1012 Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- git-gui.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index b3c14acbdf..3fc254c37d 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2502,6 +2502,19 @@ 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 { -- cgit v1.2.3 From 6a47fa0efa342daa53c6386538fda313420351a5 Mon Sep 17 00:00:00 2001 From: Beat Bolli Date: Sat, 24 Feb 2018 19:39:13 +0100 Subject: git-gui: search for all current SSH key types OpenSSH has supported Ed25519 keys since version 6.4 (2014-01-30), and ECDSA keys since version 5.7 (2011-01-24). git-gui fails to find these key types in its Help/Show SSH Key dialog. Teach git-gui to show Ed25519 and ECDSA keys as well. This was originally reported in https://github.com/git-for-windows/git/issues/1487 and subseqently in https://public-inbox.org/git/F65780F29E48994380E2BCE87C6F071101146AB1@DEERLM99EX2MSX.ww931.my-it-solutions.net/ Signed-off-by: Beat Bolli Signed-off-by: Junio C Hamano --- lib/sshkey.tcl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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] -- cgit v1.2.3 From 146a6f1097f451c6b6d332916a515b7ce8c07e9a Mon Sep 17 00:00:00 2001 From: Birger Skogeng Pedersen Date: Fri, 2 Mar 2018 11:01:48 +0100 Subject: git-gui: bind CTRL/CMD+numpad ENTER to do_commit CTRL/CMD+ENTER is bound to do_commit, but this did not apply for the (numpad ENTER) key. To enable CTRL/CMD+ENTER and CTRL/CMD+(numpad ENTER) to yield the same behaviour, CTRL/CMD+(numpad enter) has also been bound to do_commit. Signed-off-by: Birger Skogeng Pedersen Signed-off-by: Junio C Hamano --- git-gui.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git-gui.sh b/git-gui.sh index 5bc21b878d..39e80ebafa 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -3843,6 +3843,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 { toggle_or_diff click %W %x %y; break } bind $i <$M1B-Button-1> { add_one_to_selection %W %x %y; break } -- cgit v1.2.3 From f50d5055bf9bb2aa35e629d31943334afc4a9f10 Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Sat, 3 Mar 2018 23:39:19 +0100 Subject: git-gui: workaround ttk:style theme use Tk 8.5.7, which is the latest version on Centos 6, does not support getting the current theme with [ttk::style theme use]. Use the existing workaround for this in all places. Signed-off-by: Clemens Buchacher Signed-off-by: Junio C Hamano --- lib/themed.tcl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 +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 } -- cgit v1.2.3 From 5440eb0ea2651c45a0e46f2335ecbb8d1f42c584 Mon Sep 17 00:00:00 2001 From: Pratyush Yadav Date: Sun, 4 Aug 2019 20:09:19 +0530 Subject: git-gui: call do_quit before destroying the main window If the toplevel window for the window being destroyed is the main window (aka "."), then simply destroying it means the cleanup tasks are not executed (like saving the commit message buffer, saving window state, etc.) All this is handled by do_quit. Call it instead of directly destroying the main window. For other toplevel windows, the old behavior remains. Signed-off-by: Pratyush Yadav Signed-off-by: Junio C Hamano --- git-gui.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 5bc21b878d..09c1b3c097 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -3006,8 +3006,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 {} { -- cgit v1.2.3 From b71c6c3b64bc002731bc2d6c49080a4855d2c169 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 9 May 2017 14:53:21 +0200 Subject: Fix build with core.autocrlf=true On Windows, the default line endings are denoted by a Carriage Return byte followed by a Line Feed byte, while Linux and MacOSX use a single Line Feed byte to denote a line ending. To help with this situation, Git introduced several mechanisms over the last decade, most prominently the `core.autocrlf` setting. Sometimes, however, a single setting is incorrect, e.g. when certain files in the source code are to be consumed by software that can handle only LF line endings, while other files can use whatever is appropriate for the current platform. To allow for that, Git added the `eol` option to its .gitattributes handling, expecting every user of Git to mark their source code appropriately. Bash assumes that line-endings of scripts are denoted by a single Line Feed byte. Therefore, shell scripts in Git's source code are one example where that `eol=lf` option is *required*. When generating common-cmds.h, the Unix tools we use generally operate on the assumption that input and output deliminate their lines using LF-only line endings. Consequently, they would happily copy the CR byte verbatim into the strings in common-cmds.h, which in turn makes the C preprocessor barf (that interprets them as MacOS-style line endings). Therefore, we have to mark the input files as LF-only: command-list.txt and Documentation/git-*.txt. Quite a bit belatedly, this patch brings Git's own source code in line with those expectations by setting those attributes to allow for a correct build even when core.autocrlf=true. This patch can be validated even on Linux, by using this cadence: git config core.autocrlf true rm .git/index && git stash make -j15 DEVELOPER=1 Signed-off-by: Johannes Schindelin Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano Signed-off-by: Pratyush Yadav --- .gitattributes | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3 From faf420e05a96ff167f41161f3feebce4c31cf044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C3=85gren?= Date: Wed, 23 Aug 2017 19:49:35 +0200 Subject: treewide: correct several "up-to-date" to "up to date" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the Oxford style, which says to use "up-to-date" before the noun, but "up to date" after it. Don't change plumbing (specifically send-pack.c, but transport.c (git push) also has the same string). This was produced by grepping for "up-to-date" and "up to date". It turned out we only had to edit in one direction, removing the hyphens. Fix a typo in Documentation/git-diff-index.txt while we're there. Reported-by: Jeffrey Manian Reported-by: STEVEN WHITE Signed-off-by: Martin Ågren Signed-off-by: Junio C Hamano Signed-off-by: Pratyush Yadav --- po/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/README b/po/README index 0f5837d48e..2514bc22ab 100644 --- a/po/README +++ b/po/README @@ -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 -- cgit v1.2.3