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
index ffc2ab62bca8a93b42d74f6b276b1daa8a846f6f,84805c61e584f7cd01145805c43944b5ba8b8311..341930ca9d74867cf334952fc47bb3afe95552b7
@@@ -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>
index f7c571e73cdf471148b606242066536361ac7c3d,334af7c3478bd6e4fa3f29e360b6be4fbaf6f8cb..5b6278572a48569a806a5a976cdd08eb7c117fb7
@@@ -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
index 99cceeb858dcd2c83a040b0dd3117744e177e316,aa07cc3d188df9744d50d8e0487c86a2cb30b1ac..dfcb8078f508d6cc26d312d61b64e0185e90b74b
@@@ -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