summaryrefslogtreecommitdiff
path: root/git-clone-script
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-07-23 02:11:22 (GMT)
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-23 03:34:16 (GMT)
commit1cadb5a2719eef7dc4e707ee2f796c94661f4622 (patch)
tree0d04734c150528c52beb49b0f900db612b11fede /git-clone-script
parentbf0dd8a8de9c4fc90f90bdcbce5ecf7e87a35b29 (diff)
downloadgit-1cadb5a2719eef7dc4e707ee2f796c94661f4622.zip
git-1cadb5a2719eef7dc4e707ee2f796c94661f4622.tar.gz
git-1cadb5a2719eef7dc4e707ee2f796c94661f4622.tar.bz2
[PATCH] git-clone-script: store where we cloned from in .git/branches/origin
A bit more usability enhancement, while retaining Cogito compatibility (and fixing the "-u" flag). Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-clone-script')
-rwxr-xr-xgit-clone-script41
1 files changed, 23 insertions, 18 deletions
diff --git a/git-clone-script b/git-clone-script
index 88e2c1f..a808c02 100755
--- a/git-clone-script
+++ b/git-clone-script
@@ -20,12 +20,12 @@ upload_pack=
while
case "$#,$1" in
0,*) break ;;
- *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
+ *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
*,-q|*,--quiet) quiet=-q ;;
- 1,-u|*,--upload-pack) usage ;;
+ 1,-u|1,--upload-pack) usage ;;
*,-u|*,--upload-pack)
shift
- upload_pack="--exec=$2" ;;
+ upload_pack="--exec=$1" ;;
*,-*) usage ;;
*) break ;;
esac
@@ -81,23 +81,28 @@ yes,yes)
HEAD=HEAD
fi
tar Ccf "$repo" - refs $HEAD | tar Cxf "$D/.git" - || exit 1
- exit 0
- ;;
-esac
-
-case "$repo" in
-rsync://*)
- rsync $quiet -avz --ignore-existing "$repo/objects/" "$D/.git/objects/" &&
- rsync $quiet -avz --ignore-existing "$repo/refs/" "$D/.git/refs/"
- ;;
-http://*)
- echo "Somebody should add http fetch" >&2
- exit 1
;;
*)
- cd "$D" && case "$upload_pack" in
- '') git-clone-pack $quiet "$repo" ;;
- *) git-clone-pack $quiet "$upload_pack" "$repo" ;;
+ case "$repo" in
+ rsync://*)
+ rsync $quiet -avz --ignore-existing "$repo/objects/" "$D/.git/objects/" &&
+ rsync $quiet -avz --ignore-existing "$repo/refs/" "$D/.git/refs/"
+ ;;
+ http://*)
+ echo "Somebody should add http fetch" >&2
+ exit 1
+ ;;
+ *)
+ cd "$D" && case "$upload_pack" in
+ '') git-clone-pack $quiet "$repo" ;;
+ *) git-clone-pack $quiet "$upload_pack" "$repo" ;;
+ esac
+ ;;
esac
;;
esac
+
+# Update origin.
+mkdir -p "$D/.git/branches/" &&
+rm -f "$D/.git/branches/origin" &&
+echo "$repo" >"$D/.git/branches/origin"