From 8ac069ac0ab34e751e5f96b0244a5fec10f3e54f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 9 May 2005 22:57:58 -0700 Subject: Introduce GIT_DIR environment variable. During the mailing list discussion on renaming GIT_ environment variables, people felt that having one environment that lets the user (or Porcelain) specify both SHA1_FILE_DIRECTORY (now GIT_OBJECT_DIRECTORY) and GIT_INDEX_FILE for the default layout would be handy. This change introduces GIT_DIR environment variable, from which the defaults for GIT_INDEX_FILE and GIT_OBJECT_DIRECTORY are derived. When GIT_DIR is not defined, it defaults to ".git". GIT_INDEX_FILE defaults to "$GIT_DIR/index" and GIT_OBJECT_DIRECTORY defaults to "$GIT_DIR/objects". Special thanks for ideas and discussions go to Petr Baudis and Daniel Barkalow. Bugs are mine ;-) Signed-off-by: Junio C Hamano --- git-pull-script | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'git-pull-script') diff --git a/git-pull-script b/git-pull-script index 78d2f3df34..bd892c7bbc 100755 --- a/git-pull-script +++ b/git-pull-script @@ -3,6 +3,9 @@ merge_repo=$1 merge_name=${2:-HEAD} +: ${GIT_DIR=.git} +: ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"} + download_one () { # remote_path="$1" local_file="$2" case "$1" in @@ -25,16 +28,19 @@ download_objects () { git-local-pull -l -a "$2" "$1/" ;; *) - rsync -avz --ignore-existing "$1/objects/." \ - ${SHA_FILE_DIRECTORY:-.git/objects}/. + rsync -avz --ignore-existing \ + "$1/objects/." "$GIT_OBJECT_DIRECTORY"/. ;; esac } echo "Getting remote $merge_name" -download_one "$merge_repo/$merge_name" .git/MERGE_HEAD +download_one "$merge_repo/$merge_name" "$GIT_DIR"/MERGE_HEAD echo "Getting object database" -download_objects "$merge_repo" "$(cat .git/MERGE_HEAD)" +download_objects "$merge_repo" "$(cat "$GIT_DIR"/MERGE_HEAD)" -git-resolve-script "$(cat .git/HEAD)" "$(cat .git/MERGE_HEAD)" "$merge_repo" +git-resolve-script \ + "$(cat "$GIT_DIR"/HEAD)" \ + "$(cat "$GIT_DIR"/MERGE_HEAD)" \ + "$merge_repo" -- cgit v1.2.3