summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8c0ce43)
raw | patch | inline | side by side (parent: 8c0ce43)
author | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 7 Nov 2006 04:47:05 +0000 (23:47 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 7 Nov 2006 08:05:17 +0000 (03:05 -0500) |
Apparently the Cygwin tclsh/wish executables don't pass the environment
that they inherited onto any children that they invoke. This causes a
problem for some users during 'git fetch' or 'git push' as critical
environment variables like GIT_SSH and SSH_AUTH_SOCK aren't available
to the git processes.
So we work around this by forcing sh to start a login shell, thus
reloading the user's environment, then cd to the current directory,
and finally start the requested process. Of course this won't
correctly handle any transient environment variables that were
inherited but were not supplied by the user's login shell.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
that they inherited onto any children that they invoke. This causes a
problem for some users during 'git fetch' or 'git push' as critical
environment variables like GIT_SSH and SSH_AUTH_SOCK aren't available
to the git processes.
So we work around this by forcing sh to start a login shell, thus
reloading the user's environment, then cd to the current directory,
and finally start the requested process. Of course this won't
correctly handle any transient environment variables that were
inherited but were not supplied by the user's login shell.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui | patch | blob | history |
index a43fb2f662f9ce1b0fc4f38a1158176ccb336b57..be361dec171827afd2464012fb257e10e10cb544 100755 (executable)
--- a/git-gui
+++ b/git-gui
}
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 &