@matheusbsbs / matheus-bagliano / commits / 036a72d8fa
Fork 0

git-clone: check out "master" by default.

And with -n flag you can tell it not to. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Sep 26, 2005 at 17:17 UTC 036a72d8fa25d9c56c19ae4c761401a58c43b8f6
1 file changed +15 -6
git-clone.sh
+15 -6
@@ -9,7 +9,7 @@
9 unset CDPATH
10
11 usage() {
12 - echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] <repo> <dir>"
12 + echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> <dir>"
13 exit 1
14 }
15
@@ -61,10 +61,12 @@ Perhaps git-update-server-info needs to be run there?"
61 quiet=
62 use_local=no
63 local_shared=no
64 +no_checkout=
65 upload_pack=
66 while
67 case "$#,$1" in
68 0,*) break ;;
69 + *,-n) no_checkout=yes ;;
70 *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
71 *,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
72 local_shared=yes ;;
@@ -186,9 +188,16 @@ yes,yes)
188 ;;
189 esac
190
189 -# Update origin.
190 -mkdir -p "$D/.git/remotes/" &&
191 -rm -f "$D/.git/remotes/origin" &&
192 -echo >"$D/.git/remotes/origin" \
193 -"URL: $repo
191 +cd $D || exit
192 +
193 +if test -f ".git/HEAD"
194 +then
195 + mkdir -p .git/remotes || exit
196 + echo >.git/remotes/origin \
197 + "URL: $repo
198 Pull: master:origin"
199 + case "$no_checkout" in
200 + '')
201 + git checkout
202 + esac
203 +fi