From: Oleg Andreev <oleganza@gmail.com>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] add --progress to git-gc and git-repack
Date: Tue, 27 Sep 2011 22:32:45 +0200 [thread overview]
Message-ID: <9F9C752E-6B3C-401B-9E01-8B1F5544A82F@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6019 bytes --]
Hello,
Here are two patches adding --progress option to git-gc and git-repack.
You can also pull them from here: git://github.com/oleganza/git.git
Just in case, if some spaces get corrupted, you can find the patches in the attachment.
From 1f261e13e72770deabd77087e354f304be850efc Mon Sep 17 00:00:00 2001
From: Oleg Andreev <oleganza@gmail.com>
Date: Tue, 27 Sep 2011 08:24:25 +0200
Subject: [PATCH 1/2] git-repack: pass --progress down to git-pack-objects
---
Documentation/git-repack.txt | 4 ++++
git-repack.sh | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 40af321..1c22076 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -74,6 +74,10 @@ other objects in that pack they already have locally.
Pass the `-q` option to 'git pack-objects'. See
linkgit:git-pack-objects[1].
+--progress::
+ Pass the `--progress` option to 'git pack-objects'. See
+ linkgit:git-pack-objects[1].
+
-n::
Do not update the server information with
'git update-server-info'. This option skips
diff --git a/git-repack.sh b/git-repack.sh
index 624feec..b86d60e 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -14,6 +14,7 @@ f pass --no-reuse-delta to git-pack-objects
F pass --no-reuse-object to git-pack-objects
n do not run git-update-server-info
q,quiet be quiet
+progress pass --progress to git-pack-objects
l pass --local to git-pack-objects
Packing constraints
window= size of the window used for delta compression
@@ -25,7 +26,7 @@ SUBDIRECTORY_OK='Yes'
. git-sh-setup
no_update_info= all_into_one= remove_redundant= unpack_unreachable=
-local= no_reuse= extra=
+local= no_reuse= extra= progress=
while test $# != 0
do
case "$1" in
@@ -35,6 +36,7 @@ do
unpack_unreachable=--unpack-unreachable ;;
-d) remove_redundant=t ;;
-q) GIT_QUIET=t ;;
+ --progress) progress=--progress ;;
-f) no_reuse=--no-reuse-delta ;;
-F) no_reuse=--no-reuse-object ;;
-l) local=--local ;;
@@ -85,7 +87,7 @@ esac
mkdir -p "$PACKDIR" || exit
args="$args $local ${GIT_QUIET:+-q} $no_reuse$extra"
-names=$(git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog $args </dev/null "$PACKTMP") ||
+names=$(git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog $progress $args </dev/null "$PACKTMP") ||
exit 1
if [ -z "$names" ]; then
say Nothing new to pack.
--
1.7.6.1
From 01437ba2785a23221f246c37f6ba317274bfa6f4 Mon Sep 17 00:00:00 2001
From: Oleg Andreev <oleganza@gmail.com>
Date: Tue, 27 Sep 2011 08:38:20 +0200
Subject: [PATCH 2/2] git-gc: pass --progress down to git-repack
---
Documentation/git-gc.txt | 11 +++++++++--
builtin/gc.c | 7 ++++++-
contrib/examples/git-gc.sh | 6 +++++-
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 815afcb..b65fa3e 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -9,7 +9,7 @@ git-gc - Cleanup unnecessary files and optimize the local repository
SYNOPSIS
--------
[verse]
-'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune]
+'git gc' [--aggressive] [--auto] [--quiet] [--progress] [--prune=<date> | --no-prune]
DESCRIPTION
-----------
@@ -69,7 +69,14 @@ automatic consolidation of packs.
Do not prune any loose objects.
--quiet::
- Suppress all progress reports.
+ Suppress all progress reports. Progress is not reported to
+ the standard error stream.
+
+--progress::
+ Progress status is reported on the standard error stream
+ by default when it is attached to a terminal, unless -q
+ is specified. This flag forces progress status even if the
+ standard error stream is not directed to a terminal.
Configuration
-------------
diff --git a/builtin/gc.c b/builtin/gc.c
index 0498094..e146985 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -28,7 +28,7 @@ static int gc_auto_threshold = 6700;
static int gc_auto_pack_limit = 50;
static const char *prune_expire = "2.weeks.ago";
-#define MAX_ADD 10
+#define MAX_ADD 11
static const char *argv_pack_refs[] = {"pack-refs", "--all", "--prune", NULL};
static const char *argv_reflog[] = {"reflog", "expire", "--all", NULL};
static const char *argv_repack[MAX_ADD] = {"repack", "-d", "-l", NULL};
@@ -177,10 +177,12 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
int aggressive = 0;
int auto_gc = 0;
int quiet = 0;
+ int progress = 0;
char buf[80];
struct option builtin_gc_options[] = {
OPT__QUIET(&quiet, "suppress progress reporting"),
+ OPT_BOOLEAN(0, "progress", &progress, "force progress reporting"),
{ OPTION_STRING, 0, "prune", &prune_expire, "date",
"prune unreferenced objects",
PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire },
@@ -213,6 +215,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
if (quiet)
append_option(argv_repack, "-q", MAX_ADD);
+ if (progress)
+ append_option(argv_repack, "--progress", MAX_ADD);
+
if (auto_gc) {
/*
* Auto-gc should be least intrusive as possible.
diff --git a/contrib/examples/git-gc.sh b/contrib/examples/git-gc.sh
index 1597e9f..52ea808 100755
--- a/contrib/examples/git-gc.sh
+++ b/contrib/examples/git-gc.sh
@@ -9,12 +9,16 @@ SUBDIRECTORY_OK=Yes
. git-sh-setup
no_prune=:
+progress=
while test $# != 0
do
case "$1" in
--prune)
no_prune=
;;
+ --progress)
+ progress=--progress
+ ;;
--)
usage
;;
@@ -32,6 +36,6 @@ esac
test "true" != "$pack_refs" ||
git pack-refs --prune &&
git reflog expire --all &&
-git-repack -a -d -l &&
+git-repack -a -d -l $progress &&
$no_prune git prune &&
git rerere gc || exit
--
1.7.6.1
[-- Attachment #2: 0001-git-repack-pass-progress-down-to-git-pack-objects.patch --]
[-- Type: application/octet-stream, Size: 2388 bytes --]
From 1f261e13e72770deabd77087e354f304be850efc Mon Sep 17 00:00:00 2001
From: Oleg Andreev <oleganza@gmail.com>
Date: Tue, 27 Sep 2011 08:24:25 +0200
Subject: [PATCH 1/2] git-repack: pass --progress down to git-pack-objects
---
Documentation/git-repack.txt | 4 ++++
git-repack.sh | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 40af321..1c22076 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -74,6 +74,10 @@ other objects in that pack they already have locally.
Pass the `-q` option to 'git pack-objects'. See
linkgit:git-pack-objects[1].
+--progress::
+ Pass the `--progress` option to 'git pack-objects'. See
+ linkgit:git-pack-objects[1].
+
-n::
Do not update the server information with
'git update-server-info'. This option skips
diff --git a/git-repack.sh b/git-repack.sh
index 624feec..b86d60e 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -14,6 +14,7 @@ f pass --no-reuse-delta to git-pack-objects
F pass --no-reuse-object to git-pack-objects
n do not run git-update-server-info
q,quiet be quiet
+progress pass --progress to git-pack-objects
l pass --local to git-pack-objects
Packing constraints
window= size of the window used for delta compression
@@ -25,7 +26,7 @@ SUBDIRECTORY_OK='Yes'
. git-sh-setup
no_update_info= all_into_one= remove_redundant= unpack_unreachable=
-local= no_reuse= extra=
+local= no_reuse= extra= progress=
while test $# != 0
do
case "$1" in
@@ -35,6 +36,7 @@ do
unpack_unreachable=--unpack-unreachable ;;
-d) remove_redundant=t ;;
-q) GIT_QUIET=t ;;
+ --progress) progress=--progress ;;
-f) no_reuse=--no-reuse-delta ;;
-F) no_reuse=--no-reuse-object ;;
-l) local=--local ;;
@@ -85,7 +87,7 @@ esac
mkdir -p "$PACKDIR" || exit
args="$args $local ${GIT_QUIET:+-q} $no_reuse$extra"
-names=$(git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog $args </dev/null "$PACKTMP") ||
+names=$(git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog $progress $args </dev/null "$PACKTMP") ||
exit 1
if [ -z "$names" ]; then
say Nothing new to pack.
--
1.7.6.1
[-- Attachment #3: 0002-git-gc-pass-progress-down-to-git-repack.patch --]
[-- Type: application/octet-stream, Size: 3372 bytes --]
From 01437ba2785a23221f246c37f6ba317274bfa6f4 Mon Sep 17 00:00:00 2001
From: Oleg Andreev <oleganza@gmail.com>
Date: Tue, 27 Sep 2011 08:38:20 +0200
Subject: [PATCH 2/2] git-gc: pass --progress down to git-repack
---
Documentation/git-gc.txt | 11 +++++++++--
builtin/gc.c | 7 ++++++-
contrib/examples/git-gc.sh | 6 +++++-
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 815afcb..b65fa3e 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -9,7 +9,7 @@ git-gc - Cleanup unnecessary files and optimize the local repository
SYNOPSIS
--------
[verse]
-'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune]
+'git gc' [--aggressive] [--auto] [--quiet] [--progress] [--prune=<date> | --no-prune]
DESCRIPTION
-----------
@@ -69,7 +69,14 @@ automatic consolidation of packs.
Do not prune any loose objects.
--quiet::
- Suppress all progress reports.
+ Suppress all progress reports. Progress is not reported to
+ the standard error stream.
+
+--progress::
+ Progress status is reported on the standard error stream
+ by default when it is attached to a terminal, unless -q
+ is specified. This flag forces progress status even if the
+ standard error stream is not directed to a terminal.
Configuration
-------------
diff --git a/builtin/gc.c b/builtin/gc.c
index 0498094..e146985 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -28,7 +28,7 @@ static int gc_auto_threshold = 6700;
static int gc_auto_pack_limit = 50;
static const char *prune_expire = "2.weeks.ago";
-#define MAX_ADD 10
+#define MAX_ADD 11
static const char *argv_pack_refs[] = {"pack-refs", "--all", "--prune", NULL};
static const char *argv_reflog[] = {"reflog", "expire", "--all", NULL};
static const char *argv_repack[MAX_ADD] = {"repack", "-d", "-l", NULL};
@@ -177,10 +177,12 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
int aggressive = 0;
int auto_gc = 0;
int quiet = 0;
+ int progress = 0;
char buf[80];
struct option builtin_gc_options[] = {
OPT__QUIET(&quiet, "suppress progress reporting"),
+ OPT_BOOLEAN(0, "progress", &progress, "force progress reporting"),
{ OPTION_STRING, 0, "prune", &prune_expire, "date",
"prune unreferenced objects",
PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire },
@@ -213,6 +215,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
if (quiet)
append_option(argv_repack, "-q", MAX_ADD);
+ if (progress)
+ append_option(argv_repack, "--progress", MAX_ADD);
+
if (auto_gc) {
/*
* Auto-gc should be least intrusive as possible.
diff --git a/contrib/examples/git-gc.sh b/contrib/examples/git-gc.sh
index 1597e9f..52ea808 100755
--- a/contrib/examples/git-gc.sh
+++ b/contrib/examples/git-gc.sh
@@ -9,12 +9,16 @@ SUBDIRECTORY_OK=Yes
. git-sh-setup
no_prune=:
+progress=
while test $# != 0
do
case "$1" in
--prune)
no_prune=
;;
+ --progress)
+ progress=--progress
+ ;;
--)
usage
;;
@@ -32,6 +36,6 @@ esac
test "true" != "$pack_refs" ||
git pack-refs --prune &&
git reflog expire --all &&
-git-repack -a -d -l &&
+git-repack -a -d -l $progress &&
$no_prune git prune &&
git rerere gc || exit
--
1.7.6.1
[-- Attachment #4: Type: text/plain, Size: 2 bytes --]
next reply other threads:[~2011-09-27 20:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-27 20:32 Oleg Andreev [this message]
2011-09-27 21:29 ` [PATCH] add --progress to git-gc and git-repack Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9F9C752E-6B3C-401B-9E01-8B1F5544A82F@gmail.com \
--to=oleganza@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).