projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix test case for some sed
[git.git]
/
git-clone.sh
diff --git
a/git-clone.sh
b/git-clone.sh
index
8e65202
..
4ed861d
100755
(executable)
--- a/
git-clone.sh
+++ b/
git-clone.sh
@@
-55,6
+55,7
@@
no_checkout=
upload_pack=
bare=
origin=origin
upload_pack=
bare=
origin=origin
+origin_override=
while
case "$#,$1" in
0,*) break ;;
while
case "$#,$1" in
0,*) break ;;
@@
-73,6
+74,11
@@
while
echo >&2 "'$2' is not suitable for a branch name"
exit 1
}
echo >&2 "'$2' is not suitable for a branch name"
exit 1
}
+ test -z "$origin_override" || {
+ echo >&2 "Do not give more than one -o options."
+ exit 1
+ }
+ origin_override=yes
origin="$2"; shift
;;
1,-u|1,--upload-pack) usage ;;
origin="$2"; shift
;;
1,-u|1,--upload-pack) usage ;;
@@
-87,7
+93,15
@@
do
done
# --bare implies --no-checkout
done
# --bare implies --no-checkout
-test =z "$bare" || no_checkout=yes
+if test yes = "$bare"
+then
+ if test yes = "$origin_override"
+ then
+ echo >&2 '--bare and -o $origin options are incompatible.'
+ exit 1
+ fi
+ no_checkout=yes
+fi
# Turn the source into an absolute path if
# it is local
# Turn the source into an absolute path if
# it is local
@@
-104,6
+118,7
@@
dir="$2"
[ -e "$dir" ] && echo "$dir already exists." && usage
mkdir -p "$dir" &&
D=$(cd "$dir" && pwd) &&
[ -e "$dir" ] && echo "$dir already exists." && usage
mkdir -p "$dir" &&
D=$(cd "$dir" && pwd) &&
+trap 'err=$?; cd ..; rm -r "$D"; exit $err' exit
case "$bare" in
yes) GIT_DIR="$D" ;;
*) GIT_DIR="$D/.git" ;;
case "$bare" in
yes) GIT_DIR="$D" ;;
*) GIT_DIR="$D/.git" ;;
@@
-139,7
+154,7
@@
yes,yes)
fi &&
rm -f "$GIT_DIR/objects/sample" &&
cd "$repo" &&
fi &&
rm -f "$GIT_DIR/objects/sample" &&
cd "$repo" &&
- find objects -depth -print | cpio -pu
a
md$l "$GIT_DIR/" || exit 1
+ find objects -depth -print | cpio -pumd$l "$GIT_DIR/" || exit 1
;;
yes)
mkdir -p "$GIT_DIR/objects/info"
;;
yes)
mkdir -p "$GIT_DIR/objects/info"
@@
-192,7
+207,13
@@
yes,yes)
fi
;;
http://*)
fi
;;
http://*)
- clone_dumb_http "$repo" "$D"
+ if test -z "@@NO_CURL@@"
+ then
+ clone_dumb_http "$repo" "$D"
+ else
+ echo >&2 "http transport not supported, rebuild Git with curl support"
+ exit 1
+ fi
;;
*)
cd "$D" && case "$upload_pack" in
;;
*)
cd "$D" && case "$upload_pack" in
@@
-209,7
+230,7
@@
esac
cd "$D" || exit
cd "$D" || exit
-if test -f "$GIT_DIR/HEAD"
+if test -f "$GIT_DIR/HEAD"
&& test -z "$bare"
then
head_points_at=`git-symbolic-ref HEAD`
case "$head_points_at" in
then
head_points_at=`git-symbolic-ref HEAD`
case "$head_points_at" in
@@
-232,6
+253,9
@@
Pull: $head_points_at:$origin" &&
case "$no_checkout" in
'')
case "$no_checkout" in
'')
- git
checkout
+ git
-read-tree -m -u -v HEAD HEAD
esac
fi
esac
fi
+
+trap - exit
+