提交 fa438a2e 编写于 作者: N Nicolas Pitre 提交者: Junio C Hamano

make git-push a bit more verbose

Currently git-push displays progress status for the local packing of
objects to send, but nothing once it starts to push it over the
connection.  Having progress status in that later case is especially
nice when pushing lots of objects over a slow network link.
Signed-off-by: NNicolas Pitre <nico@cam.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 7854e526
...@@ -10,7 +10,7 @@ SYNOPSIS ...@@ -10,7 +10,7 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git-pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty] 'git-pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty]
[--local] [--incremental] [--window=N] [--depth=N] [--local] [--incremental] [--window=N] [--depth=N] [--all-progress]
[--revs [--unpacked | --all]*] [--stdout | base-name] < object-list [--revs [--unpacked | --all]*] [--stdout | base-name] < object-list
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <signal.h> #include <signal.h>
static const char pack_usage[] = "git-pack-objects [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty] [--local] [--incremental] [--window=N] [--depth=N] [--revs [--unpacked | --all]*] [--stdout | base-name] <ref-list | <object-list]"; static const char pack_usage[] = "git-pack-objects [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty] [--local] [--incremental] [--window=N] [--depth=N] [--all-progress] [--revs [--unpacked | --all]*] [--stdout | base-name] <ref-list | <object-list]";
struct object_entry { struct object_entry {
unsigned char sha1[20]; unsigned char sha1[20];
...@@ -475,15 +475,15 @@ static void write_pack_file(void) ...@@ -475,15 +475,15 @@ static void write_pack_file(void)
unsigned long offset; unsigned long offset;
struct pack_header hdr; struct pack_header hdr;
unsigned last_percent = 999; unsigned last_percent = 999;
int do_progress = 0; int do_progress = progress;
if (!base_name) if (!base_name) {
f = sha1fd(1, "<stdout>"); f = sha1fd(1, "<stdout>");
else { do_progress >>= 1;
}
else
f = sha1create("%s-%s.%s", base_name, f = sha1create("%s-%s.%s", base_name,
sha1_to_hex(object_list_sha1), "pack"); sha1_to_hex(object_list_sha1), "pack");
do_progress = progress;
}
if (do_progress) if (do_progress)
fprintf(stderr, "Writing %d objects.\n", nr_result); fprintf(stderr, "Writing %d objects.\n", nr_result);
...@@ -1524,6 +1524,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) ...@@ -1524,6 +1524,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
progress = 1; progress = 1;
continue; continue;
} }
if (!strcmp("--all-progress", arg)) {
progress = 2;
continue;
}
if (!strcmp("--incremental", arg)) { if (!strcmp("--incremental", arg)) {
incremental = 1; incremental = 1;
continue; continue;
...@@ -1641,7 +1645,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) ...@@ -1641,7 +1645,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
else { else {
if (nr_result) if (nr_result)
prepare_pack(window, depth); prepare_pack(window, depth);
if (progress && pack_to_stdout) { if (progress == 1 && pack_to_stdout) {
/* the other end usually displays progress itself */ /* the other end usually displays progress itself */
struct itimerval v = {{0,},}; struct itimerval v = {{0,},};
setitimer(ITIMER_REAL, &v, NULL); setitimer(ITIMER_REAL, &v, NULL);
......
...@@ -29,6 +29,7 @@ static void exec_pack_objects(void) ...@@ -29,6 +29,7 @@ static void exec_pack_objects(void)
{ {
static const char *args[] = { static const char *args[] = {
"pack-objects", "pack-objects",
"--all-progress",
"--stdout", "--stdout",
NULL NULL
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册