Add the configuration option skipFetchAll
[gitweb.git] / git-sh-setup.sh
index 2142308bcc6d2e2c4962859d18e12070cd4c1b1d..c41c2f7439724adc3dd13b92c86b25d254fc23b8 100755 (executable)
 # exporting it.
 unset CDPATH
 
+git_broken_path_fix () {
+       case ":$PATH:" in
+       *:$1:*) : ok ;;
+       *)
+               PATH=$(
+                       SANE_TOOL_PATH="$1"
+                       IFS=: path= sep=
+                       set x $PATH
+                       shift
+                       for elem
+                       do
+                               case "$SANE_TOOL_PATH:$elem" in
+                               (?*:/bin | ?*:/usr/bin)
+                                       path="$path$sep$SANE_TOOL_PATH"
+                                       sep=:
+                                       SANE_TOOL_PATH=
+                               esac
+                               path="$path$sep$elem"
+                               sep=:
+                       done
+                       echo "$path"
+               )
+               ;;
+       esac
+}
+
+# @@BROKEN_PATH_FIX@@
+
 die() {
        echo >&2 "$@"
        exit 1
 }
 
+GIT_QUIET=
+
+say () {
+       if test -z "$GIT_QUIET"
+       then
+               printf '%s\n' "$*"
+       fi
+}
+
 if test -n "$OPTIONS_SPEC"; then
        usage() {
                "$0" -h
@@ -85,27 +122,14 @@ cd_to_toplevel () {
        cdup=$(git rev-parse --show-cdup)
        if test ! -z "$cdup"
        then
-               case "$cdup" in
-               /*)
-                       # Not quite the same as if we did "cd -P '$cdup'" when
-                       # $cdup contains ".." after symlink path components.
-                       # Don't fix that case at least until Git switches to
-                       # "cd -P" across the board.
-                       phys="$cdup"
-                       ;;
-               ..|../*|*/..|*/../*)
-                       # Interpret $cdup relative to the physical, not logical, cwd.
-                       # Probably /bin/pwd is more portable than passing -P to cd or pwd.
-                       phys="$(unset PWD; /bin/pwd)/$cdup"
-                       ;;
-               *)
-                       # There's no "..", so no need to make things absolute.
-                       phys="$cdup"
-                       ;;
-               esac
-
-               cd "$phys" || {
-                       echo >&2 "Cannot chdir to $phys, the toplevel of the working tree"
+               # The "-P" option says to follow "physical" directory
+               # structure instead of following symbolic links.  When cdup is
+               # "../", this means following the ".." entry in the current
+               # directory instead textually removing a symlink path element
+               # from the PWD shell variable.  The "-P" behavior is more
+               # consistent with the C-style chdir used by most of Git.
+               cd -P "$cdup" || {
+                       echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree"
                        exit 1
                }
        fi