summaryrefslogtreecommitdiff
path: root/git-gui
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-21 15:28:14 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-21 15:28:14 -0500
commit1d8b3cbf2841612791178853efbfe9ba60b48f2b (patch)
tree2be9369ff44241e9adcce6f23e44e6ce8e6c5ab5 /git-gui
parentgit-gui: Correct is_MacOSX platform test. (diff)
downloadtgif-1d8b3cbf2841612791178853efbfe9ba60b48f2b.tar.xz
git-gui: Warn Cygwin users about possible environment issues.
Because the Tcl binary distributed with Cygwin tends to not pass along its own environment (the env array) to its children, its unlikely that any Git commands spawned by git-gui will receive the same environment variables that git-gui itself received from the shell which started it. If the user is counting on environment variables to pass down, like say GIT_INDEX_FILE, they may not, so we warn them during git-gui startup that things may not work out as the user intended. Perhaps one day when git-gui and git are running on native Windows (rather than through the Cygwin emulation layers) things will work better. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui')
-rwxr-xr-xgit-gui82
1 files changed, 81 insertions, 1 deletions
diff --git a/git-gui b/git-gui
index afd9ac026e..5253141875 100755
--- a/git-gui
+++ b/git-gui
@@ -145,6 +145,28 @@ proc error_popup {msg} {
eval $cmd
}
+proc warn_popup {msg} {
+ global gitdir appname
+
+ set title $appname
+ if {$gitdir ne {}} {
+ append title { (}
+ append title [lindex \
+ [file split [file normalize [file dirname $gitdir]]] \
+ end]
+ append title {)}
+ }
+ set cmd [list tk_messageBox \
+ -icon warning \
+ -type ok \
+ -title "$title: warning" \
+ -message $msg]
+ if {[winfo ismapped .]} {
+ lappend cmd -parent .
+ }
+ eval $cmd
+}
+
proc info_popup {msg} {
global gitdir appname
@@ -158,7 +180,7 @@ proc info_popup {msg} {
}
tk_messageBox \
-parent . \
- -icon error \
+ -icon info \
-type ok \
-title $title \
-message $msg
@@ -3279,6 +3301,64 @@ set selected_commit_type new
wm title . "$appname ([file normalize [file dirname $gitdir]])"
focus -force $ui_comm
+
+# -- Warn the user about environmental problems.
+# Cygwin's Tcl does *not* pass its env array
+# onto any processes it spawns. This means
+# that the git processes get none of our
+# environment. That may not work...
+#
+if {[is_Windows]} {
+ set ignored_env 0
+ set suggest_user {}
+ set msg "Possible environment issues exist.
+
+The following environment variables are probably
+going to be ignored by any Git subprocess run
+by $appname:
+
+"
+ foreach name [array names env] {
+ switch -regexp -- $name {
+ {^GIT_INDEX_FILE$} -
+ {^GIT_OBJECT_DIRECTORY$} -
+ {^GIT_ALTERNATE_OBJECT_DIRECTORIES$} -
+ {^GIT_DIFF_OPTS$} -
+ {^GIT_EXTERNAL_DIFF$} -
+ {^GIT_PAGER$} -
+ {^GIT_TRACE$} -
+ {^GIT_CONFIG$} -
+ {^GIT_CONFIG_LOCAL$} -
+ {^GIT_(AUTHOR|COMMITTER)_DATE$} {
+ append msg " - $name\n"
+ incr ignored_env
+ }
+ {^GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL)$} {
+ append msg " - $name\n"
+ incr ignored_env
+ set suggest_user $name
+ }
+ }
+ }
+ if {$ignored_env > 0} {
+ append msg "
+This is due to a known issue with the
+Tcl binary distributed by Cygwin."
+
+ if {$suggest_user ne {}} {
+ append msg "
+
+A good replacement for $suggest_user
+is placing values for the user.name and
+user.email settings into your personal
+~/.gitconfig file.
+"
+ }
+ warn_popup $msg
+ }
+ unset ignored_env msg suggest_user name
+}
+
if {!$single_commit} {
load_all_remotes
populate_fetch_menu .mbar.fetch