Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-07-28 19:45:22 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-28 19:45:22 +0300
commitddcb8fd8b94c066406c2a4f41e04122cb2a742ad (patch)
treeae13c7c5f6efeb4d21a25d97e4109df4a8816589
parent3085f949bf4aafe04dac7441308bb769ccf9c351 (diff)
parent36f76d2a253a0346491cc127de5ca4b9f7895d60 (diff)
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
-rw-r--r--builtin/pack-objects.c21
-rw-r--r--commit.c2
-rw-r--r--environment.c2
-rw-r--r--environment.h2
4 files changed, 20 insertions, 7 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 06b33d49e9..d2a162d528 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -4117,6 +4117,18 @@ static void add_extra_kept_packs(const struct string_list *names)
}
}
+static int option_parse_quiet(const struct option *opt, const char *arg,
+ int unset)
+{
+ BUG_ON_OPT_ARG(arg);
+
+ if (!unset)
+ progress = 0;
+ else if (!progress)
+ progress = 1;
+ return 0;
+}
+
static int option_parse_index_version(const struct option *opt,
const char *arg, int unset)
{
@@ -4178,8 +4190,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
LIST_OBJECTS_FILTER_INIT;
struct option pack_objects_options[] = {
- OPT_SET_INT('q', "quiet", &progress,
- N_("do not show progress meter"), 0),
+ OPT_CALLBACK_F('q', "quiet", NULL, NULL,
+ N_("do not show progress meter"),
+ PARSE_OPT_NOARG, option_parse_quiet),
OPT_SET_INT(0, "progress", &progress,
N_("show progress meter"), 1),
OPT_SET_INT(0, "all-progress", &progress,
@@ -4255,8 +4268,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
N_("ignore this pack")),
OPT_INTEGER(0, "compression", &pack_compression_level,
N_("pack compression level")),
- OPT_SET_INT(0, "keep-true-parents", &grafts_replace_parents,
- N_("do not hide commits by grafts"), 0),
+ OPT_BOOL(0, "keep-true-parents", &grafts_keep_true_parents,
+ N_("do not hide commits by grafts")),
OPT_BOOL(0, "use-bitmap-index", &use_bitmap_index,
N_("use a bitmap index if available to speed up counting objects")),
OPT_SET_INT(0, "write-bitmap-index", &write_bitmap_index,
diff --git a/commit.c b/commit.c
index 6507791061..b3223478bc 100644
--- a/commit.c
+++ b/commit.c
@@ -516,7 +516,7 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
* The clone is shallow if nr_parent < 0, and we must
* not traverse its real parents even when we unhide them.
*/
- if (graft && (graft->nr_parent < 0 || grafts_replace_parents))
+ if (graft && (graft->nr_parent < 0 || !grafts_keep_true_parents))
continue;
new_parent = lookup_commit(r, &parent);
if (!new_parent)
diff --git a/environment.c b/environment.c
index a0d1d070d1..f98d76f080 100644
--- a/environment.c
+++ b/environment.c
@@ -73,7 +73,7 @@ enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
#endif
enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;
char *notes_ref_name;
-int grafts_replace_parents = 1;
+int grafts_keep_true_parents;
int core_apply_sparse_checkout;
int core_sparse_checkout_cone;
int sparse_expect_files_outside_of_patterns;
diff --git a/environment.h b/environment.h
index 611aa0ffed..c5377473c6 100644
--- a/environment.h
+++ b/environment.h
@@ -193,7 +193,7 @@ extern enum object_creation_mode object_creation_mode;
extern char *notes_ref_name;
-extern int grafts_replace_parents;
+extern int grafts_keep_true_parents;
extern int repository_format_precious_objects;