Blame


1 fe621944 2020-11-10 stsp /*
2 fe621944 2020-11-10 stsp * Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
3 718b3ab0 2018-03-17 stsp *
4 fe621944 2020-11-10 stsp * Permission to use, copy, modify, and distribute this software for any
5 fe621944 2020-11-10 stsp * purpose with or without fee is hereby granted, provided that the above
6 fe621944 2020-11-10 stsp * copyright notice and this permission notice appear in all copies.
7 718b3ab0 2018-03-17 stsp *
8 fe621944 2020-11-10 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 fe621944 2020-11-10 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 fe621944 2020-11-10 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 fe621944 2020-11-10 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 fe621944 2020-11-10 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 fe621944 2020-11-10 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 fe621944 2020-11-10 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 718b3ab0 2018-03-17 stsp */
16 718b3ab0 2018-03-17 stsp
17 fe621944 2020-11-10 stsp #include "arraylist.h"
18 fe621944 2020-11-10 stsp #include "diff_main.h"
19 fe621944 2020-11-10 stsp #include "diff_output.h"
20 718b3ab0 2018-03-17 stsp
21 fe621944 2020-11-10 stsp enum got_diff_output_format {
22 fe621944 2020-11-10 stsp GOT_DIFF_OUTPUT_UNIDIFF,
23 d671c313 2022-09-02 stsp GOT_DIFF_OUTPUT_PLAIN,
24 404c43c4 2018-06-21 stsp };
25 404c43c4 2018-06-21 stsp
26 fe621944 2020-11-10 stsp struct got_diffreg_result {
27 fe621944 2020-11-10 stsp struct diff_result *result;
28 fe621944 2020-11-10 stsp char *map1;
29 fe621944 2020-11-10 stsp size_t size1;
30 fe621944 2020-11-10 stsp char *map2;
31 fe621944 2020-11-10 stsp size_t size2;
32 fe621944 2020-11-10 stsp struct diff_data left;
33 fe621944 2020-11-10 stsp struct diff_data right;
34 404c43c4 2018-06-21 stsp };
35 404c43c4 2018-06-21 stsp
36 01a44956 2019-03-27 stsp #define GOT_DIFF_CONFLICT_MARKER_BEGIN "<<<<<<<"
37 d136cfcb 2019-10-12 stsp #define GOT_DIFF_CONFLICT_MARKER_ORIG "|||||||"
38 01a44956 2019-03-27 stsp #define GOT_DIFF_CONFLICT_MARKER_SEP "======="
39 01a44956 2019-03-27 stsp #define GOT_DIFF_CONFLICT_MARKER_END ">>>>>>>"
40 01a44956 2019-03-27 stsp
41 cca5682e 2020-11-18 stsp const struct got_error *got_diff_get_config(struct diff_config **,
42 cca5682e 2020-11-18 stsp enum got_diff_algorithm, diff_atomize_func_t, void *);
43 72254787 2020-11-18 stsp const struct got_error *got_diff_prepare_file(FILE *, char **, size_t *,
44 5e91dae4 2022-08-30 stsp struct diff_data *, const struct diff_config *, int, int);
45 64453f7e 2020-11-21 stsp const struct got_error *got_diffreg(struct got_diffreg_result **, FILE *,
46 64453f7e 2020-11-21 stsp FILE *, enum got_diff_algorithm, int, int);
47 c7d5c43c 2022-08-04 mark const struct got_error *got_diffreg_output(struct got_diff_line **, size_t *,
48 1cb46f00 2020-11-21 stsp struct got_diffreg_result *, int, int, const char *, const char *,
49 fe621944 2020-11-10 stsp enum got_diff_output_format, int, FILE *);
50 fe621944 2020-11-10 stsp const struct got_error *got_diffreg_result_free(struct got_diffreg_result *);
51 fe621944 2020-11-10 stsp const struct got_error *got_diffreg_result_free_left(
52 fe621944 2020-11-10 stsp struct got_diffreg_result *);
53 fe621944 2020-11-10 stsp const struct got_error *got_diffreg_result_free_right(
54 fe621944 2020-11-10 stsp struct got_diffreg_result *);
55 49d4a017 2022-06-30 stsp const struct got_error *got_diffreg_close(char *, size_t, char *, size_t);
56 404c43c4 2018-06-21 stsp
57 db590691 2021-06-02 stsp const struct got_error *got_merge_diff3(int *, int, FILE *, FILE *, FILE *,
58 fdf3c2d3 2021-06-17 stsp const char *, const char *, const char *, enum got_diff_algorithm);
59 dc424a06 2019-08-07 stsp
60 fe621944 2020-11-10 stsp const struct got_error *got_diff_files(struct got_diffreg_result **, FILE *,
61 4b752015 2022-06-30 stsp int, const char *, FILE *, int, const char *, int, int, int, FILE *,
62 4b752015 2022-06-30 stsp enum got_diff_algorithm);