diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-06 12:17:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-06 12:17:52 -0700 |
commit | 9d54f97e34a92d1504f24a5896e9741111f38d79 (patch) | |
tree | 6449a87822b4479e587091f76671e414a83fce28 /builtin | |
parent | 99d9ec090677c925c534001f01cbaf303a31cb82 (diff) | |
parent | af0b4a3b5973ebdf8fcdedcccbc2e8ddb93c8534 (diff) | |
download | git-9d54f97e34a92d1504f24a5896e9741111f38d79.tar.gz git-9d54f97e34a92d1504f24a5896e9741111f38d79.tar.xz |
Merge branch 'nd/prune-packed-dryrun-verbose'
* nd/prune-packed-dryrun-verbose:
prune-packed: avoid implying "1" is DRY_RUN in prune_packed_objects()
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/prune-packed.c | 15 | ||||
-rw-r--r-- | builtin/prune.c | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c index 83382c1fe..fa6ce42f4 100644 --- a/builtin/prune-packed.c +++ b/builtin/prune-packed.c @@ -8,9 +8,6 @@ static const char * const prune_packed_usage[] = { NULL }; -#define DRY_RUN 01 -#define VERBOSE 02 - static struct progress *progress; static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts) @@ -29,7 +26,7 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts) if (!has_sha1_pack(sha1)) continue; memcpy(pathname + len, de->d_name, 38); - if (opts & DRY_RUN) + if (opts & PRUNE_PACKED_DRY_RUN) printf("rm -f %s\n", pathname); else unlink_or_warn(pathname); @@ -44,7 +41,7 @@ void prune_packed_objects(int opts) const char *dir = get_object_directory(); int len = strlen(dir); - if (opts == VERBOSE) + if (opts & PRUNE_PACKED_VERBOSE) progress = start_progress_delay("Removing duplicate objects", 256, 95, 2); @@ -71,10 +68,12 @@ void prune_packed_objects(int opts) int cmd_prune_packed(int argc, const char **argv, const char *prefix) { - int opts = isatty(2) ? VERBOSE : 0; + int opts = isatty(2) ? PRUNE_PACKED_VERBOSE : 0; const struct option prune_packed_options[] = { - OPT_BIT('n', "dry-run", &opts, N_("dry run"), DRY_RUN), - OPT_NEGBIT('q', "quiet", &opts, N_("be quiet"), VERBOSE), + OPT_BIT('n', "dry-run", &opts, N_("dry run"), + PRUNE_PACKED_DRY_RUN), + OPT_NEGBIT('q', "quiet", &opts, N_("be quiet"), + PRUNE_PACKED_VERBOSE), OPT_END() }; diff --git a/builtin/prune.c b/builtin/prune.c index b90e5cc36..6366917c6 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -165,7 +165,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix) stop_progress(&progress); prune_object_dir(get_object_directory()); - prune_packed_objects(show_only); + prune_packed_objects(show_only ? PRUNE_PACKED_DRY_RUN : 0); remove_temporary_files(get_object_directory()); s = mkpathdup("%s/pack", get_object_directory()); remove_temporary_files(s); |