mirror of
https://github.com/git/git.git
synced 2024-11-06 17:23:00 +01:00
8098a178b2
This adds the counterpart of git-update-ref that lets you read and create "symbolic refs". By default it uses a symbolic link to represent ".git/HEAD -> refs/heads/master", but it can be compiled to use the textfile symbolic ref. The places that did 'readlink .git/HEAD' and 'ln -s refs/heads/blah .git/HEAD' have been converted to use new git-symbolic-ref command, so that they can deal with either implementation. Signed-off-by: Junio C Hamano <junio@twinsun.com>
25 lines
592 B
Bash
Executable file
25 lines
592 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Set up GIT_DIR and GIT_OBJECT_DIRECTORY
|
|
# and return true if everything looks ok
|
|
#
|
|
: ${GIT_DIR=.git}
|
|
: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
|
|
|
|
# Having this variable in your environment would break scripts because
|
|
# you would cause "cd" to be be taken to unexpected places. If you
|
|
# like CDPATH, define it for your interactive shell sessions without
|
|
# exporting it.
|
|
unset CDPATH
|
|
|
|
die() {
|
|
echo >&2 "$@"
|
|
exit 1
|
|
}
|
|
|
|
case "$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD 2>/dev/null)" in
|
|
refs/*) : ;;
|
|
*) false ;;
|
|
esac &&
|
|
[ -d "$GIT_DIR/refs" ] &&
|
|
[ -d "$GIT_OBJECT_DIRECTORY/00" ]
|