summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-02-20 03:01:44 +0100
committerJunio C Hamano <junkio@cox.net>2007-02-19 19:20:05 -0800
commit83a5ad61268bbfea7e0d3180528366690f951554 (patch)
tree0cf3088f4bd830efb7b0b70fce31174f4a13a4c0 /upload-pack.c
parent437b1b20df4b356c9342dac8d38849f24ef44f27 (diff)
downloadgit-83a5ad61268bbfea7e0d3180528366690f951554.tar.gz
fetch & clone: do not output progress when not on a tty
This adds the option "--no-progress" to fetch-pack and upload-pack, and makes fetch and clone pass this option when stdout is not a tty. While at documenting that option, also document --strict and --timeout options for upload-pack. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 3648aae1a7..d1be07fb9e 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -10,7 +10,7 @@
#include "revision.h"
#include "list-objects.h"
-static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=nn] <dir>";
+static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=nn] [--no-progress] <dir>";
/* bits #0..7 in revision.h, #8..10 in commit.c */
#define THEY_HAVE (1u << 11)
@@ -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");
}
@@ -660,6 +670,10 @@ int main(int argc, char **argv)
timeout = atoi(arg+10);
continue;
}
+ if (!strcmp(arg, "--no-progress")) {
+ no_progress = 1;
+ continue;
+ }
if (!strcmp(arg, "--")) {
i++;
break;