Merge branch 'fixes'
[git/git.git] / git-sh-setup.sh
CommitLineData
b33e9666
LT
1#!/bin/sh
2#
3# Set up GIT_DIR and GIT_OBJECT_DIRECTORY
4# and return true if everything looks ok
5#
6: ${GIT_DIR=.git}
7: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
8
365527ad
JH
9# Having this variable in your environment would break scripts because
10# you would cause "cd" to be be taken to unexpected places. If you
11# like CDPATH, define it for your interactive shell sessions without
12# exporting it.
13unset CDPATH
14
b33e9666 15die() {
8098a178 16 echo >&2 "$@"
b33e9666
LT
17 exit 1
18}
19
8098a178
JH
20case "$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD 2>/dev/null)" in
21refs/*) : ;;
22*) false ;;
23esac &&
e4ad5f09 24[ -d "$GIT_DIR/refs" ] &&
b33e9666 25[ -d "$GIT_OBJECT_DIRECTORY/00" ]