From: skimo@liacs.nl
To: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Subject: [PATCH 2/3] git-clone: rely on git-fetch for fetching for most protocols
Date: Sun, 20 May 2007 19:57:44 +0200 [thread overview]
Message-ID: <11796838662238-git-send-email-skimo@liacs.nl> (raw)
In-Reply-To: <1179683865547-git-send-email-skimo@liacs.nl>
From: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
---
git-clone.sh | 20 ++++++++++++--------
git-fetch.sh | 28 ++++++++++++++++++++++------
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index fdd354f..823b973 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -159,6 +159,11 @@ then
no_checkout=yes
use_separate_remote=
fi
+if test t = "$use_separate_remote"; then
+ separate_remote_flag="--use-separate-remote"
+else
+ separate_remote_flag="--no-separate-remote"
+fi
if test -z "$origin"
then
@@ -219,6 +224,10 @@ then
fi
fi
+# Write out $origin URL
+GIT_CONFIG="$GIT_DIR/config"
+git-config remote."$origin".url "$repo" || exit
+
rm -f "$GIT_DIR/CLONE_HEAD"
# We do local magic only when the user tells us to.
@@ -299,11 +308,9 @@ yes,yes)
fi
;;
*)
- case "$upload_pack" in
- '') git-fetch-pack --all -k $quiet $depth $no_progress "$repo";;
- *) git-fetch-pack --all -k $quiet "$upload_pack" $depth $no_progress "$repo" ;;
- esac >"$GIT_DIR/CLONE_HEAD" ||
- die "fetch-pack from '$repo' failed."
+ git-fetch --all -k $quiet ${upload_pack:+"$upload_pack"} $depth \
+ $separate_remote_flag "$origin" ||
+ die "fetch from '$repo' failed."
;;
esac
;;
@@ -387,9 +394,6 @@ then
origin_track="$remote_top/$head_points_at" &&
git-update-ref HEAD "$head_sha1" &&
- # Upstream URL
- git-config remote."$origin".url "$repo" &&
-
# Set up the mappings to track the remote branches.
git-config remote."$origin".fetch \
"+refs/heads/*:$remote_top/*" '^$' &&
diff --git a/git-fetch.sh b/git-fetch.sh
index 0e05cf1..dcb6985 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -15,6 +15,7 @@ LF='
'
IFS="$LF"
+all=
no_tags=
tags=
append=
@@ -25,6 +26,7 @@ exec=
keep=
shallow_depth=
no_progress=
+use_separate_remote=
test -t 1 || no_progress=--no-progress
quiet=
while case "$#" in 0) break ;; esac
@@ -33,6 +35,9 @@ do
-a|--a|--ap|--app|--appe|--appen|--append)
append=t
;;
+ --al|--all)
+ all=--all
+ ;;
--upl|--uplo|--uploa|--upload|--upload-|--upload-p|\
--upload-pa|--upload-pac|--upload-pack)
shift
@@ -63,6 +68,12 @@ do
-v|--verbose)
verbose=Yes
;;
+ --use-separate-remote)
+ use_separate_remote="--use-separate-remote"
+ ;;
+ --no-separate-remote)
+ use_separate_remote="--no-separate-remote"
+ ;;
-k|--k|--ke|--kee|--keep)
keep='-k -k'
;;
@@ -141,7 +152,9 @@ esac
# branches file, and just fetch those and refspecs explicitly given.
# Otherwise we do what we always did.
-reflist=$(get_remote_refs_for_fetch "$@")
+if test -z "$all"; then
+ reflist=$(get_remote_refs_for_fetch "$@")
+fi
if test "$tags"
then
taglist=`IFS=' ' &&
@@ -163,8 +176,10 @@ fi
fetch_all_at_once () {
- eval=$(echo "$1" | git-fetch--tool parse-reflist "-")
- eval "$eval"
+ if test -z "$all"; then
+ eval=$(echo "$1" | git-fetch--tool parse-reflist "-")
+ eval "$eval"
+ fi
( : subshell because we muck with IFS
IFS=" $LF"
@@ -177,7 +192,8 @@ fetch_all_at_once () {
git-bundle unbundle "$remote" $rref ||
echo failed "$remote"
else
- if test -d "$remote" &&
+ if test -z "$all" &&
+ test -d "$remote" &&
# The remote might be our alternate. With
# this optimization we will bypass fetch-pack
@@ -201,7 +217,7 @@ fetch_all_at_once () {
echo "$ls_remote_result" | \
git-fetch--tool pick-rref "$rref" "-"
else
- git-fetch-pack --thin $exec $keep $shallow_depth \
+ git-fetch-pack --thin $all $exec $keep $shallow_depth \
$quiet $no_progress "$remote" $rref ||
echo failed "$remote"
fi
@@ -212,7 +228,7 @@ fetch_all_at_once () {
test -n "$verbose" && flags="$flags -v"
test -n "$force" && flags="$flags -f"
GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION" \
- git-fetch--tool $flags native-store \
+ git-fetch--tool $flags $all $use_separate_remote native-store \
"$remote" "$remote_nick" "$refs"
)
) || exit
--
1.5.1.5.g8fc2
next prev parent reply other threads:[~2007-05-20 17:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-20 17:57 Partial removal of fetching from git-clone skimo
2007-05-20 17:57 ` [PATCH 1/3] builtin-fetch--tool: extend "native-store" for use in cloning skimo
2007-05-20 17:57 ` skimo [this message]
2007-05-20 17:57 ` [PATCH 3/3] git-clone: rely on git-fetch for non-bare fetching over http skimo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11796838662238-git-send-email-skimo@liacs.nl \
--to=skimo@liacs.nl \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).