Merge branch 'rs/work-around-grep-opt-insanity'
authorJunio C Hamano <gitster@pobox.com>
Wed, 25 Nov 2009 19:45:07 +0000 (11:45 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Nov 2009 19:45:07 +0000 (11:45 -0800)
* rs/work-around-grep-opt-insanity:
  Protect scripted Porcelains from GREP_OPTIONS insanity
  mergetool--lib: simplify guess_merge_tool()

Conflicts:
git-instaweb.sh

1  2 
git-am.sh
git-bisect.sh
git-filter-branch.sh
git-instaweb.sh
git-mergetool--lib.sh
git-rebase--interactive.sh
git-rebase.sh
git-sh-setup.sh
git-submodule.sh

diff --cc git-am.sh
Simple merge
diff --cc git-bisect.sh
Simple merge
Simple merge
diff --cc 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" <<EOF
  AddHandler cgi-script .cgi
  <Location /gitweb.cgi>
@@@ -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.
Simple merge
diff --cc git-rebase.sh
Simple merge
diff --cc 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
  }
Simple merge