git_path(): keep "info/sparse-checkout" per work-tree
[gitweb.git] / git-sh-setup.sh
index 9447980330ce7892757f9b11fa45cfeb3e6fcb34..94a5c6d9572b1115a6304191ba0fd0b7bbce3aea 100644 (file)
@@ -330,8 +330,7 @@ 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_init () {
        GIT_DIR=$(git rev-parse --git-dir) || exit
        if [ -z "$SUBDIRECTORY_OK" ]
        then
@@ -345,7 +344,12 @@ then
                echo >&2 "Unable to determine absolute path of git directory"
                exit 1
        }
-       : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
+       : ${GIT_OBJECT_DIRECTORY="$(git rev-parse --git-path objects)"}
+}
+
+if test -z "$NONGIT_OK"
+then
+       git_dir_init
 fi
 
 peel_committish () {