summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51cb06c)
raw | patch | inline | side by side (parent: 51cb06c)
author | Linus Torvalds <torvalds@g5.osdl.org> | |
Fri, 8 Jul 2005 22:46:33 +0000 (15:46 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Fri, 8 Jul 2005 22:46:33 +0000 (15:46 -0700) |
This silently adds the ".git" directory component if needed, so you
don't need to state it explicitly for the source. Also, it turns the
source into an absolute pathname when local, so that you can use
relative pathnames without losing sight of the source when we cd into
the destination.
don't need to state it explicitly for the source. Also, it turns the
source into an absolute pathname when local, so that you can use
relative pathnames without losing sight of the source when we cd into
the destination.
git-clone-script | patch | blob | history |
diff --git a/git-clone-script b/git-clone-script
index 4f80ade21cdd1ff82ddc2d3b9ba730a45952bc66..19697427ecfac400809eee9ba7c1625eea13f409 100755 (executable)
--- a/git-clone-script
+++ b/git-clone-script
exit 1
}
+get_repo_base() {
+ (cd "$1" && (cd .git ; pwd)) 2> /dev/null
+}
+
use_local=no
while
case "$#,$1" in
shift
done
+# Turn the source into an absolute path if
+# it is local
repo="$1"
+local=no
+if base=$(get_repo_base "$repo"); then
+ repo="$base"
+ local=yes
+fi
+
dir="$2"
mkdir "$dir" &&
D=$(
test -d "$D" || usage
# We do local magic only when the user tells us to.
-case "$use_local" in
-yes)
+case "$local,$use_local" in
+yes,yes)
( cd "$repo/objects" ) || {
repo="$repo/.git"
( cd "$repo/objects" ) || {