🌐 AI搜索 & 代理 主页
blob: f6bf860d19e5a2997193c25873a5ba82e030f68b [file] [log] [blame]
Linus Torvaldsae563542006-02-26 00:19:461#ifndef REVISION_H
2#define REVISION_H
3
Elijah Newrenef3ca952018-08-15 17:54:054#include "commit.h"
Pierre Habouzit6b61ec02008-07-09 21:38:345#include "parse-options.h"
Jeff King0843acf2008-08-25 06:15:056#include "grep.h"
Thomas Rast894a9d32010-03-12 17:04:267#include "notes.h"
Olga Telezhnayacf394712017-12-12 08:55:358#include "pretty.h"
Felipe Contreras19ecb562013-10-31 09:25:369#include "diff.h"
Nguyễn Thái Ngọc Duy87be2522018-05-19 05:28:2410#include "commit-slab-decl.h"
Pierre Habouzit6b61ec02008-07-09 21:38:3411
Heba Waly301d5952019-11-17 21:04:4812/**
13 * The revision walking API offers functions to build a list of revisions
14 * and then iterate over that list.
15 *
16 * Calling sequence
17 * ----------------
18 *
19 * The walking API has a given calling sequence: first you need to initialize
20 * a rev_info structure, then add revisions to control what kind of revision
21 * list do you want to get, finally you can iterate over the revision list.
22 *
23 */
24
Nguyễn Thái Ngọc Duy208acbf2014-03-25 13:23:2625/* Remember to update object flag allocation in object.h */
Linus Torvaldsae563542006-02-26 00:19:4626#define SEEN (1u<<0)
27#define UNINTERESTING (1u<<1)
Linus Torvalds7dc0fe32007-11-13 07:16:0828#define TREESAME (1u<<2)
Linus Torvalds765ac8e2006-02-28 23:07:2029#define SHOWN (1u<<3)
Junio C Hamano7ae0b0c2006-03-01 08:58:5630#define TMP_MARK (1u<<4) /* for isolated cases; clean after use */
Junio C Hamano384e99a2006-03-28 07:58:3431#define BOUNDARY (1u<<5)
Junio C Hamano2b064692007-03-06 00:10:2832#define CHILD_SHOWN (1u<<6)
Junio C Hamano1b65a5a2006-04-17 01:12:4933#define ADDED (1u<<7) /* Parents already parsed and added? */
Junio C Hamano577ed5c2006-10-23 00:32:4734#define SYMMETRIC_LEFT (1u<<8)
Michael J Gruberadbbb312011-03-07 12:31:4035#define PATCHSAME (1u<<9)
Kevin Bracey7f34a462013-05-16 15:32:3836#define BOTTOM (1u<<10)
Derrick Stolee8d049e12020-04-10 12:19:4337
38/* WARNING: This is also used as REACHABLE in commit-graph.c. */
39#define PULL_MERGE (1u<<15)
René Scharfe23c43192020-06-24 13:05:3840
41#define TOPO_WALK_EXPLORED (1u<<23)
42#define TOPO_WALK_INDEGREE (1u<<24)
43
Matthew DeVore99c9aa92018-10-05 21:31:2444/*
45 * Indicates object was reached by traversal. i.e. not given by user on
46 * command-line or stdin.
47 * NEEDSWORK: NOT_USER_GIVEN doesn't apply to commits because we only support
48 * filtering trees and blobs, but it may be useful to support filtering commits
49 * in the future.
50 */
51#define NOT_USER_GIVEN (1u<<25)
Nguyễn Thái Ngọc Duy1b32dec2014-03-25 13:23:2752#define TRACK_LINEAR (1u<<26)
Derrick Stolee8d049e12020-04-10 12:19:4353#define ALL_REV_FLAGS (((1u<<11)-1) | NOT_USER_GIVEN | TRACK_LINEAR | PULL_MERGE)
Linus Torvaldsae563542006-02-26 00:19:4654
Lars Hjemli33e70182009-08-15 14:23:1255#define DECORATE_SHORT_REFS 1
56#define DECORATE_FULL_REFS 2
57
Linus Torvalds91539832006-04-17 18:59:3258struct log_info;
Nguyễn Thái Ngọc Duy2abf3502018-09-21 15:57:3859struct repository;
60struct rev_info;
Thomas Rast894a9d32010-03-12 17:04:2661struct string_list;
Thomas Rast53d00b32013-07-31 20:13:2062struct saved_parents;
Garima Singha56b9462020-04-06 16:59:5263struct bloom_key;
64struct bloom_filter_settings;
Nguyễn Thái Ngọc Duy87be2522018-05-19 05:28:2465define_shared_commit_slab(revision_sources, char *);
Fredrik Kuivinen8efdc322006-03-10 09:21:3966
Junio C Hamano281eee42011-08-26 00:35:3967struct rev_cmdline_info {
68 unsigned int nr;
69 unsigned int alloc;
70 struct rev_cmdline_entry {
71 struct object *item;
72 const char *name;
73 enum {
74 REV_CMD_REF,
75 REV_CMD_PARENTS_ONLY,
76 REV_CMD_LEFT,
77 REV_CMD_RIGHT,
Kevin Braceya7654992013-05-13 15:00:4778 REV_CMD_MERGE_BASE,
Junio C Hamano281eee42011-08-26 00:35:3979 REV_CMD_REV
80 } whence;
81 unsigned flags;
82 } *rev;
83};
84
Martin von Zweigbergkca92e592012-08-29 06:15:5485#define REVISION_WALK_WALK 0
86#define REVISION_WALK_NO_WALK_SORTED 1
87#define REVISION_WALK_NO_WALK_UNSORTED 2
88
Derrick Stoleef1f5de42019-01-16 18:25:5889struct oidset;
Derrick Stoleef0d9cc42018-11-01 13:46:2090struct topo_walk_info;
91
Linus Torvaldsae563542006-02-26 00:19:4692struct rev_info {
93 /* Starting list */
94 struct commit_list *commits;
Linus Torvalds1f1e8952006-06-20 00:42:3595 struct object_array pending;
Nguyễn Thái Ngọc Duy2abf3502018-09-21 15:57:3896 struct repository *repo;
Linus Torvaldsae563542006-02-26 00:19:4697
Junio C Hamano86ab4902007-03-05 21:10:0698 /* Parents of shown commits */
99 struct object_array boundary_commits;
100
Junio C Hamano281eee42011-08-26 00:35:39101 /* The end-points specified by the end user */
102 struct rev_cmdline_info cmdline;
103
Junio C Hamanoe7b432c2013-08-30 23:37:55104 /* excluding from --branches, --refs, etc. expansion */
105 struct string_list *ref_excludes;
106
Linus Torvaldsae563542006-02-26 00:19:46107 /* Basic information */
108 const char *prefix;
Pierre Habouzit02e54222008-07-08 13:19:33109 const char *def;
Nguyễn Thái Ngọc Duyafe069d2010-12-17 12:43:06110 struct pathspec prune_data;
Junio C Hamano08f704f2013-06-06 23:07:14111
Jeff King7ba82622017-08-02 22:25:27112 /*
113 * Whether the arguments parsed by setup_revisions() included any
114 * "input" revisions that might still have yielded an empty pending
115 * list (e.g., patterns like "--all" or "--glob").
116 */
117 int rev_input_given;
118
Jeff Kinga12cbe22018-08-22 21:37:23119 /*
120 * Whether we read from stdin due to the --stdin option.
121 */
122 int read_from_stdin;
123
Junio C Hamano08f704f2013-06-06 23:07:14124 /* topo-sort */
125 enum rev_sort_order sort_order;
126
SZEDER Gábore35b6ac2017-06-10 11:41:01127 unsigned int early_output;
128
129 unsigned int ignore_missing:1,
Vicent Marti2db1a432014-03-28 10:00:43130 ignore_missing_links:1;
Linus Torvaldscdcefbc2007-11-03 18:11:10131
Linus Torvaldsae563542006-02-26 00:19:46132 /* Traversal flags */
133 unsigned int dense:1,
Linus Torvalds53b2c822007-11-05 21:22:34134 prune:1,
Martin von Zweigbergkca92e592012-08-29 06:15:54135 no_walk:2,
Linus Torvaldsae563542006-02-26 00:19:46136 remove_empty_trees:1,
Linus Torvalds92024342006-06-11 17:57:35137 simplify_history:1,
Derrick Stolee8d049e12020-04-10 12:19:43138 show_pulls:1,
Linus Torvaldsae563542006-02-26 00:19:46139 topo_order:1,
Junio C Hamano6546b592008-07-31 08:17:41140 simplify_merges:1,
Linus Torvalds78892e32008-11-03 19:25:46141 simplify_by_decoration:1,
Nguyễn Thái Ngọc Duyff9445b2017-08-23 12:36:49142 single_worktree:1,
Linus Torvaldsae563542006-02-26 00:19:46143 tag_objects:1,
144 tree_objects:1,
145 blob_objects:1,
Junio C Hamano5a48d242011-09-01 22:43:34146 verify_objects:1,
Linus Torvaldsd9a83682006-02-27 16:54:36147 edge_hint:1,
brian m. carlson1684c1b2014-12-24 23:05:39148 edge_hint_aggressive:1,
Linus Torvaldsd9a83682006-02-27 16:54:36149 limited:1,
Junio C Hamano03a96832009-02-28 08:00:21150 unpacked:1,
Junio C Hamano86ab4902007-03-05 21:10:06151 boundary:2,
Thomas Rastf69c5012010-06-10 11:47:23152 count:1,
Junio C Hamano74bd9022006-12-16 23:31:25153 left_right:1,
Michael J Gruber60adf7d2011-02-21 16:09:11154 left_only:1,
155 right_only:1,
Adam Simpkins885cf802008-05-04 10:36:52156 rewrite_parents:1,
157 print_parents:1,
Linus Torvaldsd467a522008-11-03 19:23:57158 show_decorations:1,
Junio C Hamano0053e902007-03-13 08:57:22159 reverse:1,
Thomas Rast498bcd32008-08-29 19:18:38160 reverse_output_stage:1,
Junio C Hamanod7a17ca2007-04-09 10:40:38161 cherry_pick:1,
Michael J Gruberadbbb312011-03-07 12:31:40162 cherry_mark:1,
Linus Torvaldsad3f9a72009-10-27 18:28:07163 bisect:1,
Junio C Hamanoebdc94f2010-04-20 20:48:39164 ancestry_path:1,
Thomas Rast12da1d12013-03-28 16:47:32165 first_parent_only:1,
Stefan Bellerce5b6f92017-11-16 02:00:35166 line_level_traverse:1,
Junio C Hamanof3d618d2018-02-13 21:39:03167 tree_blobs_in_commit_order:1,
Jonathan Tandf11e192017-12-08 15:27:15168
Matthew DeVore7c0fe332018-10-05 21:31:23169 /*
170 * Blobs are shown without regard for their existence.
171 * But not so for trees: unless exclude_promisor_objects
172 * is set and the tree in question is a promisor object;
173 * OR ignore_missing_links is set, the revision walker
174 * dies with a "bad tree object HASH" message when
175 * encountering a missing tree. For callers that can
176 * handle missing trees and want them to be filterable
177 * and showable, set this to true. The revision walker
178 * will filter and show such a missing tree as usual,
179 * but will not attempt to recurse into this tree
180 * object.
181 */
182 do_not_die_on_missing_tree:1,
183
Jonathan Tandf11e192017-12-08 15:27:15184 /* for internal use only */
185 exclude_promisor_objects:1;
Linus Torvaldsae563542006-02-26 00:19:46186
Linus Torvaldscd2bdc52006-04-14 23:52:13187 /* Diff flags */
188 unsigned int diff:1,
189 full_diff:1,
190 show_root_diff:1,
Sergey Organov572fc9a2020-08-31 20:14:22191 match_missing:1,
Linus Torvaldscd2bdc52006-04-14 23:52:13192 no_commit_id:1,
193 verbose_header:1,
Linus Torvaldscd2bdc52006-04-14 23:52:13194 combine_merges:1,
Elijah Newrend76ce4f2019-02-08 01:12:46195 combined_all_paths:1,
Linus Torvaldscd2bdc52006-04-14 23:52:13196 dense_combined_merges:1,
197 always_show_header:1;
Jeff King6fae74b2020-07-29 20:10:20198 int ignore_merges:2;
Linus Torvaldscd2bdc52006-04-14 23:52:13199
200 /* Format info */
Denton Liu1d729752019-12-12 00:49:50201 int show_notes;
Linus Torvalds91539832006-04-17 18:59:32202 unsigned int shown_one:1,
Junio C Hamanobd1470b2012-10-18 04:27:22203 shown_dashes:1,
Pierre Habouzit02e54222008-07-08 13:19:33204 show_merge:1,
Junio C Hamano66b2ed02010-01-20 21:59:36205 show_notes_given:1,
Junio C Hamano0c37f1f2011-10-18 22:53:23206 show_signature:1,
Junio C Hamano66b2ed02010-01-20 21:59:36207 pretty_given:1,
Junio C Hamano4da45be2008-04-08 00:11:34208 abbrev_commit:1,
Jay Soffian0c476952011-05-18 17:56:04209 abbrev_commit_given:1,
brian m. carlson3a30aa12015-12-15 01:52:04210 zero_commit:1,
Adam Simpkins7fefda52008-05-04 10:36:54211 use_terminator:1,
Jeff Kingf4ea32f2009-09-24 08:28:15212 missing_newline:1,
Jeff King9553d2b2011-05-26 22:28:17213 date_mode_explicit:1,
Emma Brooks19d097e2020-04-08 04:31:38214 preserve_subject:1,
215 encode_email_headers:1;
Junio C Hamano8b3dce52009-11-03 14:59:18216 unsigned int disable_stdin:1;
Nguyễn Thái Ngọc Duy1b32dec2014-03-25 13:23:27217 /* --show-linear-break */
218 unsigned int track_linear:1,
219 track_first_time:1,
220 linear:1;
Junio C Hamano8b3dce52009-11-03 14:59:18221
Jeff Kinga5481a62015-06-25 16:55:02222 struct date_mode date_mode;
Junio C Hamano0893eec2016-03-29 22:49:24223 int expand_tabs_in_log; /* unset if negative */
224 int expand_tabs_in_log_default;
Junio C Hamano106d7102006-09-06 09:12:09225
Linus Torvaldscd2bdc52006-04-14 23:52:13226 unsigned int abbrev;
227 enum cmit_fmt commit_format;
Linus Torvalds91539832006-04-17 18:59:32228 struct log_info *loginfo;
Johannes Schindelin596524b2006-05-05 02:30:52229 int nr, total;
Johannes Schindelin698ce6f2006-05-20 13:40:29230 const char *mime_boundary;
Stephen Boyd108dab22009-03-23 02:14:05231 const char *patch_suffix;
232 int numbered_files;
Junio C Hamano5fe10fe2012-12-22 08:21:23233 int reroll_count;
Daniel Barkalowe1a37342008-02-19 03:56:06234 char *message_id;
Jeff Kinga9080472013-07-03 07:08:22235 struct ident_split from_ident;
Thomas Rastb079c502009-02-19 21:26:31236 struct string_list *ref_message_ids;
Nguyễn Thái Ngọc Duy5289c562013-02-12 10:17:38237 int add_signoff;
Johannes Schindelin20ff0682006-06-02 13:21:17238 const char *extra_headers;
Junio C Hamano52883fb2006-12-25 19:48:35239 const char *log_reencode;
Robin H. Johnson2d9e4a42007-04-11 23:58:07240 const char *subject_prefix;
Johannes Schindelinc112f682007-03-03 23:12:06241 int no_inline;
Marco Costalba9fa34652007-07-20 18:15:13242 int show_log_size;
Antoine Pelisse0e2913b2013-01-05 21:26:41243 struct string_list *mailmap;
Linus Torvaldscd2bdc52006-04-14 23:52:13244
Junio C Hamano8ecae9b2006-09-17 22:43:40245 /* Filter by commit log message */
Jeff King0843acf2008-08-25 06:15:05246 struct grep_opt grep_filter;
Christoph Junghans22dfa8a2015-01-13 01:33:32247 /* Negate the match of grep_filter */
248 int invert_grep;
Junio C Hamano8ecae9b2006-09-17 22:43:40249
Adam Simpkins7fefda52008-05-04 10:36:54250 /* Display history graph */
251 struct git_graph *graph;
252
Linus Torvaldsae563542006-02-26 00:19:46253 /* special limits */
Junio C Hamanod5db6c92006-12-20 02:25:32254 int skip_count;
Linus Torvaldsae563542006-02-26 00:19:46255 int max_count;
Johannes Schindelindddbad72017-04-26 19:29:31256 timestamp_t max_age;
257 timestamp_t min_age;
Michael J Gruberad5aeed2011-03-21 10:14:06258 int min_parents;
259 int max_parents;
Vicent Martia330de32013-10-24 18:01:41260 int (*include_check)(struct commit *, void *);
261 void *include_check_data;
Fredrik Kuivinen8efdc322006-03-10 09:21:39262
Linus Torvaldscd2bdc52006-04-14 23:52:13263 /* diff info for patches and for paths limiting */
Junio C Hamanoc4e05b12006-04-11 01:14:54264 struct diff_options diffopt;
Linus Torvaldscd2bdc52006-04-14 23:52:13265 struct diff_options pruning;
Junio C Hamanoc4e05b12006-04-11 01:14:54266
Johannes Schindelin8860fd42007-01-11 10:47:48267 struct reflog_walk_info *reflog_info;
Junio C Hamanof35f5602008-04-03 09:12:06268 struct decoration children;
Junio C Hamanofaf01562008-08-14 17:59:44269 struct decoration merge_simplification;
Kevin Braceyd0af6632013-05-16 15:32:34270 struct decoration treesame;
Thomas Rast894a9d32010-03-12 17:04:26271
272 /* notes-specific options: which refs to show */
273 struct display_notes_opt notes_opt;
Thomas Rastf69c5012010-06-10 11:47:23274
Eric Sunshine126facf2018-07-22 09:57:05275 /* interdiff */
276 const struct object_id *idiff_oid1;
277 const struct object_id *idiff_oid2;
Eric Sunshine5ac290f2018-07-22 09:57:06278 const char *idiff_title;
Eric Sunshine126facf2018-07-22 09:57:05279
Eric Sunshine31e26172018-07-22 09:57:13280 /* range-diff */
281 const char *rdiff1;
282 const char *rdiff2;
283 int creation_factor;
Eric Sunshine4ee99682018-07-22 09:57:15284 const char *rdiff_title;
Eric Sunshine31e26172018-07-22 09:57:13285
Thomas Rastf69c5012010-06-10 11:47:23286 /* commit counts */
287 int count_left;
288 int count_right;
Michael J Gruberb388e142011-04-26 08:24:29289 int count_same;
Thomas Rast12da1d12013-03-28 16:47:32290
291 /* line level range that we are chasing */
292 struct decoration line_log_data;
Thomas Rast53d00b32013-07-31 20:13:20293
294 /* copies of the parent lists, for --full-diff display */
295 struct saved_parents *saved_parents_slab;
Nguyễn Thái Ngọc Duy1b32dec2014-03-25 13:23:27296
297 struct commit_list *previous_parents;
298 const char *break_bar;
Nguyễn Thái Ngọc Duy87be2522018-05-19 05:28:24299
300 struct revision_sources *sources;
Derrick Stoleef0d9cc42018-11-01 13:46:20301
302 struct topo_walk_info *topo_walk_info;
Garima Singha56b9462020-04-06 16:59:52303
304 /* Commit graph bloom filter fields */
SZEDER Gáborc525ce92020-07-01 13:27:30305 /* The bloom filter key(s) for the pathspec */
306 struct bloom_key *bloom_keys;
307 int bloom_keys_nr;
308
Garima Singha56b9462020-04-06 16:59:52309 /*
310 * The bloom filter settings used to generate the key.
311 * This is loaded from the commit-graph being used.
312 */
313 struct bloom_filter_settings *bloom_filter_settings;
Linus Torvaldsae563542006-02-26 00:19:46314};
315
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30316int ref_excluded(struct string_list *, const char *path);
Junio C Hamanoff32d342013-11-01 19:02:45317void clear_ref_exclusion(struct string_list **);
318void add_ref_exclusion(struct string_list **, const char *exclude);
319
320
Fredrik Kuivinen8efdc322006-03-10 09:21:39321#define REV_TREE_SAME 0
Linus Torvaldsceff8e72009-06-03 01:34:01322#define REV_TREE_NEW 1 /* Only new files */
323#define REV_TREE_OLD 2 /* Only files removed */
324#define REV_TREE_DIFFERENT 3 /* Mixed changes */
Fredrik Kuivinen8efdc322006-03-10 09:21:39325
Linus Torvaldsae563542006-02-26 00:19:46326/* revision.c */
Linus Torvaldscdcefbc2007-11-03 18:11:10327typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *);
Brandon Casey4dc1db02008-08-21 00:34:30328extern volatile show_early_output_fn_t show_early_output;
Fredrik Kuivinen8efdc322006-03-10 09:21:39329
Junio C Hamano32962c92010-03-09 06:58:09330struct setup_revision_opt {
331 const char *def;
Junio C Hamanob4490052010-03-09 07:27:25332 void (*tweak)(struct rev_info *, struct setup_revision_opt *);
Nguyễn Thái Ngọc Duy2abf3502018-09-21 15:57:38333 const char *submodule; /* TODO: drop this and use rev_info->repo */
Matthew DeVorebbcde412018-12-03 22:10:19334 unsigned int assume_dashdash:1,
335 allow_exclude_promisor_objects:1;
Junio C Hamanod5f6b1d2012-07-02 19:43:05336 unsigned revarg_opt;
Junio C Hamano32962c92010-03-09 06:58:09337};
338
Nguyễn Thái Ngọc Duy2abf3502018-09-21 15:57:38339#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
340#define init_revisions(revs, prefix) repo_init_revisions(the_repository, revs, prefix)
341#endif
Heba Waly301d5952019-11-17 21:04:48342
343/**
344 * Initialize a rev_info structure with default values. The third parameter may
345 * be NULL or can be prefix path, and then the `.prefix` variable will be set
346 * to it. This is typically the first function you want to call when you want
347 * to deal with a revision list. After calling this function, you are free to
348 * customize options, like set `.ignore_merges` to 0 if you don't want to
349 * ignore merges, and so on.
350 */
Nguyễn Thái Ngọc Duy2abf3502018-09-21 15:57:38351void repo_init_revisions(struct repository *r,
352 struct rev_info *revs,
353 const char *prefix);
Heba Waly301d5952019-11-17 21:04:48354
355/**
356 * Parse revision information, filling in the `rev_info` structure, and
357 * removing the used arguments from the argument list. Returns the number
358 * of arguments left that weren't recognized, which are also moved to the
359 * head of the argument list. The last parameter is used in case no
360 * parameter given by the first two arguments.
361 */
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30362int setup_revisions(int argc, const char **argv, struct rev_info *revs,
363 struct setup_revision_opt *);
Heba Waly301d5952019-11-17 21:04:48364
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30365void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
366 const struct option *options,
367 const char * const usagestr[]);
Junio C Hamano8e676e82012-07-02 19:33:52368#define REVARG_CANNOT_BE_FILENAME 01
Junio C Hamanod5f6b1d2012-07-02 19:43:05369#define REVARG_COMMITTISH 02
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30370int handle_revision_arg(const char *arg, struct rev_info *revs,
371 int flags, unsigned revarg_opt);
Junio C Hamano5d6f0932006-09-06 04:28:36372
Heba Waly301d5952019-11-17 21:04:48373/**
374 * Reset the flags used by the revision walking api. You can use this to do
375 * multiple sequential revision walks.
376 */
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30377void reset_revision_walk(void);
Heba Waly301d5952019-11-17 21:04:48378
379/**
380 * Prepares the rev_info structure for a walk. You should check if it returns
381 * any error (non-zero return code) and if it does not, you can start using
382 * get_revision() to do the iteration.
383 */
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30384int prepare_revision_walk(struct rev_info *revs);
Heba Waly301d5952019-11-17 21:04:48385
386/**
387 * Takes a pointer to a `rev_info` structure and iterates over it, returning a
388 * `struct commit *` each time you call it. The end of the revision list is
389 * indicated by returning a NULL pointer.
390 */
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30391struct commit *get_revision(struct rev_info *revs);
Heba Waly301d5952019-11-17 21:04:48392
Denton Liu49825162019-11-20 00:51:13393const char *get_revision_mark(const struct rev_info *revs,
394 const struct commit *commit);
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30395void put_revision_mark(const struct rev_info *revs,
396 const struct commit *commit);
Linus Torvaldsa4a88b22006-02-28 19:24:00397
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30398void mark_parents_uninteresting(struct commit *commit);
Nguyễn Thái Ngọc Duyb3c7eef2018-09-21 15:57:39399void mark_tree_uninteresting(struct repository *r, struct tree *tree);
Derrick Stoleef1f5de42019-01-16 18:25:58400void mark_trees_uninteresting_sparse(struct repository *r, struct oidset *trees);
Linus Torvaldsae563542006-02-26 00:19:46401
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30402void show_object_with_name(FILE *, struct object *, const char *);
Junio C Hamano91f17512011-08-17 21:30:34403
Heba Waly301d5952019-11-17 21:04:48404/**
405 * This function can be used if you want to add commit objects as revision
406 * information. You can use the `UNINTERESTING` object flag to indicate if
407 * you want to include or exclude the given commit (and commits reachable
408 * from the given commit) from the revision list.
409 *
410 * NOTE: If you have the commits as a string list then you probably want to
411 * use setup_revisions(), instead of parsing each string and using this
412 * function.
413 */
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30414void add_pending_object(struct rev_info *revs,
415 struct object *obj, const char *name);
Heba Waly301d5952019-11-17 21:04:48416
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30417void add_pending_oid(struct rev_info *revs,
418 const char *name, const struct object_id *oid,
419 unsigned int flags);
Linus Torvaldsae563542006-02-26 00:19:46420
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30421void add_head_to_pending(struct rev_info *);
422void add_reflogs_to_pending(struct rev_info *, unsigned int flags);
423void add_index_objects_to_pending(struct rev_info *, unsigned int flags);
Junio C Hamano3384a2d2007-12-11 18:09:04424
Linus Torvalds252a7c02007-11-04 20:12:05425enum commit_action {
426 commit_ignore,
427 commit_show,
428 commit_error
429};
430
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30431enum commit_action get_commit_action(struct rev_info *revs,
432 struct commit *commit);
433enum commit_action simplify_commit(struct rev_info *revs,
434 struct commit *commit);
Linus Torvalds252a7c02007-11-04 20:12:05435
Bo Yangc7edcae2013-03-28 16:47:31436enum rewrite_result {
437 rewrite_one_ok,
438 rewrite_one_noparents,
439 rewrite_one_error
440};
441
442typedef enum rewrite_result (*rewrite_parent_fn_t)(struct rev_info *revs, struct commit **pp);
443
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30444int rewrite_parents(struct rev_info *revs,
445 struct commit *commit,
446 rewrite_parent_fn_t rewrite_parent);
Thomas Rast53d00b32013-07-31 20:13:20447
448/*
Junio C Hamano0131c492015-01-14 22:49:24449 * The log machinery saves the original parent list so that
450 * get_saved_parents() can later tell what the real parents of the
451 * commits are, when commit->parents has been modified by history
452 * simpification.
Thomas Rast53d00b32013-07-31 20:13:20453 *
454 * get_saved_parents() will transparently return commit->parents if
455 * history simplification is off.
456 */
Nguyễn Thái Ngọc Duyd16ec9c2018-06-30 09:20:30457struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
Thomas Rast53d00b32013-07-31 20:13:20458
Linus Torvaldsae563542006-02-26 00:19:46459#endif