mirror of
https://github.com/git/git.git
synced 2026-06-30 19:58:12 +00:00
line-log: integrate -L output with the standard log-tree pipeline
`git log -L` has bypassed log_tree_diff() and log_tree_diff_flush()
since the feature was introduced, short-circuiting from
log_tree_commit() directly into line_log_print(). This skips the
no_free save/restore (noted in a NEEDSWORK comment added by
f8781bfda3), the always_show_header fallback, show_diff_of_diff(),
and diff_free() cleanup.
Restructure so that -L flows through log_tree_diff() ->
log_tree_diff_flush(), the same path used by the normal
single-parent and merge diff codepaths:
- Rename line_log_print() to line_log_queue_pairs() and strip it
down to just queuing pre-computed filepairs. The show_log(),
separator, diffcore_std(), and diff_flush() calls are removed
since log_tree_diff_flush() handles all of those.
- In log_tree_diff(), call line_log_queue_pairs() then
log_tree_diff_flush(), mirroring the diff_tree_oid() + flush
pattern used by the single-parent and merge codepaths.
- Remove the early return in log_tree_commit() that is no longer
needed now that -L output flows through log_tree_diff() and
log_tree_diff_flush(); this restores no_free save/restore,
always_show_header, and diff_free() cleanup.
Because show_log() is now deferred until after diffcore_std() inside
log_tree_diff_flush(), pickaxe (-S, -G, --find-object) and
--diff-filter now properly suppress commits when all pairs are
filtered out.
The blank-line separator between commit header and diff changes
slightly: the old code printed one unconditionally, while
log_tree_diff_flush() only emits one for verbose headers. This
matches the rest of log output.
Also reject --full-diff, which is not yet supported with -L: the
filepairs are pre-computed during the history walk and scoped to
tracked line ranges, so there is currently no full-tree diff to
fall back to for display.
Update tests accordingly.
Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
558057cf4f
commit
42d960748e
10
log-tree.c
10
log-tree.c
@@ -1105,6 +1105,12 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
|
||||
if (!all_need_diff && !opt->merges_need_diff)
|
||||
return 0;
|
||||
|
||||
if (opt->line_level_traverse) {
|
||||
line_log_queue_pairs(opt, commit);
|
||||
log_tree_diff_flush(opt);
|
||||
return !opt->loginfo;
|
||||
}
|
||||
|
||||
parse_commit_or_die(commit);
|
||||
oid = get_commit_tree_oid(commit);
|
||||
|
||||
@@ -1179,10 +1185,6 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
|
||||
opt->loginfo = &log;
|
||||
opt->diffopt.no_free = 1;
|
||||
|
||||
/* NEEDSWORK: no restoring of no_free? Why? */
|
||||
if (opt->line_level_traverse)
|
||||
return line_log_print(opt, commit);
|
||||
|
||||
if (opt->track_linear && !opt->linear && !opt->reverse_output_stage)
|
||||
fprintf(opt->diffopt.file, "\n%s\n", opt->break_bar);
|
||||
shown = log_tree_diff(opt, commit, &log);
|
||||
|
||||
Reference in New Issue
Block a user