}
if {![$ui_comm edit modified]
- || [string trim [$ui_comm get 0.0 end]] == {}} {
+ || [string trim [$ui_comm get 0.0 end]] == {}} {
if {[load_message GITGUI_MSG]} {
} elseif {[load_message MERGE_MSG]} {
} elseif {[load_message SQUASH_MSG]} {
proc fetch_from {remote} {
set w [new_console "fetch $remote" \
"Fetching new changes from $remote"]
- set cmd [list | git fetch]
- lappend -v
+ set cmd [list git fetch]
+ lappend cmd -v
lappend cmd $remote
- lappend cmd |& cat
- set fd_f [open $cmd r]
- fconfigure $fd_f -blocking 0 -translation auto
- fileevent $fd_f readable [list console_read $w $fd_f]
+ console_exec $w $cmd
}
proc push_to {remote} {
set w [new_console "push $remote" \
"Pushing changes to $remote"]
- set cmd [list | git push]
+ set cmd [list git push]
lappend -v
lappend cmd $remote
- lappend cmd |& cat
- set fd_f [open $cmd r]
- fconfigure $fd_f -blocking 0 -translation auto
- fileevent $fd_f readable [list console_read $w $fd_f]
+ console_exec $w $cmd
}
######################################################################
return $w
}
+proc console_exec {w cmd} {
+ global tcl_platform
+
+ # -- Windows tosses the enviroment when we exec our child.
+ # But most users need that so we have to relogin. :-(
+ #
+ if {$tcl_platform(platform) == {windows}} {
+ set cmd [list sh --login -c "cd \"[pwd]\" && [join $cmd { }]"]
+ }
+
+ # -- Tcl won't let us redirect both stdout and stderr to
+ # the same pipe. So pass it through cat...
+ #
+ set cmd [concat | $cmd |& cat]
+
+ set fd_f [open $cmd r]
+ fconfigure $fd_f -blocking 0 -translation auto
+ fileevent $fd_f readable [list console_read $w $fd_f]
+}
+
proc console_read {w fd} {
$w.m.t conf -state normal
while {[gets $fd line] >= 0} {
$w.m.t insert end "\n"
}
$w.m.t conf -state disabled
+ $w.m.t see end
if {[eof $fd]} {
close $fd
## ui commands
set starting_gitk_msg {Please wait... Starting gitk...}
+
proc do_gitk {} {
global tcl_platform ui_status_value starting_gitk_msg
}
}
- if {$tcl_platform(platform) == "windows"} {
+ if {$tcl_platform(platform) == {windows}} {
exec sh -c gitk &
} else {
exec gitk &