From 1ddf5efc66d92282e3c654ebf263538a0df2ac24 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 23 Nov 2009 22:07:42 -0500 Subject: [PATCH 1/3] prune-packed: only show progress when stderr is a tty This matches the behavior of other git programs, and helps keep cruft out of things like cron job output. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin-prune-packed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c index be99eb0ac..f9463deec 100644 --- a/builtin-prune-packed.c +++ b/builtin-prune-packed.c @@ -71,7 +71,7 @@ void prune_packed_objects(int opts) int cmd_prune_packed(int argc, const char **argv, const char *prefix) { - int opts = VERBOSE; + int opts = isatty(2) ? VERBOSE : 0; const struct option prune_packed_options[] = { OPT_BIT('n', "dry-run", &opts, "dry run", DRY_RUN), OPT_NEGBIT('q', "quiet", &opts, "be quiet", VERBOSE), From 0b624b4ceee63ce45135cdbb80f2807c20b48646 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Sun, 22 Nov 2009 23:09:12 -0800 Subject: [PATCH 2/3] instaweb: restart server if already running Running 'git instaweb' when an instaweb server is already running will fail (at least when the port is the same) and overwrite the pid file used to track the currently running server. This turns out to be especially annoying when the user tries to stop the previously running server with 'git instaweb --stop' and is instead greeted with an error message because the pid file has been destroyed. Instead of allowing a user to start two instaweb servers, stop the currently running server first and then start the new one. This should be fine because it was never really possible to start two instaweb servers in the first place due to the pid file issue outlined above. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- git-instaweb.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/git-instaweb.sh b/git-instaweb.sh index d96eddbe5..80a7f74fe 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -73,6 +73,11 @@ resolve_full_httpd () { } start_httpd () { + if test -f "$fqgitdir/pid"; then + say "Instance already running. Restarting..." + stop_httpd + fi + # here $httpd should have a meaningful value resolve_full_httpd From 4f366275189c06ec26c01ee5ace2f3831b2aa46a Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Mon, 23 Nov 2009 12:43:50 -0500 Subject: [PATCH 3/3] pack-objects: split implications of --all-progress from progress activation Currently the --all-progress flag is used to use force progress display during the writing object phase even if output goes to stdout which is primarily the case during a push operation. This has the unfortunate side effect of forcing progress display even if stderr is not a terminal. Let's introduce the --all-progress-implied argument which has the same intent except for actually forcing the activation of any progress display. With this, progress display will be automatically inhibited whenever stderr is not a terminal, or full progress display will be included otherwise. This should let people use 'git push' within a cron job without filling their logs with useless percentage displays. Signed-off-by: Nicolas Pitre Tested-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/git-pack-objects.txt | 12 +++++++++--- builtin-pack-objects.c | 9 +++++++++ builtin-send-pack.c | 2 +- bundle.c | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt index 2e4992970..f54d433d3 100644 --- a/Documentation/git-pack-objects.txt +++ b/Documentation/git-pack-objects.txt @@ -9,8 +9,9 @@ git-pack-objects - Create a packed archive of objects SYNOPSIS -------- [verse] -'git pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty] - [--local] [--incremental] [--window=N] [--depth=N] [--all-progress] +'git pack-objects' [-q | --progress | --all-progress] [--all-progress-implied] + [--no-reuse-delta] [--delta-base-offset] [--non-empty] + [--local] [--incremental] [--window=N] [--depth=N] [--revs [--unpacked | --all]*] [--stdout | base-name] [--keep-true-parents] < object-list @@ -137,7 +138,7 @@ base-name:: --all-progress:: When --stdout is specified then progress report is - displayed during the object count and deltification phases + displayed during the object count and compression phases but inhibited during the write-out phase. The reason is that in some cases the output stream is directly linked to another command which may wish to display progress @@ -146,6 +147,11 @@ base-name:: report for the write-out phase as well even if --stdout is used. +--all-progress-implied:: + This is used to imply --all-progress whenever progress display + is activated. Unlike --all-progress this flag doesn't actually + force any progress display by itself. + -q:: This flag makes the command not to report its progress on the standard error stream. diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 02f9246cd..793820217 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -24,6 +24,7 @@ static const char pack_usage[] = "git pack-objects [{ -q | --progress | --all-progress }]\n" + " [--all-progress-implied]\n" " [--max-pack-size=N] [--local] [--incremental]\n" " [--window=N] [--window-memory=N] [--depth=N]\n" " [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset]\n" @@ -2122,6 +2123,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) { int use_internal_rev_list = 0; int thin = 0; + int all_progress_implied = 0; uint32_t i; const char **rp_av; int rp_ac_alloc = 64; @@ -2221,6 +2223,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) progress = 2; continue; } + if (!strcmp("--all-progress-implied", arg)) { + all_progress_implied = 1; + continue; + } if (!strcmp("-q", arg)) { progress = 0; continue; @@ -2329,6 +2335,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) delta_search_threads = online_cpus(); #endif + if (progress && all_progress_implied) + progress = 2; + prepare_packed_git(); if (progress) diff --git a/builtin-send-pack.c b/builtin-send-pack.c index 37e528e28..2c4eaae68 100644 --- a/builtin-send-pack.c +++ b/builtin-send-pack.c @@ -38,7 +38,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext */ const char *argv[] = { "pack-objects", - "--all-progress", + "--all-progress-implied", "--revs", "--stdout", NULL, diff --git a/bundle.c b/bundle.c index df95e151e..717a712e9 100644 --- a/bundle.c +++ b/bundle.c @@ -351,7 +351,7 @@ int create_bundle(struct bundle_header *header, const char *path, /* write pack */ argv_pack[0] = "pack-objects"; - argv_pack[1] = "--all-progress"; + argv_pack[1] = "--all-progress-implied"; argv_pack[2] = "--stdout"; argv_pack[3] = "--thin"; argv_pack[4] = NULL;