reduce_heads: fix memory leaks
[gitweb.git] / revision.h
index 14886ec92b4f67527a86fc821998214a4d2b321f..54761200adf2d5111b8aba097299bd2fd080a949 100644 (file)
@@ -71,11 +71,19 @@ struct rev_info {
        const char *def;
        struct pathspec prune_data;
 
+       /*
+        * Whether the arguments parsed by setup_revisions() included any
+        * "input" revisions that might still have yielded an empty pending
+        * list (e.g., patterns like "--all" or "--glob").
+        */
+       int rev_input_given;
+
        /* topo-sort */
        enum rev_sort_order sort_order;
 
-       unsigned int    early_output:1,
-                       ignore_missing:1,
+       unsigned int early_output;
+
+       unsigned int    ignore_missing:1,
                        ignore_missing_links:1;
 
        /* Traversal flags */
@@ -88,6 +96,7 @@ struct rev_info {
                        topo_order:1,
                        simplify_merges:1,
                        simplify_by_decoration:1,
+                       single_worktree:1,
                        tag_objects:1,
                        tree_objects:1,
                        blob_objects:1,
@@ -141,6 +150,17 @@ struct rev_info {
                        date_mode_explicit:1,
                        preserve_subject:1;
        unsigned int    disable_stdin:1;
+       /*
+        * Set `leak_pending` to prevent `prepare_revision_walk()` from clearing
+        * the array of pending objects (`pending`). It will still forget about
+        * the array and its entries, so they really are leaked. This can be
+        * useful if the `struct object_array` `pending` is copied before
+        * calling `prepare_revision_walk()`. By setting `leak_pending`, you
+        * effectively claim ownership of the old array, so you should most
+        * likely call `object_array_clear(&pending_copy)` once you are done.
+        * Observe that this is about ownership of the array and its entries,
+        * not the commits referenced by those entries.
+        */
        unsigned int    leak_pending:1;
        /* --show-linear-break */
        unsigned int    track_linear:1,
@@ -181,8 +201,8 @@ struct rev_info {
        /* special limits */
        int skip_count;
        int max_count;
-       unsigned long max_age;
-       unsigned long min_age;
+       timestamp_t max_age;
+       timestamp_t min_age;
        int min_parents;
        int max_parents;
        int (*include_check)(struct commit *, void *);
@@ -263,9 +283,9 @@ extern void show_object_with_name(FILE *, struct object *, const char *);
 
 extern void add_pending_object(struct rev_info *revs,
                               struct object *obj, const char *name);
-extern void add_pending_sha1(struct rev_info *revs,
-                            const char *name, const unsigned char *sha1,
-                            unsigned int flags);
+extern void add_pending_oid(struct rev_info *revs,
+                           const char *name, const struct object_id *oid,
+                           unsigned int flags);
 
 extern void add_head_to_pending(struct rev_info *);
 extern void add_reflogs_to_pending(struct rev_info *, unsigned int flags);