Merge branches 'jc/clone', 'md/env' and 'mo/path'
authorJunio C Hamano <junkio@cox.net>
Wed, 25 Jan 2006 08:28:18 +0000 (00:28 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 25 Jan 2006 08:28:18 +0000 (00:28 -0800)
Documentation/fetch-options.txt
connect.c
git-fetch.sh
git-ls-remote.sh

index e624d3d..8323756 100644 (file)
@@ -3,6 +3,13 @@
        existing contents of `.git/FETCH_HEAD`.  Without this
        option old data in `.git/FETCH_HEAD` will be overwritten.
 
+--upload-pack <upload-pack>::
+-u <upload-pack>::
+        When given, and the repository to fetch from is handled
+        by 'git-fetch-pack', '--exec=<upload-pack>' is passed to
+        the command to specify non-default path for the command
+        run on the other end.
+
 -f, \--force::
        When `git-fetch` is used with `<rbranch>:<lbranch>`
        refspec, it refuses to update the local branch
index d6f4e4c..e1c04e1 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -644,10 +644,16 @@ int git_connect(int fd[2], char *url, const char *prog)
                                ssh_basename++;
                        execlp(ssh, ssh_basename, host, command, NULL);
                }
-               else
+               else {
+                       unsetenv(ALTERNATE_DB_ENVIRONMENT);
+                       unsetenv(DB_ENVIRONMENT);
+                       unsetenv(GIT_DIR_ENVIRONMENT);
+                       unsetenv(GRAFT_ENVIRONMENT);
+                       unsetenv(INDEX_ENVIRONMENT);
                        execlp("sh", "sh", "-c", command, NULL);
+               }
                die("exec failed");
-       }               
+       }
        fd[0] = pipefd[0][0];
        fd[1] = pipefd[1][1];
        close(pipefd[0][1]);
index 4a0cb32..6730346 100755 (executable)
@@ -17,12 +17,20 @@ append=
 force=
 verbose=
 update_head_ok=
+exec=
+upload_pack=
 while case "$#" in 0) break ;; esac
 do
        case "$1" in
        -a|--a|--ap|--app|--appe|--appen|--append)
                append=t
                ;;
+       -u|--u|--up|--upl|--uploa|--upload|--upload-|--upload-p|--upload-pa|\
+       --upload-pac|--upload-pack)
+               shift
+               exec="--exec=$1" 
+               upload_pack="-u $1"
+               ;;
        -f|--f|--fo|--for|--forc|--force)
                force=t
                ;;
@@ -196,7 +204,7 @@ reflist=$(get_remote_refs_for_fetch "$@")
 if test "$tags"
 then
        taglist=$(IFS=" " &&
-                 git-ls-remote --tags "$remote" |
+                 git-ls-remote $upload_pack --tags "$remote" |
                  while read sha1 name
                  do
                        case "$name" in
@@ -312,7 +320,7 @@ fetch_main () {
     ( : subshell because we muck with IFS
       IFS="    $LF"
       (
-         git-fetch-pack $keep "$remote" $rref || echo failed "$remote"
+         git-fetch-pack $exec $keep "$remote" $rref || echo failed "$remote"
       ) |
       while read sha1 remote_name
       do
@@ -361,7 +369,7 @@ fetch_main "$reflist"
 case "$no_tags$tags" in
 '')
        taglist=$(IFS=" " &&
-       git-ls-remote --tags "$remote" |
+       git-ls-remote $upload_pack --tags "$remote" |
        sed -ne 's|^\([0-9a-f]*\)[      ]\(refs/tags/.*\)^{}$|\1 \2|p' |
        while read sha1 name
        do
index f699268..2c9a588 100755 (executable)
@@ -2,7 +2,8 @@
 #
 
 usage () {
-    echo >&2 "usage: $0 [--heads] [--tags] <repository> <refs>..."
+    echo >&2 "usage: $0 [--heads] [--tags] [-u|--upload-pack <upload-pack>]"
+    echo >&2 "          <repository> <refs>..."
     exit 1;
 }
 
@@ -11,6 +12,7 @@ die () {
     exit 1
 }
 
+exec=
 while case "$#" in 0) break;; esac
 do
   case "$1" in
@@ -18,6 +20,11 @@ do
   heads=heads; shift ;;
   -t|--t|--ta|--tag|--tags)
   tags=tags; shift ;;
+  -u|--u|--up|--upl|--uploa|--upload|--upload-|--upload-p|--upload-pa|\
+  --upload-pac|--upload-pack)
+       shift
+       exec="--exec=$1"
+       shift;;
   --)
   shift; break ;;
   -*)
@@ -66,7 +73,7 @@ rsync://* )
        ;;
 
 * )
-       git-peek-remote "$peek_repo" ||
+       git-peek-remote $exec "$peek_repo" ||
                echo "failed    slurping"
        ;;
 esac |