summary refs log tree commit
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-05-25 12:08:26 -0700
committerJunio C Hamano <gitster@pobox.com>2012-05-25 12:08:26 -0700
commit4acf8e85dc088c42843221348e9c039d9bd23ecc (patch)
treeffcfb6d7cf2159a386445d2dcc4bd67f5b766f4c
parent7903e66a3e10e98f29fc9524c13274376bae5303 (diff)
parent10587ce6dfb479cf4930657e173b673031deaa06 (diff)
* sp/sh-windows-pwd:
  git-sh-setup: define workaround wrappers before they are used
-rw-r--r--git-sh-setup.sh41
1 files changed, 21 insertions, 20 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 7b3ae75d7a..770a86e2b7 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -218,27 +218,8 @@ clear_local_git_env() {
         unset $(git rev-parse --local-env-vars)
 }
 
-# Make sure we are in a valid repository of a vintage we understand,
-# if we require to be in a git repository.
-if test -z "$NONGIT_OK"
-then
-        GIT_DIR=$(git rev-parse --git-dir) || exit
-        if [ -z "$SUBDIRECTORY_OK" ]
-        then
-                test -z "$(git rev-parse --show-cdup)" || {
-                        exit=$?
-                        echo >&2 "You need to run this command from the toplevel of the working tree."
-                        exit $exit
-                }
-        fi
-        test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || {
-                echo >&2 "Unable to determine absolute path of git directory"
-                exit 1
-        }
-        : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
-fi
 
-# Fix some commands on Windows
+# Platform specific tweaks to work around some commands
 case $(uname -s) in
 *MINGW*)
         # Windows has its own (incompatible) sort and find
@@ -269,3 +250,23 @@ case $(uname -s) in
                 return 1
         }
 esac
+
+# Make sure we are in a valid repository of a vintage we understand,
+# if we require to be in a git repository.
+if test -z "$NONGIT_OK"
+then
+        GIT_DIR=$(git rev-parse --git-dir) || exit
+        if [ -z "$SUBDIRECTORY_OK" ]
+        then
+                test -z "$(git rev-parse --show-cdup)" || {
+                        exit=$?
+                        echo >&2 "You need to run this command from the toplevel of the working tree."
+                        exit $exit
+                }
+        fi
+        test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || {
+                echo >&2 "Unable to determine absolute path of git directory"
+                exit 1
+        }
+        : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
+fi