* 'master' of https://github.com/j6t/git-gui: (21 commits)
  git-gui: ensure own version of git-gui--askpass is used
  git-gui: Allow Tcl 9.0
  git-gui: use -profile tcl8 on encoding conversions
  git-gui: use -profile tcl8 for file input with Tcl 9
  git-gui: themed.tcl: use full namespace for color
  git-gui: remove EOL translation for gets
  git-gui: honor TCLTK_PATH in git-gui--askpass
  git-gui: retire Git Gui.app
  git-gui: fix dependency of GITGUI_MAIN on generator
  git-gui: remove uname_O in Makefile
  git-gui i18n: Remove the locations within the Bulgarian translation
  git-gui i18n: Update Bulgarian translation (557t)
  git-gui: do not mix -translation binary and -encoding
  git-gui: replace encoding binary with iso8859-1
  git-gui: translation binary defines iso8859-1
  git-gui: assure -eofchar {} on all channels
  git-gui: use /cmd/git-gui.exe for shortcut
  git-gui: Windows tk_getSaveFile is not useful for shortcuts
  git-gui: let nice work on Windows
  git-gui: do not add directories to PATH on Windows
  ...
This commit is contained in:
Junio C Hamano
2025-08-04 11:45:23 -07:00
27 changed files with 197 additions and 1052 deletions

2
git-gui/.gitignore vendored
View File

@@ -1,8 +1,8 @@
.DS_Store
config.mak
Git Gui.app*
git-gui.tcl
GIT-GUI-BUILD-OPTIONS
GIT-VERSION-FILE
git-gui
git-gui--askpass
lib/tclIndex

View File

@@ -4,4 +4,3 @@ GITGUI_RELATIVE=@GITGUI_RELATIVE@
SHELL_PATH=@SHELL_PATH@
TCLTK_PATH=@TCLTK_PATH@
TCL_PATH=@TCL_PATH@
TKEXECUTABLE=@TKEXECUTABLE@

View File

