From 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 26 May 2020 00:06:52 +0100 Subject: revert(3p/git): Revert merge of git upstream at v2.26.2 This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3. --- third_party/git/range-diff.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'third_party/git/range-diff.c') diff --git a/third_party/git/range-diff.c b/third_party/git/range-diff.c index f745567cf671..ba1e9a4265a6 100644 --- a/third_party/git/range-diff.c +++ b/third_party/git/range-diff.c @@ -40,8 +40,7 @@ static size_t find_end_of_line(char *buffer, unsigned long size) * Reads the patches into a string list, with the `util` field being populated * as struct object_id (will need to be free()d). */ -static int read_patches(const char *range, struct string_list *list, - const struct argv_array *other_arg) +static int read_patches(const char *range, struct string_list *list) { struct child_process cp = CHILD_PROCESS_INIT; struct strbuf buf = STRBUF_INIT, contents = STRBUF_INIT; @@ -53,7 +52,6 @@ static int read_patches(const char *range, struct string_list *list, argv_array_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges", "--reverse", "--date-order", "--decorate=no", - "--no-prefix", /* * Choose indicators that are not used anywhere * else in diffs, but still look reasonable @@ -62,11 +60,8 @@ static int read_patches(const char *range, struct string_list *list, "--output-indicator-new=>", "--output-indicator-old=<", "--output-indicator-context=#", - "--no-abbrev-commit", + "--no-abbrev-commit", range, NULL); - if (other_arg) - argv_array_pushv(&cp.args, other_arg->argv); - argv_array_push(&cp.args, range); cp.out = -1; cp.no_stdin = 1; cp.git_cmd = 1; @@ -116,7 +111,7 @@ static int read_patches(const char *range, struct string_list *list, if (!util->diff_offset) util->diff_offset = buf.len; line[len - 1] = '\n'; - len = parse_git_diff_header(&root, &linenr, 0, line, + len = parse_git_diff_header(&root, &linenr, 1, line, len, size, &patch); if (len < 0) die(_("could not parse git header '%.*s'"), (int)len, line); @@ -148,12 +143,6 @@ static int read_patches(const char *range, struct string_list *list, strbuf_addstr(&buf, line); strbuf_addstr(&buf, "\n\n"); strbuf_addstr(&buf, " ## Commit message ##\n"); - } else if (starts_with(line, "Notes") && - line[strlen(line) - 1] == ':') { - strbuf_addstr(&buf, "\n\n"); - /* strip the trailing colon */ - strbuf_addf(&buf, " ## %.*s ##\n", - (int)(strlen(line) - 1), line); } else if (starts_with(line, " ")) { p = line + len - 2; while (isspace(*p) && p >= line) @@ -228,8 +217,8 @@ static void find_exact_matches(struct string_list *a, struct string_list *b) util->i = i; util->patch = a->items[i].string; util->diff = util->patch + util->diff_offset; - hashmap_entry_init(&util->e, strhash(util->diff)); - hashmap_add(&map, &util->e); + hashmap_entry_init(util, strhash(util->diff)); + hashmap_add(&map, util); } /* Now try to find exact matches in b */ @@ -239,8 +228,8 @@ static void find_exact_matches(struct string_list *a, struct string_list *b) util->i = i; util->patch = b->items[i].string; util->diff = util->patch + util->diff_offset; - hashmap_entry_init(&util->e, strhash(util->diff)); - other = hashmap_remove_entry(&map, util, e, NULL); + hashmap_entry_init(util, strhash(util->diff)); + other = hashmap_remove(&map, util, NULL); if (other) { if (other->matching >= 0) BUG("already assigned!"); @@ -250,7 +239,7 @@ static void find_exact_matches(struct string_list *a, struct string_list *b) } } - hashmap_free(&map); + hashmap_free(&map, 0); } static void diffsize_consume(void *data, char *line, unsigned long len) @@ -506,17 +495,16 @@ static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data) int show_range_diff(const char *range1, const char *range2, int creation_factor, int dual_color, - const struct diff_options *diffopt, - const struct argv_array *other_arg) + struct diff_options *diffopt) { int res = 0; struct string_list branch1 = STRING_LIST_INIT_DUP; struct string_list branch2 = STRING_LIST_INIT_DUP; - if (read_patches(range1, &branch1, other_arg)) + if (read_patches(range1, &branch1)) res = error(_("could not parse log for '%s'"), range1); - if (!res && read_patches(range2, &branch2, other_arg)) + if (!res && read_patches(range2, &branch2)) res = error(_("could not parse log for '%s'"), range2); if (!res) { -- cgit 1.4.1