@@ -218,27 +218,8 @@ clear_local_git_env() {
218218 unset $( git rev-parse --local-env-vars)
219219}
220220
221- # Make sure we are in a valid repository of a vintage we understand,
222- # if we require to be in a git repository.
223- if test -z " $NONGIT_OK "
224- then
225- GIT_DIR=$( git rev-parse --git-dir) || exit
226- if [ -z " $SUBDIRECTORY_OK " ]
227- then
228- test -z " $( git rev-parse --show-cdup) " || {
229- exit=$?
230- echo >&2 " You need to run this command from the toplevel of the working tree."
231- exit $exit
232- }
233- fi
234- test -n " $GIT_DIR " && GIT_DIR=$( cd " $GIT_DIR " && pwd) || {
235- echo >&2 " Unable to determine absolute path of git directory"
236- exit 1
237- }
238- : ${GIT_OBJECT_DIRECTORY=" $GIT_DIR /objects" }
239- fi
240221
241- # Fix some commands on Windows
222+ # Platform specific tweaks to work around some commands
242223case $( uname -s) in
243224* MINGW* )
244225 # Windows has its own (incompatible) sort and find
@@ -269,3 +250,23 @@ case $(uname -s) in
269250 return 1
270251 }
271252esac
253+
254+ # Make sure we are in a valid repository of a vintage we understand,
255+ # if we require to be in a git repository.
256+ if test -z " $NONGIT_OK "
257+ then
258+ GIT_DIR=$( git rev-parse --git-dir) || exit
259+ if [ -z " $SUBDIRECTORY_OK " ]
260+ then
261+ test -z " $( git rev-parse --show-cdup) " || {
262+ exit=$?
263+ echo >&2 " You need to run this command from the toplevel of the working tree."
264+ exit $exit
265+ }
266+ fi
267+ test -n " $GIT_DIR " && GIT_DIR=$( cd " $GIT_DIR " && pwd) || {
268+ echo >&2 " Unable to determine absolute path of git directory"
269+ exit 1
270+ }
271+ : ${GIT_OBJECT_DIRECTORY=" $GIT_DIR /objects" }
272+ fi
0 commit comments