@@ -12,7 +12,6 @@ GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN . $@
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
SCRIPT_SH = git-gui.sh
@@ -54,8 +53,6 @@ INSTALL_R0 = $(INSTALL) -m 644 # space is required here
INSTALL_R1 =
INSTALL_X0 = $(INSTALL) -m 755 # space is required here
INSTALL_X1 =
INSTALL_A0 = find # space is required here
INSTALL_A1 = | cpio -pud
INSTALL_L0 = rm -f # space is required here
INSTALL_L1 = && ln # space is required here
INSTALL_L2 =
@@ -80,8 +77,6 @@ ifndef V
INSTALL_R1 = && echo ' ' INSTALL 644 `basename $$src` && $(INSTALL) -m 644 $$src
INSTALL_X0 = src=
INSTALL_X1 = && echo ' ' INSTALL 755 `basename $$src` && $(INSTALL) -m 755 $$src
INSTALL_A0 = src=
INSTALL_A1 = && echo ' ' INSTALL ' ' `basename "$$src"` && find "$$src" | cpio -pud
INSTALL_L0 = dst=
INSTALL_L1 = && src=
@@ -102,18 +97,6 @@ else
TCL_PATH ?= $(dir $(TCLTK_PATH))$(notdir $(subst wish,tclsh,$(TCLTK_PATH)))
endif
ifeq ($(uname_S),Darwin)
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
ifeq ($(shell echo "$(uname_R)" | awk -F. '{if ($$1 >= 9) print "y"}')_$(shell test -d $(TKFRAMEWORK) || echo n),y_n)
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish.app
ifeq ($(shell test -d $(TKFRAMEWORK) || echo n),n)
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
endif
endif
TKEXECUTABLE = $(TKFRAMEWORK)/Contents/MacOS/$(shell basename "$(TKFRAMEWORK)" .app)
TKEXECUTABLE_SQ = $(subst ','\'',$(TKEXECUTABLE))
endif
ifeq ($(findstring $(firstword -$(MAKEFLAGS)),s),s)
QUIET_GEN =
endif
@@ -131,16 +114,10 @@ libdir_SQ = $(subst ','\'',$(gg_libdir))
exedir = $(dir $(gitexecdir))share/git-gui/lib
GITGUI_RELATIVE :=
GITGUI_MACOSXAPP :=
ifeq ($(exedir),$(gg_libdir))
GITGUI_RELATIVE := 1
endif
ifeq ($(uname_S),Darwin)
ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y)
GITGUI_MACOSXAPP := YesPlease
endif
endif
ifneq (,$(findstring MINGW,$(uname_S)))
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
NO_MSGFMT=1
@@ -149,20 +126,6 @@ endif
GITGUI_RELATIVE := 1
endif
ifdef GITGUI_MACOSXAPP
GITGUI_MAIN := git-gui.tcl
git-gui: generate-macos-wrapper.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
$(QUIET_GEN)$(SHELL_PATH) generate-macos-wrapper.sh "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS \
macosx/Info.plist \
macosx/git-gui.icns \
macosx/AppMain.tcl \
$(TKEXECUTABLE)
$(QUIET_GEN)$(SHELL_PATH) generate-macos-app.sh . "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
endif
ifdef GITGUI_WINDOWS_WRAPPER
GITGUI_MAIN := git-gui.tcl
@@ -170,7 +133,7 @@ git-gui: windows/git-gui.sh
cp $< $@
endif
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS generate-git-gui.sh
$(QUIET_GEN)$(SHELL_PATH) generate-git-gui.sh "$<" "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
XGETTEXT ?= xgettext
@@ -207,18 +170,17 @@ GIT-GUI-BUILD-OPTIONS: FORCE
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@TCLTK_PATH@|$(TCLTK_PATH_SQ)|' \
-e 's|@TCL_PATH@|$(TCL_PATH_SQ)|' \
-e 's|@TKEXECUTABLE@|$(TKEXECUTABLE_SQ)|' \
$@.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
ifdef GITGUI_MACOSXAPP
all:: git-gui Git\ Gui.app
endif
git-gui--askpass: git-gui--askpass.sh GIT-GUI-BUILD-OPTIONS generate-script.sh
$(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS
ifdef GITGUI_WINDOWS_WRAPPER
all:: git-gui
endif
all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
all:: $(GITGUI_MAIN) git-gui--askpass lib/tclIndex $(ALL_MSGFILES)
install: all
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
@@ -230,10 +192,6 @@ ifdef GITGUI_WINDOWS_WRAPPER
endif
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(INSTALL_D1)
$(QUIET)$(INSTALL_R0)lib/tclIndex $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)'
ifdef GITGUI_MACOSXAPP
$(QUIET)$(INSTALL_A0)'Git Gui.app' $(INSTALL_A1) '$(DESTDIR_SQ)$(libdir_SQ)'
$(QUIET)$(INSTALL_X0)git-gui.tcl $(INSTALL_X1) '$(DESTDIR_SQ)$(libdir_SQ)'
endif
$(QUIET)$(foreach p,$(ALL_LIBFILES) $(NONTCL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(msgsdir_SQ)' $(INSTALL_D1)
$(QUIET)$(foreach p,$(ALL_MSGFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true
@@ -248,10 +206,6 @@ ifdef GITGUI_WINDOWS_WRAPPER
endif
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(libdir_SQ)'
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/tclIndex $(REMOVE_F1)
ifdef GITGUI_MACOSXAPP
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)/Git Gui.app' $(REMOVE_F1)
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/git-gui.tcl $(REMOVE_F1)
endif
$(QUIET)$(foreach p,$(ALL_LIBFILES) $(NONTCL_LIBFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(msgsdir_SQ)'
$(QUIET)$(foreach p,$(ALL_MSGFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true
@@ -265,11 +219,8 @@ dist-version: GIT-VERSION-FILE
@sed 's|^GITGUI_VERSION=||' <GIT-VERSION-FILE >$(TARDIR)/version
clean::
$(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg $(PO_TEMPLATE)
$(RM_RF) $(GITGUI_MAIN) git-gui--askpass lib/tclIndex po/*.msg $(PO_TEMPLATE)
$(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
ifdef GITGUI_MACOSXAPP
$(RM_RF) 'Git Gui.app'* git-gui
endif
ifdef GITGUI_WINDOWS_WRAPPER
$(RM_RF) git-gui
endif

View File

@@ -1,30 +0,0 @@
#!/bin/sh
set -e
SOURCE_DIR="$1"
OUTPUT="$2"
BUILD_OPTIONS="$3"
VERSION_FILE="$4"
. "$BUILD_OPTIONS"
. "$VERSION_FILE"
rm -rf "$OUTPUT" "$OUTPUT+"
mkdir -p "$OUTPUT+/Contents/MacOS"
mkdir -p "$OUTPUT+/Contents/Resources/Scripts"
cp "$TKEXECUTABLE" "$OUTPUT+/Contents/MacOS"
cp "$SOURCE_DIR/macosx/git-gui.icns" "$OUTPUT+/Contents/Resources"
sed \
-e "s/@@GITGUI_VERSION@@/$GITGUI_VERSION/g" \
-e "s/@@GITGUI_TKEXECUTABLE@@/$(basename "$TKEXECUTABLE")/g" \
"$SOURCE_DIR/macosx/Info.plist" \
>"$OUTPUT+/Contents/Info.plist"
sed \
-e "s|@@gitexecdir@@|$GITGUI_GITEXECDIR|" \
-e "s|@@GITGUI_LIBDIR@@|$GITGUI_LIBDIR|" \
"$SOURCE_DIR/macosx/AppMain.tcl" \
>"$OUTPUT+/Contents/Resources/Scripts/AppMain.tcl"
mv "$OUTPUT+" "$OUTPUT"

View File

@@ -1,35 +0,0 @@
#!/bin/sh
set -e
if test "$#" -ne 3
then
echo >&2 "usage: $0 <OUTPUT> <BUILD_OPTIONS> <VERSION_FILE>"
exit 1
fi
OUTPUT="$1"
BUILD_OPTIONS="$2"
VERSION_FILE="$3"
. "$BUILD_OPTIONS"
rm -f "$OUTPUT" "$OUTPUT+"
(
echo "#!$SHELL_PATH"
cat "$BUILD_OPTIONS" "$VERSION_FILE"
cat <<-'EOF'
if test "z$*" = zversion ||
test "z$*" = z--version
then
echo "git-gui version $GITGUI_VERSION"
else
libdir="${GIT_GUI_LIB_DIR:-$GITGUI_LIBDIR}"
exec "$libdir/Git Gui.app/Contents/MacOS/$(basename "$TKEXECUTABLE")" "$0" "$@"
fi
EOF
) >"$OUTPUT+"
chmod +x "$OUTPUT+"
mv "$OUTPUT+" "$OUTPUT"

22
git-gui/generate-script.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/sh
set -e
if test $# -ne 3
then
echo >&2 "USAGE: $0 <OUTPUT> <INPUT> <GIT-GUI-BUILD-OPTIONS>"
exit 1
fi
OUTPUT="$1"
INPUT="$2"
BUILD_OPTIONS="$3"
. "$BUILD_OPTIONS"
sed \
-e "1s|#!.*/sh|#!$SHELL_PATH|" \
-e "1,3s|^exec wish|exec '$TCLTK_PATH'|" \
"$INPUT" >"$OUTPUT"
chmod a+x "$OUTPUT"

View File

@@ -30,7 +30,7 @@ along with this program; if not, see <https://www.gnu.org/licenses/>.}]
##
## Tcl/Tk sanity check
if {[catch {package require Tcl 8.6-8.8} err]} {
if {[catch {package require Tcl 8.6-} err]} {
catch {wm withdraw .}
tk_messageBox \
-icon error \
@@ -73,6 +73,26 @@ proc is_Cygwin {} {
return $_iscygwin
}
######################################################################
## Enable Tcl8 profile in Tcl9, allowing consumption of data that has
## bytes not conforming to the assumed encoding profile.
if {[package vcompare $::tcl_version 9.0] >= 0} {
rename open _strict_open
proc open args {
set f [_strict_open {*}$args]
chan configure $f -profile tcl8
return $f
}
proc convertfrom args {
return [encoding convertfrom -profile tcl8 {*}$args]
}
} else {
proc convertfrom args {
return [encoding convertfrom {*}$args]
}
}
######################################################################
##
## PATH lookup. Sanitize $PATH, assure exec/open use only that
@@ -83,12 +103,6 @@ if {[is_Windows]} {
set _path_sep {:}
}
if {[is_Windows]} {
set gitguidir [file dirname [info script]]
regsub -all ";" $gitguidir "\\;" gitguidir
set env(PATH) "$gitguidir;$env(PATH)"
}
set _search_path {}
set _path_seen [dict create]
foreach p [split $env(PATH) $_path_sep] {
@@ -183,7 +197,9 @@ if {[is_Windows]} {
set command_line [string trim [string range $arg0 1 end]]
lset args 0 "| [sanitize_command_line $command_line 0]"
}
uplevel 1 real_open $args
set fd [real_open {*}$args]
fconfigure $fd -eofchar {}
return $fd
}
} else {
@@ -575,8 +591,6 @@ proc _lappend_nice {cmd_var} {
set _nice [_which nice]
if {[catch {safe_exec [list $_nice git version]}]} {
set _nice {}
} elseif {[is_Windows] && [file dirname $_nice] ne [file dirname $::_git]} {
set _nice {}
}
}
if {$_nice ne {}} {
@@ -590,7 +604,7 @@ proc git {args} {
proc git_redir {cmd redir} {
set fd [git_read $cmd $redir]
fconfigure $fd -translation binary -encoding utf-8
fconfigure $fd -encoding utf-8
set result [string trimright [read $fd] "\n"]
close $fd
if {$::_trace} {
@@ -607,7 +621,6 @@ proc safe_open_command {cmd {redir {}}} {
} err]} {
error $err
}
fconfigure $fd -eofchar {}
return $fd
}
@@ -1003,7 +1016,7 @@ proc _parse_config {arr_name args} {
[concat config \
$args \
--null --list]]
fconfigure $fd_rc -translation binary -encoding utf-8
fconfigure $fd_rc -encoding utf-8
set buf [read $fd_rc]
close $fd_rc
}
@@ -1113,9 +1126,11 @@ citool {
## execution environment
# Suggest our implementation of askpass, if none is set
set argv0dir [file dirname [file normalize $::argv0]]
if {![info exists env(SSH_ASKPASS)]} {
set env(SSH_ASKPASS) [file join [git --exec-path] git-gui--askpass]
set env(SSH_ASKPASS) [file join $argv0dir git-gui--askpass]
}
unset argv0dir
######################################################################
##
@@ -1405,15 +1420,15 @@ proc rescan_stage2 {fd after} {
set fd_di [git_read [list diff-index --cached --ignore-submodules=dirty -z [PARENT]]]
set fd_df [git_read [list diff-files -z]]
fconfigure $fd_di -blocking 0 -translation binary -encoding binary
fconfigure $fd_df -blocking 0 -translation binary -encoding binary
fconfigure $fd_di -blocking 0 -translation binary
fconfigure $fd_df -blocking 0 -translation binary
fileevent $fd_di readable [list read_diff_index $fd_di $after]
fileevent $fd_df readable [list read_diff_files $fd_df $after]
if {[is_config_true gui.displayuntracked]} {
set fd_lo [git_read [concat ls-files --others -z $ls_others]]
fconfigure $fd_lo -blocking 0 -translation binary -encoding binary
fconfigure $fd_lo -blocking 0 -translation binary
fileevent $fd_lo readable [list read_ls_others $fd_lo $after]
incr rescan_active
}
@@ -1427,7 +1442,6 @@ proc load_message {file {encoding {}}} {
if {[catch {set fd [safe_open_file $f r]}]} {
return 0
}
fconfigure $fd -eofchar {}
if {$encoding ne {}} {
fconfigure $fd -encoding $encoding
}
@@ -1484,7 +1498,7 @@ proc run_prepare_commit_msg_hook {} {
ui_status [mc "Calling prepare-commit-msg hook..."]
set pch_error {}
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
fconfigure $fd_ph -blocking 0 -translation binary
fileevent $fd_ph readable \
[list prepare_commit_msg_hook_wait $fd_ph]
@@ -1530,7 +1544,7 @@ proc read_diff_index {fd after} {
set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
set p [string range $buf_rdi $z1 [expr {$z2 - 1}]]
merge_state \
[encoding convertfrom utf-8 $p] \
[convertfrom utf-8 $p] \
[lindex $i 4]? \
[list [lindex $i 0] [lindex $i 2]] \
[list]
@@ -1563,7 +1577,7 @@ proc read_diff_files {fd after} {
set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
set p [string range $buf_rdf $z1 [expr {$z2 - 1}]]
merge_state \
[encoding convertfrom utf-8 $p] \
[convertfrom utf-8 $p] \
?[lindex $i 4] \
[list] \
[list [lindex $i 0] [lindex $i 2]]
@@ -1586,7 +1600,7 @@ proc read_ls_others {fd after} {
set pck [split $buf_rlo "\0"]
set buf_rlo [lindex $pck end]
foreach p [lrange $pck 0 end-1] {
set p [encoding convertfrom utf-8 $p]
set p [convertfrom utf-8 $p]
if {[string index $p end] eq {/}} {
set p [string range $p 0 end-1]
}

View File

@@ -483,7 +483,6 @@ method _load {jump} {
} else {
set fd [safe_open_file $path r]
}
fconfigure $fd -eofchar {}
} else {
if {$do_textconv ne 0} {
set fd [git_read [list cat-file --textconv "$commit:$path"]]
@@ -493,7 +492,6 @@ method _load {jump} {
}
fconfigure $fd \
-blocking 0 \
-translation lf \
-encoding [get_path_encoding $path]
fileevent $fd readable [cb _read_file $fd $jump]
set current_fd $fd
@@ -620,7 +618,7 @@ method _exec_blame {cur_w cur_d options cur_s} {
lappend options -- $path
set fd [git_read_nice [concat blame $options]]
fconfigure $fd -blocking 0 -translation lf -encoding utf-8
fconfigure $fd -blocking 0 -encoding utf-8
fileevent $fd readable [cb _read_blame $fd $cur_w $cur_d]
set current_fd $fd
set blame_lines 0
@@ -986,7 +984,7 @@ method _showcommit {cur_w lno} {
set msg {}
catch {
set fd [git_read [list cat-file commit $cmit]]
fconfigure $fd -encoding binary -translation lf
fconfigure $fd -encoding iso8859-1
# By default commits are assumed to be in utf-8
set enc utf-8
while {[gets $fd line] > 0} {
@@ -999,7 +997,7 @@ method _showcommit {cur_w lno} {
set enc [tcl_encoding $enc]
if {$enc ne {}} {
set msg [encoding convertfrom $enc $msg]
set msg [convertfrom $enc $msg]
}
set msg [string trim $msg]
}
@@ -1143,7 +1141,6 @@ method _blameparent {} {
fconfigure $fd \
-blocking 0 \
-encoding binary \
-translation binary
fileevent $fd readable [cb _read_diff_load_commit \
$fd $cparent $new_path $r_orig_line]

View File

@@ -8,7 +8,7 @@ proc load_all_heads {} {
set rh_len [expr {[string length $rh] + 1}]
set all_heads [list]
set fd [git_read [list for-each-ref --format=%(refname) $rh]]
fconfigure $fd -translation binary -encoding utf-8
fconfigure $fd -encoding utf-8
while {[gets $fd line] > 0} {
if {!$some_heads_tracking || ![is_tracking_branch $line]} {
lappend all_heads [string range $line $rh_len end]
@@ -25,7 +25,7 @@ proc load_all_tags {} {
--sort=-taggerdate \
--format=%(refname) \
refs/tags]]
fconfigure $fd -translation binary -encoding utf-8
fconfigure $fd -encoding utf-8
while {[gets $fd line] > 0} {
if {![regsub ^refs/tags/ $line {} name]} continue
lappend all_tags $name

View File

@@ -195,7 +195,7 @@ method _ls {tree_id {name {}}} {
$w conf -state disabled
set fd [git_read [list ls-tree -z $tree_id]]
fconfigure $fd -blocking 0 -translation binary -encoding utf-8
fconfigure $fd -blocking 0 -encoding utf-8
fileevent $fd readable [cb _read $fd]
}

View File

@@ -462,7 +462,7 @@ If you wanted to be on a branch, create one now starting from 'This Detached Che
if {$fd_ph ne {}} {
global pch_error
set pch_error {}
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
fconfigure $fd_ph -blocking 0 -translation binary
fileevent $fd_ph readable [cb _postcheckout_wait $fd_ph]
} else {
_update_repo_state $this

View File

@@ -147,7 +147,7 @@ constructor _new {path unmerged_only title} {
refs/remotes \
refs/tags \
]]
fconfigure $fr_fd -translation lf -encoding utf-8
fconfigure $fr_fd -encoding utf-8
while {[gets $fr_fd line] > 0} {
set line [eval $line]
if {[lindex $line 1 0] eq {tag}} {
@@ -570,7 +570,7 @@ method _reflog_last {name} {
set last {}
if {[catch {set last [file mtime [gitdir $name]]}]
&& ![catch {set g [safe_open_file [gitdir logs $name] r]}]} {
fconfigure $g -translation binary
fconfigure $g -encoding iso8859-1
while {[gets $g line] >= 0} {
if {[regexp {> ([1-9][0-9]*) } $line line when]} {
set last $when

View File

@@ -28,7 +28,7 @@ You are currently in the middle of a merge that has not been fully completed. Y
set name ""
set email ""
set fd [git_read [list cat-file commit $curHEAD]]
fconfigure $fd -encoding binary -translation lf
fconfigure $fd -encoding iso8859-1
# By default commits are assumed to be in utf-8
set enc utf-8
while {[gets $fd line] > 0} {
@@ -43,9 +43,9 @@ 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]
set msg [convertfrom $enc $msg]
set name [convertfrom $enc $name]
set email [convertfrom $enc $email]
}
if {$name ne {} && $email ne {}} {
set commit_author [list name $name email $email date $time]
@@ -208,28 +208,6 @@ You must stage at least 1 file before you can commit.
# -- A message is required.
#
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 and trailing empty lines (puts adds one \n)
set msg [string trim $msg \n]
# Compress consecutive empty lines
regsub -all {\n{3,}} $msg "\n\n" msg
if {$msg eq {}} {
error_popup [mc "Please supply a commit message.
A good commit message has the following format:
- First line: Describe in one sentence what you did.
- Second line: Blank
- Remaining lines: Describe why this change is good.
"]
unlock_index
return
}
# -- Build the message file.
#
@@ -252,7 +230,7 @@ A good commit message has the following format:
ui_status [mc "Calling pre-commit hook..."]
set pch_error {}
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
fconfigure $fd_ph -blocking 0 -translation binary
fileevent $fd_ph readable \
[list commit_prehook_wait $fd_ph $curHEAD $msg_p]
}
@@ -307,7 +285,7 @@ Do you really want to proceed with your Commit?"]
ui_status [mc "Calling commit-msg hook..."]
set pch_error {}
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
fconfigure $fd_ph -blocking 0 -translation binary
fileevent $fd_ph readable \
[list commit_commitmsg_wait $fd_ph $curHEAD $msg_p]
}
@@ -332,7 +310,52 @@ proc commit_commitmsg_wait {fd_ph curHEAD msg_p} {
fconfigure $fd_ph -blocking 0
}
proc wash_commit_message {msg} {
# 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 and trailing empty lines (puts adds one \n)
set msg [string trim $msg \n]
# Compress consecutive empty lines
regsub -all {\n{3,}} $msg \n\n msg
return $msg
}
proc commit_writetree {curHEAD msg_p} {
# -- Process the commit message after hooks have run.
#
set msg_fd [safe_open_file $msg_p r]
setup_commit_encoding $msg_fd 1
set msg [read $msg_fd]
close $msg_fd
# Process the message (strip whitespace, comments, etc.)
set msg [wash_commit_message $msg]
if {$msg eq {}} {
error_popup [mc "Please supply a commit message.
A good commit message has the following format:
- First line: Describe in one sentence what you did.
- Second line: Blank
- Remaining lines: Describe why this change is good.
"]
unlock_index
return
}
# Write the processed message back to the file
set msg_wt [safe_open_file $msg_p w]
fconfigure $msg_wt -translation lf
setup_commit_encoding $msg_wt
puts $msg_wt $msg
close $msg_wt
ui_status [mc "Committing changes..."]
set fd_wt [git_read [list write-tree]]
fileevent $fd_wt readable \
@@ -361,7 +384,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
#
if {$commit_type eq {normal}} {
set fd_ot [git_read [list cat-file commit $PARENT]]
fconfigure $fd_ot -encoding binary -translation lf
fconfigure $fd_ot -encoding iso8859-1
set old_tree [gets $fd_ot]
close $fd_ot
@@ -460,7 +483,7 @@ A rescan will be automatically started now.
if {$fd_ph ne {}} {
global pch_error
set pch_error {}
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
fconfigure $fd_ph -blocking 0 -translation binary
fileevent $fd_ph readable \
[list commit_postcommit_wait $fd_ph $cmt_id]
}

View File

@@ -191,7 +191,6 @@ proc show_other_diff {path w m cont_info} {
file {
set fd [safe_open_file $path r]
fconfigure $fd \
-eofchar {} \
-encoding [get_path_encoding $path]
set content [read $fd $max_sz]
close $fd
@@ -325,6 +324,8 @@ proc start_show_diff {cont_info {add_opts {}}} {
# '++' lines which is not bijective. Thus, we need to maintain a state
# across lines.
set ::conflict_in_pre_image 0
# git-diff has eol==\n, \r if present is part of the text
fconfigure $fd \
-blocking 0 \
-encoding [get_path_encoding $path] \

View File

@@ -78,7 +78,6 @@ proc update_indexinfo {msg path_list after} {
-blocking 0 \
-buffering full \
-buffersize 512 \
-encoding binary \
-translation binary
fileevent $fd writable [list \
write_update_indexinfo \
@@ -147,7 +146,6 @@ proc update_index {msg path_list after} {
-blocking 0 \
-buffering full \
-buffersize 512 \
-encoding binary \
-translation binary
fileevent $fd writable [list \
write_update_index \
@@ -227,7 +225,6 @@ proc checkout_index {msg path_list after capture_error} {
-blocking 0 \
-buffering full \
-buffersize 512 \
-encoding binary \
-translation binary
fileevent $fd writable [list \
write_checkout_index \

View File

@@ -90,7 +90,7 @@ proc merge_load_stages {path cont} {
set merge_stages_fd [git_read [list ls-files -u -z -- $path]]
fconfigure $merge_stages_fd -blocking 0 -translation binary -encoding binary
fconfigure $merge_stages_fd -blocking 0 -translation binary
fileevent $merge_stages_fd readable [list read_merge_stages $merge_stages_fd $cont]
}
@@ -370,7 +370,7 @@ proc merge_tool_start {cmdline target backup stages} {
ui_status [mc "Running merge tool..."]
fconfigure $mtool_fd -blocking 0 -translation binary -encoding binary
fconfigure $mtool_fd -blocking 0 -translation binary
fileevent $mtool_fd readable [list read_mtool_output $mtool_fd]
}

View File

@@ -307,7 +307,6 @@ method _load {cache uri} {
set active_ls [git_read [list ls-remote $uri]]
fconfigure $active_ls \
-blocking 0 \
-translation lf \
-encoding utf-8
fileevent $active_ls readable [cb _read $cache $active_ls]
} else {

View File

@@ -3,27 +3,41 @@
proc do_windows_shortcut {} {
global _gitworktree
set fn [tk_getSaveFile \
-parent . \
-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
-initialfile "Git [reponame].lnk"]
if {$fn != {}} {
if {[file extension $fn] ne {.lnk}} {
set fn ${fn}.lnk
}
# Use git-gui.exe if available (ie: git-for-windows)
set cmdLine [list [_which git-gui]]
if {$cmdLine eq {}} {
set cmdLine [list [info nameofexecutable] \
[file normalize $::argv0]]
}
if {[catch {
win32_create_lnk $fn $cmdLine \
[file normalize $_gitworktree]
} err]} {
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
set desktop [safe_exec [list cygpath -mD]]
set link_file "Git [reponame].lnk"
set link_path [file normalize [file join $desktop $link_file]]
# on Windows, tk_getSaveFile dereferences .lnk files, so no simple
# filename chooser is available. Use the default or quit.
if {[file exists $link_path]} {
set answer [tk_messageBox \
-type yesno \
-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
-default yes \
-message [mc "Replace existing shortcut: %s?" $link_file]]
if {$answer == no} {
return
}
}
# Use git-gui.exe if found, fall back to wish + launcher
set link_arguments {}
set link_target [safe_exec [list cygpath -m /cmd/git-gui.exe]]
if {![file executable $link_target]} {
set link_target [_which git-gui]
}
if {![file executable $link_target]} {
set link_target [file normalize [info nameofexecutable]]
set link_arguments [file normalize $::argv0]
}
set cmdLine [list $link_target $link_arguments]
if {[catch {
win32_create_lnk $link_path $cmdLine \
[file normalize $_gitworktree]
} err]} {
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
}
}
proc do_cygwin_shortcut {} {

View File

@@ -33,7 +33,6 @@ constructor init {pipe_fd ui_text ui_menu} {
method _connect {pipe_fd} {
fconfigure $pipe_fd \
-encoding utf-8 \
-eofchar {} \
-translation lf
if {[gets $pipe_fd s_version] <= 0} {

View File

@@ -21,10 +21,10 @@ namespace eval color {
set inactive_select_bg [convert_rgb_to_gray $select_bg]
set inactive_select_fg $select_fg
set color::select_bg $select_bg
set color::select_fg $select_fg
set color::inactive_select_bg $inactive_select_bg
set color::inactive_select_fg $inactive_select_fg
set ::color::select_bg $select_bg
set ::color::select_fg $select_fg
set ::color::inactive_select_bg $inactive_select_bg
set ::color::inactive_select_fg $inactive_select_fg
proc add_option {key val} {
option add $key $val widgetDefault

View File

@@ -1,29 +0,0 @@
set gitexecdir {@@gitexecdir@@}
if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
set gitguilib $::env(GIT_GUI_LIB_DIR)
} else {
set gitguilib {@@GITGUI_LIBDIR@@}
}
set env(PATH) "$gitexecdir:$env(PATH)"
if {[string first -psn [lindex $argv 0]] == 0} {
lset argv 0 [file join $gitexecdir git-gui]
}
if {[file tail [lindex $argv 0]] eq {gitk}} {
set argv0 [lindex $argv 0]
set AppMain_source $argv0
} else {
set argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]
set AppMain_source [file join $gitguilib git-gui.tcl]
if {[info exists env(PWD)]} {
cd $env(PWD)
} elseif {[pwd] eq {/}} {
cd $env(HOME)
}
}
unset gitexecdir gitguilib
set argv [lrange $argv 1 end]
source $AppMain_source

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>@@GITGUI_TKEXECUTABLE@@</string>
<key>CFBundleGetInfoString</key>
<string>Git Gui @@GITGUI_VERSION@@ © 2006-2007 Shawn Pearce, et. al.</string>
<key>CFBundleIconFile</key>
<string>git-gui.icns</string>
<key>CFBundleIdentifier</key>
<string>cz.or.repo.git-gui</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Git Gui</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@@GITGUI_VERSION@@</string>
<key>CFBundleSignature</key>
<string>GITg</string>
<key>CFBundleVersion</key>
<string>@@GITGUI_VERSION@@</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

Binary file not shown.

View File

@@ -19,17 +19,6 @@ build_options_config.set_quoted('GITGUI_LIBDIR', get_option('prefix') / get_opti
build_options_config.set_quoted('SHELL_PATH', fs.as_posix(shell.full_path()))
build_options_config.set_quoted('TCLTK_PATH', fs.as_posix(wish.full_path()))
build_options_config.set_quoted('TCL_PATH', fs.as_posix(tclsh.full_path()))
if target_machine.system() == 'darwin'
tkexecutables = [
'/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish',
'/System/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish',
'/System/Library/Frameworks/Tk.framework/Resources/Wish Shell.app/Contents/MacOS/Wish Shell',
]
tkexecutable = find_program(tkexecutables)
build_options_config.set_quoted('TKEXECUTABLE', tkexecutable.full_path())
else
build_options_config.set('TKEXECUTABLE', '')
endif
build_options = configure_file(
input: 'GIT-GUI-BUILD-OPTIONS.in',
@@ -49,14 +38,6 @@ version_file = custom_target(
build_always_stale: true,
)
configure_file(
input: 'git-gui--askpass',
output: 'git-gui--askpass',
copy: true,
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)
gitgui_main = 'git-gui'
gitgui_main_install_dir = get_option('libexecdir') / 'git-core'
@@ -70,54 +51,22 @@ if target_machine.system() == 'windows'
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)
elif target_machine.system() == 'darwin'
gitgui_main = 'git-gui.tcl'
gitgui_main_install_dir = get_option('datadir') / 'git-gui/lib'
custom_target(
output: 'git-gui',
command: [
shell,
meson.current_source_dir() / 'generate-macos-wrapper.sh',
'@OUTPUT@',
meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
meson.current_build_dir() / 'GIT-VERSION-FILE',
],
depends: [
version_file,
],
depend_files: [
build_options,
],
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)
custom_target(
output: 'Git Gui.app',
command: [
shell,
meson.current_source_dir() / 'generate-macos-app.sh',
meson.current_source_dir(),
meson.current_build_dir() / 'Git Gui.app',
meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
meson.current_build_dir() / 'GIT-VERSION-FILE',
],
depends: [
version_file,
],
depend_files: [
build_options,
'macosx/AppMain.tcl',
'macosx/Info.plist',
'macosx/git-gui.icns',
],
build_by_default: true,
install: true,
install_dir: get_option('datadir') / 'git-gui/lib',
)
endif
custom_target(
output: 'git-gui--askpass',
input: 'git-gui--askpass.sh',
command: [
shell,
meson.current_source_dir() / 'generate-script.sh',
'@OUTPUT@',
'@INPUT@',
meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
],
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)
custom_target(
input: 'git-gui.sh',
output: gitgui_main,

File diff suppressed because it is too large Load Diff

View File

@@ -13,13 +13,5 @@ if { $argc >=2 && [lindex $argv 0] == "--working-dir" } {
incr argc -2
}
set basedir [file dirname \
[file dirname \
[file dirname [info script]]]]
set bindir [file join $basedir bin]
set bindir "$bindir;[file join $basedir mingw bin]"
regsub -all ";" $bindir "\\;" bindir
set env(PATH) "$bindir;$env(PATH)"
unset bindir
source [file join [file dirname [info script]] git-gui.tcl]
set thisdir [file normalize [file dirname [info script]]]
source [file join $thisdir git-gui.tcl]