[PATCH] fetch.c: Remove redundant test of TO_SCAN in process()
[alt-git.git] / git-sh-setup.sh
blobd5bfa62dee0e85d404f955edefd2151e8c0e7aab
1 #!/bin/sh
3 # Set up GIT_DIR and GIT_OBJECT_DIRECTORY
4 # and return true if everything looks ok
6 : ${GIT_DIR=.git}
7 : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
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.
13 unset CDPATH
15 die() {
16 echo "$@" >&2
17 exit 1
20 check_clean_tree() {
21 dirty1_=`git-update-index -q --refresh` && {
22 dirty2_=`git-diff-index --name-only --cached HEAD`
23 case "$dirty2_" in '') : ;; *) (exit 1) ;; esac
24 } || {
25 echo >&2 "$dirty1_"
26 echo "$dirty2_" | sed >&2 -e 's/^/modified: /'
27 (exit 1)
31 [ -h "$GIT_DIR/HEAD" ] &&
32 [ -d "$GIT_DIR/refs" ] &&
33 [ -d "$GIT_OBJECT_DIRECTORY/00" ]