diff options
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/revision.c b/revision.c index b78733f508..553c0faa9b 100644 --- a/revision.c +++ b/revision.c @@ -154,7 +154,7 @@ static void paths_and_oids_insert(struct hashmap *map, entry = hashmap_get_entry(map, &key, ent, NULL); if (!entry) { - entry = xcalloc(1, sizeof(struct path_and_oids_entry)); + CALLOC_ARRAY(entry, 1); hashmap_entry_init(&entry->ent, hash); entry->path = xstrdup(key.path); oidset_init(&entry->trees, 16); @@ -1555,7 +1555,7 @@ void clear_ref_exclusion(struct string_list **ref_excludes_p) void add_ref_exclusion(struct string_list **ref_excludes_p, const char *exclude) { if (!*ref_excludes_p) { - *ref_excludes_p = xcalloc(1, sizeof(**ref_excludes_p)); + CALLOC_ARRAY(*ref_excludes_p, 1); (*ref_excludes_p)->strdup_strings = 1; } string_list_append(*ref_excludes_p, exclude); @@ -2336,6 +2336,16 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->unpacked = 1; } else if (starts_with(arg, "--unpacked=")) { die(_("--unpacked=<packfile> no longer supported")); + } else if (!strcmp(arg, "--no-kept-objects")) { + revs->no_kept_objects = 1; + revs->keep_pack_cache_flags |= IN_CORE_KEEP_PACKS; + revs->keep_pack_cache_flags |= ON_DISK_KEEP_PACKS; + } else if (skip_prefix(arg, "--no-kept-objects=", &optarg)) { + revs->no_kept_objects = 1; + if (!strcmp(optarg, "in-core")) + revs->keep_pack_cache_flags |= IN_CORE_KEEP_PACKS; + if (!strcmp(optarg, "on-disk")) + revs->keep_pack_cache_flags |= ON_DISK_KEEP_PACKS; } else if (!strcmp(arg, "-r")) { revs->diff = 1; revs->diffopt.flags.recursive = 1; @@ -2929,7 +2939,7 @@ static struct merge_simplify_state *locate_simplify_state(struct rev_info *revs, st = lookup_decoration(&revs->merge_simplification, &commit->object); if (!st) { - st = xcalloc(1, sizeof(*st)); + CALLOC_ARRAY(st, 1); add_decoration(&revs->merge_simplification, &commit->object, st); } return st; @@ -3795,6 +3805,11 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi return commit_ignore; if (revs->unpacked && has_object_pack(&commit->object.oid)) return commit_ignore; + if (revs->no_kept_objects) { + if (has_object_kept_pack(&commit->object.oid, + revs->keep_pack_cache_flags)) + return commit_ignore; + } if (commit->object.flags & UNINTERESTING) return commit_ignore; if (revs->line_level_traverse && !want_ancestry(revs)) { |