Skip to content

Commit ddcb8fd

Browse files
committed
Merge branch 'rs/pack-objects-parseopt-fix'
Command line parser fix. * rs/pack-objects-parseopt-fix: pack-objects: fix --no-quiet pack-objects: fix --no-keep-true-parents
2 parents 3085f94 + 36f76d2 commit ddcb8fd

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

builtin/pack-objects.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4117,6 +4117,18 @@ static void add_extra_kept_packs(const struct string_list *names)
41174117
}
41184118
}
41194119

4120+
static int option_parse_quiet(const struct option *opt, const char *arg,
4121+
int unset)
4122+
{
4123+
BUG_ON_OPT_ARG(arg);
4124+
4125+
if (!unset)
4126+
progress = 0;
4127+
else if (!progress)
4128+
progress = 1;
4129+
return 0;
4130+
}
4131+
41204132
static int option_parse_index_version(const struct option *opt,
41214133
const char *arg, int unset)
41224134
{
@@ -4178,8 +4190,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
41784190
LIST_OBJECTS_FILTER_INIT;
41794191

41804192
struct option pack_objects_options[] = {
4181-
OPT_SET_INT('q', "quiet", &progress,
4182-
N_("do not show progress meter"), 0),
4193+
OPT_CALLBACK_F('q', "quiet", NULL, NULL,
4194+
N_("do not show progress meter"),
4195+
PARSE_OPT_NOARG, option_parse_quiet),
41834196
OPT_SET_INT(0, "progress", &progress,
41844197
N_("show progress meter"), 1),
41854198
OPT_SET_INT(0, "all-progress", &progress,
@@ -4255,8 +4268,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
42554268
N_("ignore this pack")),
42564269
OPT_INTEGER(0, "compression", &pack_compression_level,
42574270
N_("pack compression level")),
4258-
OPT_SET_INT(0, "keep-true-parents", &grafts_replace_parents,
4259-
N_("do not hide commits by grafts"), 0),
4271+
OPT_BOOL(0, "keep-true-parents", &grafts_keep_true_parents,
4272+
N_("do not hide commits by grafts")),
42604273
OPT_BOOL(0, "use-bitmap-index", &use_bitmap_index,
42614274
N_("use a bitmap index if available to speed up counting objects")),
42624275
OPT_SET_INT(0, "write-bitmap-index", &write_bitmap_index,

commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
516516
* The clone is shallow if nr_parent < 0, and we must
517517
* not traverse its real parents even when we unhide them.
518518
*/
519-
if (graft && (graft->nr_parent < 0 || grafts_replace_parents))
519+
if (graft && (graft->nr_parent < 0 || !grafts_keep_true_parents))
520520
continue;
521521
new_parent = lookup_commit(r, &parent);
522522
if (!new_parent)

environment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
7373
#endif
7474
enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;
7575
char *notes_ref_name;
76-
int grafts_replace_parents = 1;
76+
int grafts_keep_true_parents;
7777
int core_apply_sparse_checkout;
7878
int core_sparse_checkout_cone;
7979
int sparse_expect_files_outside_of_patterns;

environment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ extern enum object_creation_mode object_creation_mode;
193193

194194
extern char *notes_ref_name;
195195

196-
extern int grafts_replace_parents;
196+
extern int grafts_keep_true_parents;
197197

198198
extern int repository_format_precious_objects;
199199

0 commit comments

Comments
 (0)