summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0476786)
raw | patch | inline | side by side (parent: 0476786)
author | David Kastrup <dak@gnu.org> | |
Sat, 11 Aug 2007 13:36:28 +0000 (15:36 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 14 Aug 2007 04:19:48 +0000 (21:19 -0700) |
Quite a few of the scripts are rather careless about using GIT_DIR
while changing directories.
Some try their hands (with different likelihood of success) in making
GIT_DIR absolute.
This patch lets git-sh-setup.sh cater for absolute directories (in a
way that should work reliably also with non-Unix path names) and
removes the respective kludges in git-filter-branch.sh and
git-instaweb.sh.
Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
while changing directories.
Some try their hands (with different likelihood of success) in making
GIT_DIR absolute.
This patch lets git-sh-setup.sh cater for absolute directories (in a
way that should work reliably also with non-Unix path names) and
removes the respective kludges in git-filter-branch.sh and
git-instaweb.sh.
Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-filter-branch.sh | patch | blob | history | |
git-instaweb.sh | patch | blob | history | |
git-sh-setup.sh | patch | blob | history |
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index b5fa44920d40d3144567509a6922a07bb87977ae..c42e4512cfb529223f196abd546a988b9809b0ef 100755 (executable)
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
esac
done < "$tempdir"/backup-refs
-case "$GIT_DIR" in
-/*)
- ;;
-*)
- GIT_DIR="$(pwd)/../../$GIT_DIR"
- ;;
-esac
export GIT_DIR GIT_WORK_TREE=.
# These refs should be updated if their heads were rewritten
diff --git a/git-instaweb.sh b/git-instaweb.sh
index cbc7418e3501b37a701a5177157733d97b405376..b79c6b6a42069168daf4e4ff191d08835f96e40f 100755 (executable)
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
. git-sh-setup
-case "$GIT_DIR" in
-/*)
- fqgitdir="$GIT_DIR" ;;
-*)
- fqgitdir="$PWD/$GIT_DIR" ;;
-esac
-
+fqgitdir="$GIT_DIR"
local="`git config --bool --get instaweb.local`"
httpd="`git config --get instaweb.httpd`"
browser="`git config --get instaweb.browser`"
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 8cbd153b62265b8fbbd2dd73fc4089fa26dbc669..185c5c6c95df389e0d7f39f47feeabbe67124e80 100755 (executable)
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
exit $exit
}
else
- GIT_DIR=$(git rev-parse --git-dir) || exit
+ GIT_DIR=$(git rev-parse --git-dir) || {
+ exit=$?
+ echo >&2 "Failed to find a valid git directory."
+ exit $exit
+ }
fi
+
+test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || {
+ echo >&2 "Unable to determine absolute path of git directory"
+ exit 1
+}
+
: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}