Skip to content

Commit

Permalink
bundle-verify: add --quiet
Browse files Browse the repository at this point in the history
Add --quiet to git-bundle verify as proposed per [1]

[1] <robbat2-20190806T191156-796782357Z@orbis-terrarum.net>

Reference: https://www.mail-archive.com/git@vger.kernel.org/msg182844.html
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
  • Loading branch information
robbat2 committed Oct 29, 2019
1 parent 5678de0 commit 0131780
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Documentation/git-bundle.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SYNOPSIS
--------
[verse]
'git bundle' create [-q | --quiet | --progress | --all-progress] [--all-progress-implied] <file> <git-rev-list-args>
'git bundle' verify <file>
'git bundle' verify [-q | --quiet] <file>
'git bundle' list-heads <file> [<refname>...]
'git bundle' unbundle <file> [<refname>...]

Expand Down
9 changes: 6 additions & 3 deletions builtin/bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

static const char * const builtin_bundle_usage[] = {
N_("git bundle create [<options>] <file> <git-rev-list args>"),
N_("git bundle verify <file>"),
N_("git bundle verify [<options>] <file>"),
N_("git bundle list-heads <file> [<refname>...]"),
N_("git bundle unbundle <file> [<refname>...]"),
NULL
Expand All @@ -25,7 +25,7 @@ static const char * const builtin_bundle_create_usage[] = {
};

static const char * const builtin_bundle_verify_usage[] = {
N_("git bundle verify <file>"),
N_("git bundle verify [<options>] <file>"),
NULL
};

Expand Down Expand Up @@ -97,8 +97,11 @@ static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
struct bundle_header header;
int bundle_fd = -1;
int quiet = 0;

struct option options[] = {
OPT_BOOL('q', "quiet", &quiet,
N_("do not show bundle details")),
OPT_END()
};
const char* bundle_file;
Expand All @@ -111,7 +114,7 @@ static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
if ((bundle_fd = read_bundle_header(bundle_file, &header)) < 0)
return 1;
close(bundle_fd);
if (verify_bundle(the_repository, &header, 1))
if (verify_bundle(the_repository, &header, !quiet))
return 1;
fprintf(stderr, _("%s is okay\n"), bundle_file);
return 0;
Expand Down

0 comments on commit 0131780

Please sign in to comment.