Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/j6t/git-gui:
  git-gui: use system encoding to show console output
  git-gui: Remove forced rescan of stat-dirty files.
  • Loading branch information
gitster committed Dec 26, 2024
2 parents 996f0c5 + 5c95773 commit 76cf4f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
3 changes: 2 additions & 1 deletion git-gui/git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,6 @@ set current_diff_path {}
set is_3way_diff 0
set is_submodule_diff 0
set is_conflict_diff 0
set diff_empty_count 0
set last_revert {}
set last_revert_enc {}

Expand Down Expand Up @@ -3594,6 +3593,8 @@ $ui_diff tag configure clr1 -font font_diffbold
$ui_diff tag configure clr4 -underline 1

$ui_diff tag conf d_info -foreground blue -font font_diffbold
$ui_diff tag conf d_rescan -foreground blue -underline 1 -font font_diffbold
$ui_diff tag bind d_rescan <Button-1> { clear_diff; rescan ui_ready 0 }

$ui_diff tag conf d_cr -elide true
$ui_diff tag conf d_@ -font font_diffbold
Expand Down
2 changes: 1 addition & 1 deletion git-gui/lib/console.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ method exec {cmd {after {}}} {
lappend cmd 2>@1
set fd_f [_open_stdout_stderr $cmd]
}
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]
}

Expand Down
26 changes: 6 additions & 20 deletions git-gui/lib/diff.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}}} {
Expand Down Expand Up @@ -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} {
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 76cf4f6

Please sign in to comment.