Skip to content

Commit 3a5f308

Browse files
rscharfegitster
authored andcommitted
pack-objects: fix --no-keep-true-parents
Since 99fb6e0 (pack-objects: convert to use parse_options(), 2012-02-01) git pack-objects has accepted --no-keep-true-parents, but this option does the same as --keep-true-parents. That's because it's defined using OPT_SET_INT with a value of 0, which sets 0 when negated as well. Turn --no-keep-true-parents into the opposite of --keep-true-parents by using OPT_BOOL and storing the option's status directly in a variable named "grafts_keep_true_parents" instead of in negative form in "grafts_replace_parents". Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fb7d80e commit 3a5f308

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

builtin/pack-objects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4256,8 +4256,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
42564256
N_("ignore this pack")),
42574257
OPT_INTEGER(0, "compression", &pack_compression_level,
42584258
N_("pack compression level")),
4259-
OPT_SET_INT(0, "keep-true-parents", &grafts_replace_parents,
4260-
N_("do not hide commits by grafts"), 0),
4259+
OPT_BOOL(0, "keep-true-parents", &grafts_keep_true_parents,
4260+
N_("do not hide commits by grafts")),
42614261
OPT_BOOL(0, "use-bitmap-index", &use_bitmap_index,
42624262
N_("use a bitmap index if available to speed up counting objects")),
42634263
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
@@ -75,7 +75,7 @@ enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
7575
#endif
7676
enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;
7777
char *notes_ref_name;
78-
int grafts_replace_parents = 1;
78+
int grafts_keep_true_parents;
7979
int core_apply_sparse_checkout;
8080
int core_sparse_checkout_cone;
8181
int sparse_expect_files_outside_of_patterns;

environment.h

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

195195
extern char *notes_ref_name;
196196

197-
extern int grafts_replace_parents;
197+
extern int grafts_keep_true_parents;
198198

199199
extern int repository_format_precious_objects;
200200
extern int repository_format_worktree_config;

0 commit comments

Comments
 (0)