summaryrefslogtreecommitdiff
path: root/range-diff.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-10-02 21:10:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-03 02:10:33 (GMT)
commit937b76ed4970214837314e26265b78793e6653ed (patch)
treeedf45e2942d3d851e1690b0d8caded186b4efa39 /range-diff.c
parent5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9 (diff)
downloadgit-937b76ed4970214837314e26265b78793e6653ed.zip
git-937b76ed4970214837314e26265b78793e6653ed.tar.gz
git-937b76ed4970214837314e26265b78793e6653ed.tar.bz2
range-diff: internally force `diff.noprefix=true`
When parsing the diffs, `range-diff` expects to see the prefixes `a/` and `b/` in the diff headers. These prefixes can be forced off via the config setting `diff.noprefix=true`. As `range-diff` is not prepared for that situation, this will cause a segmentation fault. Let's avoid that by passing the `--no-prefix` option to the `git log` process that generates the diffs that `range-diff` wants to parse. And of course expect the output to have no prefixes, then. Reported-by: Michal Suchánek <msuchanek@suse.de> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'range-diff.c')
-rw-r--r--range-diff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/range-diff.c b/range-diff.c
index ba1e9a4..f2fc1e0 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -52,6 +52,7 @@ 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
@@ -111,7 +112,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, 1, line,
+ len = parse_git_diff_header(&root, &linenr, 0, line,
len, size, &patch);
if (len < 0)
die(_("could not parse git header '%.*s'"), (int)len, line);