| 1 | #ifndef RANGE_DIFF_H |
| 2 | #define RANGE_DIFF_H |
| 3 | |
| 4 | #include "diff.h" |
| 5 | #include "strvec.h" |
| 6 | |
| 7 | #define RANGE_DIFF_CREATION_FACTOR_DEFAULT 60 |
| 8 | #define RANGE_DIFF_MAX_MEMORY_DEFAULT \ |
| 9 | (sizeof(void*) >= 8 ? \ |
| 10 | ((size_t)(1024L * 1024L) * (size_t)(4L * 1024L)) : /* 4GB on 64-bit */ \ |
| 11 | ((size_t)(1024L * 1024L) * (size_t)(2L * 1024L))) /* 2GB on 32-bit */ |
| 12 | |
| 13 | /* |
| 14 | * A much higher value than the default, when we KNOW we are comparing |
| 15 | * the same series (e.g., used when format-patch calls range-diff). |
| 16 | */ |
| 17 | #define CREATION_FACTOR_FOR_THE_SAME_SERIES 999 |
| 18 | |
| 19 | struct range_diff_options { |
| 20 | int creation_factor; |
| 21 | unsigned dual_color:1; |
| 22 | unsigned left_only:1, right_only:1; |
| 23 | unsigned include_merges:1; |
| 24 | size_t max_memory; |
| 25 | const struct diff_options *diffopt; /* may be NULL */ |
| 26 | const struct strvec *log_arg; /* may be NULL */ |
| 27 | }; |
| 28 | |
| 29 | /* |
| 30 | * Compare series of commits in `range1` and `range2`, and emit to the |
| 31 | * standard output. |
| 32 | */ |
| 33 | int show_range_diff(const char *range1, const char *range2, |
| 34 | struct range_diff_options *opts); |
| 35 | |
| 36 | /* |
| 37 | * Determine whether the given argument is usable as a range argument of `git |
| 38 | * range-diff`, e.g. A..B. |
| 39 | */ |
| 40 | int is_range_diff_range(const char *arg); |
| 41 | |
| 42 | #endif |