Merge branch 'js/range-diff-noprefix'

"git range-diff" segfaulted when diff.noprefix configuration was
used, as it blindly expected the patch it internally generates to
have the standard a/ and b/ prefixes.  The command now forces the
internal patch to be built without any prefix, not to be affected
by any end-user configuration.

* js/range-diff-noprefix:
  range-diff: internally force `diff.noprefix=true`
This commit is contained in:
Junio C Hamano 2019-10-11 14:24:47 +09:00
commit 159cdabd87
2 changed files with 6 additions and 1 deletions

View File

@ -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);

View File

@ -461,4 +461,8 @@ test_expect_success 'format-patch --range-diff as commentary' '
grep "> 1: .* new message" 0001-*
'
test_expect_success 'range-diff overrides diff.noprefix internally' '
git -c diff.noprefix=true range-diff HEAD^...
'
test_done