aboutsummaryrefslogtreecommitdiffstats
path: root/git-gui/lib
diff options
context:
space:
mode:
Diffstat (limited to 'git-gui/lib')
-rw-r--r--git-gui/lib/commit.tcl13
-rw-r--r--git-gui/lib/console.tcl2
-rw-r--r--git-gui/lib/diff.tcl26
-rw-r--r--git-gui/lib/mergetool.tcl21
-rw-r--r--git-gui/lib/meson.build74
5 files changed, 112 insertions, 24 deletions
diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
index bb6056d0ad..60d66172a1 100644
--- a/git-gui/lib/commit.tcl
+++ b/git-gui/lib/commit.tcl
@@ -207,8 +207,19 @@ You must stage at least 1 file before you can commit.
# -- A message is required.
#
- set msg [string trim [$ui_comm get 1.0 end]]
+ set msg [$ui_comm get 1.0 end]
+ # Strip trailing whitespace
regsub -all -line {[ \t\r]+$} $msg {} msg
+ # Strip comment lines
+ global comment_string
+ set cmt_rx [strcat {(^|\n)} [regsub -all {\W} $comment_string {\\&}] {[^\n]*}]
+ regsub -all $cmt_rx $msg {\1} msg
+ # Strip leading empty lines
+ regsub {^\n*} $msg {} msg
+ # Compress consecutive empty lines
+ regsub -all {\n{3,}} $msg "\n\n" msg
+ # Strip trailing empty line
+ regsub {\n\n$} $msg "\n" msg
if {$msg eq {}} {
error_popup [mc "Please supply a commit message.
diff --git a/git-gui/lib/console.tcl b/git-gui/lib/console.tcl
index 4715ce91e6..a017cfeadd 100644
--- a/git-gui/lib/console.tcl
+++ b/git-gui/lib/console.tcl
@@ -96,7 +96,7 @@ method exec {cmd {after {}}} {
} else {
set fd_f [safe_open_command $cmd [list 2>@1]]
}
- fconfigure $fd_f -blocking 0 -translation binary
+ fconfigure $fd_f -blocking 0 -translation binary -encoding [encoding system]
fileevent $fd_f readable [cb _read $fd_f $after]
}
diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index 8ec740eb50..84f0468c7c 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -63,28 +63,17 @@ proc force_diff_encoding {enc} {
}
proc handle_empty_diff {} {
- global current_diff_path file_states file_lists
- global diff_empty_count
+ global current_diff_path file_states
+ global ui_diff
set path $current_diff_path
set s $file_states($path)
if {[lindex $s 0] ne {_M} || [has_textconv $path]} return
- # Prevent infinite rescan loops
- incr diff_empty_count
- if {$diff_empty_count > 1} return
-
- info_popup [mc "No differences detected.
-
-%s has no changes.
-
-The modification date of this file was updated by another application, but the content within the file was not changed.
-
-A rescan will be automatically started to find other files which may have the same state." [short_path $path]]
-
- clear_diff
- display_file $path __
- rescan ui_ready 0
+ $ui_diff conf -state normal
+ $ui_diff insert end [mc "* No differences detected; stage the file to de-list it from Unstaged Changes.\n"] d_info
+ $ui_diff insert end [mc "* Click to find other files that may have the same state.\n"] d_rescan
+ $ui_diff conf -state disabled
}
proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {
@@ -387,7 +376,6 @@ proc read_diff {fd conflict_size cont_info} {
global ui_diff diff_active is_submodule_diff
global is_3way_diff is_conflict_diff current_diff_header
global current_diff_queue
- global diff_empty_count
$ui_diff conf -state normal
while {[gets $fd line] >= 0} {
@@ -559,8 +547,6 @@ proc read_diff {fd conflict_size cont_info} {
if {[$ui_diff index end] eq {2.0}} {
handle_empty_diff
- } else {
- set diff_empty_count 0
}
set callback [lindex $cont_info 1]
diff --git a/git-gui/lib/mergetool.tcl b/git-gui/lib/mergetool.tcl
index 6b26726418..2c9bb3af40 100644
--- a/git-gui/lib/mergetool.tcl
+++ b/git-gui/lib/mergetool.tcl
@@ -272,8 +272,25 @@ proc merge_resolve_tool2 {} {
}
}
default {
- error_popup [mc "Unsupported merge tool '%s'" $tool]
- return
+ set tool_cmd [get_config mergetool.$tool.cmd]
+ if {$tool_cmd ne {}} {
+ if {([string first {[} $tool_cmd] != -1) || ([string first {]} $tool_cmd] != -1)} {
+ error_popup [mc "Unable to process square brackets in \"mergetool.%s.cmd\" configuration option.
+
+Please remove the square brackets." $tool]
+ return
+ } else {
+ set cmdline {}
+ foreach command_part $tool_cmd {
+ lappend cmdline [subst -nobackslashes -nocommands $command_part]
+ }
+ }
+ } else {
+ error_popup [mc "Unsupported merge tool '%s'.
+
+To use this tool, configure \"mergetool.%s.cmd\" as shown in the git-config manual page." $tool $tool]
+ return
+ }
}
}
diff --git a/git-gui/lib/meson.build b/git-gui/lib/meson.build
new file mode 100644
index 0000000000..4b9efab774
--- /dev/null
+++ b/git-gui/lib/meson.build
@@ -0,0 +1,74 @@
+libfiles = [
+ 'about.tcl',
+ 'blame.tcl',
+ 'branch_checkout.tcl',
+ 'branch_create.tcl',
+ 'branch_delete.tcl',
+ 'branch_rename.tcl',
+ 'branch.tcl',
+ 'browser.tcl',
+ 'checkout_op.tcl',
+ 'choose_font.tcl',
+ 'choose_repository.tcl',
+ 'choose_rev.tcl',
+ 'chord.tcl',
+ 'class.tcl',
+ 'commit.tcl',
+ 'console.tcl',
+ 'database.tcl',
+ 'date.tcl',
+ 'diff.tcl',
+ 'encoding.tcl',
+ 'error.tcl',
+ 'index.tcl',
+ 'line.tcl',
+ 'logo.tcl',
+ 'merge.tcl',
+ 'mergetool.tcl',
+ 'option.tcl',
+ 'remote_add.tcl',
+ 'remote_branch_delete.tcl',
+ 'remote.tcl',
+ 'search.tcl',
+ 'shortcut.tcl',
+ 'spellcheck.tcl',
+ 'sshkey.tcl',
+ 'status_bar.tcl',
+ 'themed.tcl',
+ 'tools_dlg.tcl',
+ 'tools.tcl',
+ 'transport.tcl',
+ 'win32.tcl',
+]
+
+nontcl_libfiles = [
+ 'git-gui.ico',
+ 'win32_shortcut.js',
+]
+
+foreach file : libfiles + nontcl_libfiles
+ configure_file(
+ input: file,
+ output: file,
+ copy: true,
+ install: true,
+ install_dir: get_option('datadir') / 'git-gui/lib',
+ )
+endforeach
+
+custom_target(
+ output: 'tclIndex',
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-tclindex.sh',
+ meson.project_build_root(),
+ meson.project_build_root() / 'GIT-GUI-BUILD-OPTIONS',
+ libfiles,
+ ],
+ depend_files: [
+ libfiles,
+ build_options,
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'git-gui/lib',
+)