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>
This commit is contained in:
parent
152da3dfcf
commit
036a72d8fa
21
git-clone.sh
21
git-clone.sh
@ -9,7 +9,7 @@
|
|||||||
unset CDPATH
|
unset CDPATH
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] <repo> <dir>"
|
echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> <dir>"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,10 +61,12 @@ Perhaps git-update-server-info needs to be run there?"
|
|||||||
quiet=
|
quiet=
|
||||||
use_local=no
|
use_local=no
|
||||||
local_shared=no
|
local_shared=no
|
||||||
|
no_checkout=
|
||||||
upload_pack=
|
upload_pack=
|
||||||
while
|
while
|
||||||
case "$#,$1" in
|
case "$#,$1" in
|
||||||
0,*) break ;;
|
0,*) break ;;
|
||||||
|
*,-n) no_checkout=yes ;;
|
||||||
*,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
|
*,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
|
||||||
*,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
|
*,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
|
||||||
local_shared=yes ;;
|
local_shared=yes ;;
|
||||||
@ -186,9 +188,16 @@ yes,yes)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Update origin.
|
cd $D || exit
|
||||||
mkdir -p "$D/.git/remotes/" &&
|
|
||||||
rm -f "$D/.git/remotes/origin" &&
|
if test -f ".git/HEAD"
|
||||||
echo >"$D/.git/remotes/origin" \
|
then
|
||||||
"URL: $repo
|
mkdir -p .git/remotes || exit
|
||||||
|
echo >.git/remotes/origin \
|
||||||
|
"URL: $repo
|
||||||
Pull: master:origin"
|
Pull: master:origin"
|
||||||
|
case "$no_checkout" in
|
||||||
|
'')
|
||||||
|
git checkout
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user