Imported Upstream version 2.24.2
[platform/upstream/git.git] / revision.h
index 007278c..4134dc6 100644 (file)
 #define SYMMETRIC_LEFT (1u<<8)
 #define PATCHSAME      (1u<<9)
 #define BOTTOM         (1u<<10)
-#define USER_GIVEN     (1u<<25) /* given directly by the user */
+/*
+ * Indicates object was reached by traversal. i.e. not given by user on
+ * command-line or stdin.
+ * NEEDSWORK: NOT_USER_GIVEN doesn't apply to commits because we only support
+ * filtering trees and blobs, but it may be useful to support filtering commits
+ * in the future.
+ */
+#define NOT_USER_GIVEN (1u<<25)
 #define TRACK_LINEAR   (1u<<26)
-#define ALL_REV_FLAGS  (((1u<<11)-1) | USER_GIVEN | TRACK_LINEAR)
+#define ALL_REV_FLAGS  (((1u<<11)-1) | NOT_USER_GIVEN | TRACK_LINEAR)
+
+#define TOPO_WALK_EXPLORED     (1u<<27)
+#define TOPO_WALK_INDEGREE     (1u<<28)
 
 #define DECORATE_SHORT_REFS    1
 #define DECORATE_FULL_REFS     2
 
-struct rev_info;
 struct log_info;
+struct repository;
+struct rev_info;
 struct string_list;
 struct saved_parents;
 define_shared_commit_slab(revision_sources, char *);
@@ -56,10 +67,14 @@ struct rev_cmdline_info {
 #define REVISION_WALK_NO_WALK_SORTED 1
 #define REVISION_WALK_NO_WALK_UNSORTED 2
 
+struct oidset;
+struct topo_walk_info;
+
 struct rev_info {
        /* Starting list */
        struct commit_list *commits;
        struct object_array pending;
+       struct repository *repo;
 
        /* Parents of shown commits */
        struct object_array boundary_commits;
@@ -82,6 +97,11 @@ struct rev_info {
         */
        int rev_input_given;
 
+       /*
+        * Whether we read from stdin due to the --stdin option.
+        */
+       int read_from_stdin;
+
        /* topo-sort */
        enum rev_sort_order sort_order;
 
@@ -126,6 +146,21 @@ struct rev_info {
                        line_level_traverse:1,
                        tree_blobs_in_commit_order:1,
 
+                       /*
+                        * Blobs are shown without regard for their existence.
+                        * But not so for trees: unless exclude_promisor_objects
+                        * is set and the tree in question is a promisor object;
+                        * OR ignore_missing_links is set, the revision walker
+                        * dies with a "bad tree object HASH" message when
+                        * encountering a missing tree. For callers that can
+                        * handle missing trees and want them to be filterable
+                        * and showable, set this to true. The revision walker
+                        * will filter and show such a missing tree as usual,
+                        * but will not attempt to recurse into this tree
+                        * object.
+                        */
+                       do_not_die_on_missing_tree:1,
+
                        /* for internal use only */
                        exclude_promisor_objects:1;
 
@@ -137,6 +172,7 @@ struct rev_info {
                        verbose_header:1,
                        ignore_merges:1,
                        combine_merges:1,
+                       combined_all_paths:1,
                        dense_combined_merges:1,
                        always_show_header:1;
 
@@ -214,6 +250,17 @@ struct rev_info {
        /* notes-specific options: which refs to show */
        struct display_notes_opt notes_opt;
 
+       /* interdiff */
+       const struct object_id *idiff_oid1;
+       const struct object_id *idiff_oid2;
+       const char *idiff_title;
+
+       /* range-diff */
+       const char *rdiff1;
+       const char *rdiff2;
+       int creation_factor;
+       const char *rdiff_title;
+
        /* commit counts */
        int count_left;
        int count_right;
@@ -229,6 +276,8 @@ struct rev_info {
        const char *break_bar;
 
        struct revision_sources *sources;
+
+       struct topo_walk_info *topo_walk_info;
 };
 
 int ref_excluded(struct string_list *, const char *path);
@@ -248,12 +297,18 @@ extern volatile show_early_output_fn_t show_early_output;
 struct setup_revision_opt {
        const char *def;
        void (*tweak)(struct rev_info *, struct setup_revision_opt *);
-       const char *submodule;
-       int assume_dashdash;
+       const char *submodule;  /* TODO: drop this and use rev_info->repo */
+       unsigned int    assume_dashdash:1,
+                       allow_exclude_promisor_objects:1;
        unsigned revarg_opt;
 };
 
-void init_revisions(struct rev_info *revs, const char *prefix);
+#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
+#define init_revisions(revs, prefix) repo_init_revisions(the_repository, revs, prefix)
+#endif
+void repo_init_revisions(struct repository *r,
+                        struct rev_info *revs,
+                        const char *prefix);
 int setup_revisions(int argc, const char **argv, struct rev_info *revs,
                    struct setup_revision_opt *);
 void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
@@ -273,7 +328,8 @@ void put_revision_mark(const struct rev_info *revs,
                       const struct commit *commit);
 
 void mark_parents_uninteresting(struct commit *commit);
-void mark_tree_uninteresting(struct tree *tree);
+void mark_tree_uninteresting(struct repository *r, struct tree *tree);
+void mark_trees_uninteresting_sparse(struct repository *r, struct oidset *trees);
 
 void show_object_with_name(FILE *, struct object *, const char *);