From: Sven Verdoolaege <skimo@xxxxxxxxxx> Signed-off-by: Sven Verdoolaege <skimo@xxxxxxxxxx> --- 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html