зеркало из https://github.com/microsoft/git.git
Merge branch 'jk/line-log-with-patch'
"git log -L<from>,<to>:<path>" with "-s" did not suppress the patch output as it should. This has been corrected. * jk/line-log-with-patch: line-log: detect unsupported formats line-log: suppress diff output with "-s"
This commit is contained in:
Коммит
31df2c1019
|
@ -1103,10 +1103,12 @@ static int process_all_files(struct line_log_data **range_out,
|
|||
|
||||
int line_log_print(struct rev_info *rev, struct commit *commit)
|
||||
{
|
||||
struct line_log_data *range = lookup_line_range(rev, commit);
|
||||
|
||||
show_log(rev);
|
||||
dump_diff_hacky(rev, range);
|
||||
if (!(rev->diffopt.output_format & DIFF_FORMAT_NO_OUTPUT)) {
|
||||
struct line_log_data *range = lookup_line_range(rev, commit);
|
||||
dump_diff_hacky(rev, range);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -2689,6 +2689,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
|
|||
if (revs->first_parent_only && revs->bisect)
|
||||
die(_("--first-parent is incompatible with --bisect"));
|
||||
|
||||
if (revs->line_level_traverse &&
|
||||
(revs->diffopt.output_format & ~(DIFF_FORMAT_PATCH | DIFF_FORMAT_NO_OUTPUT)))
|
||||
die(_("-L does not yet support diff formats besides -p and -s"));
|
||||
|
||||
if (revs->expand_tabs_in_log < 0)
|
||||
revs->expand_tabs_in_log = revs->expand_tabs_in_log_default;
|
||||
|
||||
|
|
|
@ -115,4 +115,21 @@ test_expect_success 'range_set_union' '
|
|||
git log $(for x in $(test_seq 200); do echo -L $((2*x)),+1:c.c; done)
|
||||
'
|
||||
|
||||
test_expect_success '-s shows only line-log commits' '
|
||||
git log --format="commit %s" -L1,24:b.c >expect.raw &&
|
||||
grep ^commit expect.raw >expect &&
|
||||
git log --format="commit %s" -L1,24:b.c -s >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success '-p shows the default patch output' '
|
||||
git log -L1,24:b.c >expect &&
|
||||
git log -L1,24:b.c -p >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success '--raw is forbidden' '
|
||||
test_must_fail git log -L1,24:b.c --raw
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче