aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-03-04 17:31:21 -0800
committerJunio C Hamano <junkio@cox.net>2007-03-04 17:31:21 -0800
commit3ddad98b74924d76116d05e7601ab1e163d68500 (patch)
tree203307192a8a98545f0cb892ed477766f622c9cf
parente6f95113431f7e69263bc3d075c0a7715ce587e3 (diff)
parentb0e908977ebe43b49badad7fe34bf259dd5d263b (diff)
downloadgit-3ddad98b74924d76116d05e7601ab1e163d68500.tar.gz
git-3ddad98b74924d76116d05e7601ab1e163d68500.tar.xz
Merge branch 'js/fetch-progress' (early part)
* 'js/fetch-progress' (early part): Fixup no-progress for fetch & clone fetch & clone: do not output progress when not on a tty Conflicts: git-fetch.sh
-rw-r--r--Documentation/git-fetch-pack.txt5
-rw-r--r--Documentation/git-upload-pack.txt9
-rw-r--r--fetch-pack.c12
-rwxr-xr-xgit-clone.sh8
-rwxr-xr-xgit-fetch.sh5
-rw-r--r--upload-pack.c22
6 files changed, 47 insertions, 14 deletions
diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt
index 105d76b0b..a99a5b321 100644
--- a/Documentation/git-fetch-pack.txt
+++ b/Documentation/git-fetch-pack.txt
@@ -8,7 +8,7 @@ git-fetch-pack - Receive missing objects from another repository
SYNOPSIS
--------
-'git-fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [-v] [<host>:]<directory> [<refs>...]
+'git-fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]
DESCRIPTION
-----------
@@ -63,6 +63,9 @@ OPTIONS
\--depth=<n>::
Limit fetching to ancestor-chains not longer than n.
+\--no-progress::
+ Do not show the progress.
+
\-v::
Run verbosely.
diff --git a/Documentation/git-upload-pack.txt b/Documentation/git-upload-pack.txt
index 9da062d5c..fd6519299 100644
--- a/Documentation/git-upload-pack.txt
+++ b/Documentation/git-upload-pack.txt
@@ -8,7 +8,7 @@ git-upload-pack - Send objects packed back to git-fetch-pack
SYNOPSIS
--------
-'git-upload-pack' <directory>
+'git-upload-pack' [--strict] [--timeout=<n>] <directory>
DESCRIPTION
-----------
@@ -23,6 +23,13 @@ repository. For push operations, see 'git-send-pack'.
OPTIONS
-------
+
+\--strict::
+ Do not try <directory>/.git/ if <directory> is no git directory.
+
+\--timeout=<n>::
+ Interrupt transfer after <n> seconds of inactivity.
+
<directory>::
The repository to sync from.
diff --git a/fetch-pack.c b/fetch-pack.c
index 41bdd27b8..06f4aeced 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -15,8 +15,9 @@ static int quiet;
static int verbose;
static int fetch_all;
static int depth;
+static int no_progress;
static const char fetch_pack_usage[] =
-"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [-v] [<host>:]<directory> [<refs>...]";
+"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
static const char *uploadpack = "git-upload-pack";
#define COMPLETE (1U << 0)
@@ -173,12 +174,13 @@ static int find_common(int fd[2], unsigned char *result_sha1,
}
if (!fetching)
- packet_write(fd[1], "want %s%s%s%s%s%s\n",
+ packet_write(fd[1], "want %s%s%s%s%s%s%s\n",
sha1_to_hex(remote),
(multi_ack ? " multi_ack" : ""),
(use_sideband == 2 ? " side-band-64k" : ""),
(use_sideband == 1 ? " side-band" : ""),
(use_thin_pack ? " thin-pack" : ""),
+ (no_progress ? " no-progress" : ""),
" ofs-delta");
else
packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
@@ -521,7 +523,7 @@ static int get_pack(int xd[2])
if (do_keep) {
*av++ = "index-pack";
*av++ = "--stdin";
- if (!quiet)
+ if (!quiet && !no_progress)
*av++ = "-v";
if (use_thin_pack)
*av++ = "--fix-thin";
@@ -718,6 +720,10 @@ int main(int argc, char **argv)
st.st_mtime = 0;
continue;
}
+ if (!strcmp("--no-progress", arg)) {
+ no_progress = 1;
+ continue;
+ }
usage(fetch_pack_usage);
}
dest = arg;
diff --git a/git-clone.sh b/git-clone.sh
index 1bd54ded3..de5198358 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -79,6 +79,8 @@ origin=
origin_override=
use_separate_remote=t
depth=
+no_progress=
+test -t 1 || no_progress=--no-progress
while
case "$#,$1" in
0,*) break ;;
@@ -290,8 +292,8 @@ yes,yes)
;;
*)
case "$upload_pack" in
- '') git-fetch-pack --all -k $quiet $depth "$repo" ;;
- *) git-fetch-pack --all -k $quiet "$upload_pack" $depth "$repo" ;;
+ '') 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."
;;
@@ -393,7 +395,7 @@ then
case "$no_checkout" in
'')
- test "z$quiet" = z && v=-v || v=
+ test "z$quiet" = z -a "z$no_progress" = z && v=-v || v=
git-read-tree -m -u $v HEAD HEAD
esac
fi
diff --git a/git-fetch.sh b/git-fetch.sh
index 59bee5db0..5ae0d28cc 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -24,6 +24,8 @@ update_head_ok=
exec=
keep=
shallow_depth=
+no_progress=
+test -t 1 || no_progress=--no-progress
while case "$#" in 0) break ;; esac
do
case "$1" in
@@ -392,7 +394,8 @@ fetch_main () {
git-bundle unbundle "$remote" $rref ||
echo failed "$remote"
else
- git-fetch-pack --thin $exec $keep $shallow_depth "$remote" $rref ||
+ git-fetch-pack --thin $exec $keep $shallow_depth $no_progress \
+ "$remote" $rref ||
echo failed "$remote"
fi
) |
diff --git a/upload-pack.c b/upload-pack.c
index 804bbb6c9..498bf50eb 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -26,7 +26,7 @@ static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=n
static unsigned long oldest_have;
static int multi_ack, nr_our_refs;
-static int use_thin_pack, use_ofs_delta;
+static int use_thin_pack, use_ofs_delta, no_progress;
static struct object_array have_obj;
static struct object_array want_obj;
static unsigned int timeout;
@@ -164,6 +164,9 @@ static void create_pack_file(void)
die("git-upload-pack: unable to fork git-pack-objects");
}
if (!pid_pack_objects) {
+ const char *argv[10];
+ int i = 0;
+
dup2(lp_pipe[0], 0);
dup2(pu_pipe[1], 1);
dup2(pe_pipe[1], 2);
@@ -174,9 +177,16 @@ static void create_pack_file(void)
close(pu_pipe[1]);
close(pe_pipe[0]);
close(pe_pipe[1]);
- execl_git_cmd("pack-objects", "--stdout", "--progress",
- use_ofs_delta ? "--delta-base-offset" : NULL,
- NULL);
+
+ argv[i++] = "pack-objects";
+ argv[i++] = "--stdout";
+ if (!no_progress)
+ argv[i++] = "--progress";
+ if (use_ofs_delta)
+ argv[i++] = "--delta-base-offset";
+ argv[i++] = NULL;
+
+ execv_git_cmd(argv);
kill(pid_rev_list, SIGKILL);
die("git-upload-pack: unable to exec git-pack-objects");
}
@@ -537,6 +547,8 @@ static void receive_needs(void)
use_sideband = LARGE_PACKET_MAX;
else if (strstr(line+45, "side-band"))
use_sideband = DEFAULT_PACKET_MAX;
+ if (strstr(line+45, "no-progress"))
+ no_progress = 1;
/* We have sent all our refs already, and the other end
* should have chosen out of them; otherwise they are
@@ -605,7 +617,7 @@ static void receive_needs(void)
static int send_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
{
static const char *capabilities = "multi_ack thin-pack side-band"
- " side-band-64k ofs-delta shallow";
+ " side-band-64k ofs-delta shallow no-progress";
struct object *o = parse_object(sha1);
if (!o)