From: Junio C Hamano Date: Wed, 25 Nov 2009 19:45:07 +0000 (-0800) Subject: Merge branch 'rs/work-around-grep-opt-insanity' X-Git-Tag: v1.6.6-rc1~28 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ad7ace714d353ef49045bc37c1363e8fc904792d;p=git.git Merge branch 'rs/work-around-grep-opt-insanity' * rs/work-around-grep-opt-insanity: Protect scripted Porcelains from GREP_OPTIONS insanity mergetool--lib: simplify guess_merge_tool() Conflicts: git-instaweb.sh --- ad7ace714d353ef49045bc37c1363e8fc904792d diff --cc git-instaweb.sh index ffc2ab62b,84805c61e..341930ca9 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@@ -321,22 -316,8 +321,22 @@@ EO # plain-old CGI resolve_full_httpd list_mods=$(echo "$full_httpd" | sed "s/-f$/-l/") - $list_mods | grep 'mod_cgi\.c' >/dev/null 2>&1 || \ + $list_mods | sane_grep 'mod_cgi\.c' >/dev/null 2>&1 || \ - echo "LoadModule cgi_module $module_path/mod_cgi.so" >> "$conf" + if test -f "$module_path/mod_cgi.so" + then + echo "LoadModule cgi_module $module_path/mod_cgi.so" >> "$conf" + else + $list_mods | grep 'mod_cgid\.c' >/dev/null 2>&1 || \ + if test -f "$module_path/mod_cgid.so" + then + echo "LoadModule cgid_module $module_path/mod_cgid.so" \ + >> "$conf" + else + echo "You have no CGI support!" + exit 2 + fi + echo "ScriptSock logs/gitweb.sock" >> "$conf" + fi cat >> "$conf" < diff --cc git-mergetool--lib.sh index f7c571e73,334af7c34..5b6278572 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@@ -336,17 -323,16 +336,16 @@@ guess_merge_tool () else tools="opendiff kdiff3 tkdiff xxdiff meld $tools" fi - tools="$tools gvimdiff diffuse ecmerge araxis" + tools="$tools gvimdiff diffuse ecmerge p4merge araxis" fi - if echo "${VISUAL:-$EDITOR}" | grep emacs > /dev/null 2>&1; then - # $EDITOR is emacs so add emerge as a candidate - tools="$tools emerge vimdiff" - elif echo "${VISUAL:-$EDITOR}" | grep vim > /dev/null 2>&1; then - # $EDITOR is vim so add vimdiff as a candidate + case "${VISUAL:-$EDITOR}" in + *vim*) tools="$tools vimdiff emerge" - else + ;; + *) tools="$tools emerge vimdiff" - fi + ;; + esac echo >&2 "merge tool candidates: $tools" # Loop over each candidate and stop when a valid merge tool is found. diff --cc git-sh-setup.sh index 99cceeb85,aa07cc3d1..dfcb8078f --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@@ -99,14 -99,29 +99,22 @@@ set_reflog_action() } git_editor() { - : "${GIT_EDITOR:=$(git config core.editor)}" - : "${GIT_EDITOR:=${VISUAL:-${EDITOR}}}" - case "$GIT_EDITOR,$TERM" in - ,dumb) - echo >&2 "No editor specified in GIT_EDITOR, core.editor, VISUAL," - echo >&2 "or EDITOR. Tried to fall back to vi but terminal is dumb." - echo >&2 "Please set one of these variables to an appropriate" - echo >&2 "editor or run $0 with options that will not cause an" - echo >&2 "editor to be invoked (e.g., -m or -F for git-commit)." - exit 1 - ;; - esac - eval "${GIT_EDITOR:=vi}" '"$@"' + if test -z "${GIT_EDITOR:+set}" + then + GIT_EDITOR="$(git var GIT_EDITOR)" || return $? + fi + + eval "$GIT_EDITOR" '"$@"' } + sane_grep () { + GREP_OPTIONS= LC_ALL=C grep "$@" + } + + sane_egrep () { + GREP_OPTIONS= LC_ALL=C egrep "$@" + } + is_bare_repository () { git rev-parse --is-bare-repository }