clone: do not accept more than one -o option.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 22, 2006 at 17:28 UTC
e6489a1bdf6e20371e6cd6497918f1c1198d5f81
1 file changed
+15
-1
git-clone.sh
+15
-1
@@ -55,6 +55,7 @@ no_checkout=
55
upload_pack=
56
bare=
57
origin=origin
58
+origin_override=
59
while
60
case "$#,$1" in
61
0,*) break ;;
@@ -73,6 +74,11 @@ while
74
echo >&2 "'$2' is not suitable for a branch name"
75
exit 1
76
}
77
+ test -z "$origin_override" || {
78
+ echo >&2 "Do not give more than one -o options."
79
+ exit 1
80
+ }
81
+ origin_override=yes
82
origin="$2"; shift
83
;;
84
1,-u|1,--upload-pack) usage ;;
@@ -87,7 +93,15 @@ do
93
done
94
95
# --bare implies --no-checkout
90
-test =z "$bare" || no_checkout=yes
96
+if test yes = "$bare"
97
+then
98
+ if test yes = "$origin_override"
99
+ then
100
+ echo >&2 '--bare and -o $origin options are incompatible.'
101
+ exit 1
102
+ fi
103
+ no_checkout=yes
104
+fi
105
106
# Turn the source into an absolute path if
107
# it is local