summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c69f405)
raw | patch | inline | side by side (parent: c69f405)
author | Junio C Hamano <junkio@cox.net> | |
Thu, 10 May 2007 00:11:15 +0000 (17:11 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 10 May 2007 20:26:14 +0000 (13:26 -0700) |
If you have /home/me/git symlink pointing at /pub/git/mine,
trying to clone from /pub/git/his/ using relative path would not
work as expected:
$ cd /home/me
$ cd git
$ ls ../
his mine
$ git clone -l -s -n ../his/stuff.git
This is because "cd ../his/stuff.git" done inside git-clone to
check if the repository is local is confused by $PWD, which is
set to /home/me, and tries to go to /home/his/stuff.git which is
different from /pub/git/his/stuff.git.
We could probably say "set -P" (or "cd -P") instead, if we know
the shell is POSIX, but the way the patch is coded is probably
more portable.
[jc: this is updated with Andy Whitcroft's improvements]
Signed-off-by: Junio C Hamano <junkio@cox.net>
trying to clone from /pub/git/his/ using relative path would not
work as expected:
$ cd /home/me
$ cd git
$ ls ../
his mine
$ git clone -l -s -n ../his/stuff.git
This is because "cd ../his/stuff.git" done inside git-clone to
check if the repository is local is confused by $PWD, which is
set to /home/me, and tries to go to /home/his/stuff.git which is
different from /pub/git/his/stuff.git.
We could probably say "set -P" (or "cd -P") instead, if we know
the shell is POSIX, but the way the patch is coded is probably
more portable.
[jc: this is updated with Andy Whitcroft's improvements]
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-clone.sh | patch | blob | history |
diff --git a/git-clone.sh b/git-clone.sh
index cad5c0c088fa997c6f8f36c44e8888a5cb19515e..70374aaaf0f766588739053becc36831381d4f35 100755 (executable)
--- a/git-clone.sh
+++ b/git-clone.sh
}
get_repo_base() {
- (cd "$1" && (cd .git ; pwd)) 2> /dev/null
+ (
+ cd "`/bin/pwd`" &&
+ cd "$1" &&
+ {
+ cd .git 2>/dev/null
+ pwd
+ }
+ )
}
if [ -n "$GIT_SSL_NO_VERIFY" ]; then