From c217e26c9df0a701a3ba4be0654bedf8c328c36b Mon Sep 17 00:00:00 2001 From: Elia Pinto Date: Tue, 22 Dec 2015 15:10:29 +0100 Subject: [PATCH 1/4] git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}" done and then carefully proof-read. Signed-off-by: Elia Pinto Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano Signed-off-by: Pat Thoyts --- po/glossary/txt-to-pot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/glossary/txt-to-pot.sh b/po/glossary/txt-to-pot.sh index 49bf7c5365..8249915d3c 100755 --- a/po/glossary/txt-to-pot.sh +++ b/po/glossary/txt-to-pot.sh @@ -11,7 +11,7 @@ if [ $# -eq 0 ] then cat < git-gui-glossary.pot +Usage: $(basename $0) git-gui-glossary.txt > git-gui-glossary.pot ! exit 1; fi @@ -33,7 +33,7 @@ cat <\n" "Language-Team: LANGUAGE \n" From af465c0c28d2b299c08613e97d6df0ec23d86fbb Mon Sep 17 00:00:00 2001 From: yaras Date: Tue, 23 Feb 2016 11:55:46 +0000 Subject: [PATCH 2/4] git-gui: fix initial git gui message encoding This fix refers https://github.com/git-for-windows/git/issues/664 After `git merge --squash` git creates .git/SQUASH_MSG (UTF-8 encoded) which contains squashed commits. When run `git gui` it copies SQUASH_MSG to PREPARE_COMMIT_MSG, but without honoring UTF-8. This leads to encoding problems on `git gui` commit prompt. The same applies on git cherry-pick conflict, where MERGE_MSG is created and then is copied to PREPARE_COMMIT_MSG. In both cases PREPARE_COMMIT_MSG must be configured to store data in UTF-8. Signed-off-by: yaras Signed-off-by: Pat Thoyts --- git-gui.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index 11048c7a0e..1ed51857e9 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1616,11 +1616,13 @@ proc run_prepare_commit_msg_hook {} { if {[file isfile [gitdir MERGE_MSG]]} { set pcm_source "merge" set fd_mm [open [gitdir MERGE_MSG] r] + fconfigure $fd_mm -encoding utf-8 puts -nonewline $fd_pcm [read $fd_mm] close $fd_mm } elseif {[file isfile [gitdir SQUASH_MSG]]} { set pcm_source "squash" set fd_sm [open [gitdir SQUASH_MSG] r] + fconfigure $fd_sm -encoding utf-8 puts -nonewline $fd_pcm [read $fd_sm] close $fd_sm } else { From 52d196af6a5cb8441028914876a60ecec6c464e7 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Tue, 28 Jun 2016 10:57:42 +0200 Subject: [PATCH 3/4] git-gui: support for $FILENAMES in tool definitions This adds a FILENAMES environment variable, which contains the repository pathnames of all selected files the list. The variable contains the names separated by LF (\n, \x0a). If the file names contain LF characters, the tool command might be unable to unambiguously split the value of $FILENAME into the separate names. Note that the file marked and diffed immediately after starting the GUI up, is not actually selected. One must click on it once to really select it. Signed-off-by: Alex Riesen Signed-off-by: Pat Thoyts --- lib/tools.tcl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/tools.tcl b/lib/tools.tcl index 6ec94113db..413f1a1700 100644 --- a/lib/tools.tcl +++ b/lib/tools.tcl @@ -69,6 +69,7 @@ proc tools_populate_one {fullname} { proc tools_exec {fullname} { global repo_config env current_diff_path global current_branch is_detached + global selected_paths if {[is_config_true "guitool.$fullname.needsfile"]} { if {$current_diff_path eq {}} { @@ -100,6 +101,7 @@ proc tools_exec {fullname} { set env(GIT_GUITOOL) $fullname set env(FILENAME) $current_diff_path + set env(FILENAMES) [join [array names selected_paths] \n] if {$is_detached} { set env(CUR_BRANCH) "" } else { @@ -121,6 +123,7 @@ proc tools_exec {fullname} { unset env(GIT_GUITOOL) unset env(FILENAME) + unset env(FILENAMES) unset env(CUR_BRANCH) catch { unset env(ARGS) } catch { unset env(REVISION) } From a0a0c6838744ce51bcbb634f459e173e8be59c22 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Tue, 28 Jun 2016 10:59:25 +0200 Subject: [PATCH 4/4] git-gui: ensure the file in the diff pane is in the list of selected files It is very confusing that the file which diff is displayed is marked as selected, but it is not in fact selected (that means the array of selected files does not include the file in question). Fixing this also improves the use of $FILENAMES in custom defined tools: one does not have to click the file in the list to make it selected. Signed-off-by: Alex Riesen Signed-off-by: Pat Thoyts --- lib/diff.tcl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/diff.tcl b/lib/diff.tcl index 0d56986215..30bdd691ee 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} { } else { start_show_diff $cont_info } + + global current_diff_path selected_paths + set selected_paths($current_diff_path) 1 } proc show_unmerged_diff {cont_info} {