public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Michael Montalbo via GitGitGadget" <gitgitgadget@gmail•com>
To: git@vger•kernel.org
Cc: "D. Ben Knoble" <ben.knoble@gmail•com>,
	Michael Montalbo <mmontalbo@gmail•com>
Subject: [PATCH v3 0/3] line-log: integrate -L with the standard log output pipeline
Date: Thu, 28 May 2026 20:47:43 +0000	[thread overview]
Message-ID: <pull.2094.v3.git.1780001267.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2094.v2.git.1779738059.gitgitgadget@gmail.com>

Since its introduction, git log -L has short-circuited from
log_tree_commit() into its own output function, bypassing log_tree_diff()
and log_tree_diff_flush(). This skips no_free save/restore,
always_show_header, diff_free() cleanup, and means that pickaxe (-S, -G,
--find-object) and --diff-filter cannot suppress commits whose pairs are all
filtered out, because show_log() runs before diffcore_std().

This series restructures the flow so that -L goes through the same
log_tree_diff() -> log_tree_diff_flush() path as normal single-parent and
merge diffs, then uses that to enable several non-patch diff formats.

Patch 1: revision: move -L setup before output_format-to-diff derivation

Preparatory reorder in setup_revisions(). The -L block sets a default
DIFF_FORMAT_PATCH when no format is requested; move it before the derivation
of revs->diff from output_format so the default is visible to that check. No
behavior change on its own.

Patch 2: line-log: integrate -L output with the standard log-tree pipeline

Rename line_log_print() to line_log_queue_pairs(), stripping it down to only
queue pre-computed filepairs. log_tree_diff_flush() handles show_log(),
diffcore_std(), and diff_flush(). This fixes pickaxe and --diff-filter
suppression, and aligns the commit/diff separator with the rest of log
output. Rejects --full-diff, which is not yet supported when filepairs are
pre-computed.

Patch 3: line-log: allow non-patch diff formats with -L

Expand the allowlist to accept --raw, --name-only, --name-status, and
--summary. These only read filepair metadata already set by the line-log
machinery. Diff stat formats (--stat, --numstat, --shortstat, --dirstat)
remain blocked because they call compute_diffstat() on full blob content and
would show whole-file statistics rather than range-scoped ones.

Changes since v2:

 * Switch "! test_grep" to "test_grep !" in tests.

Michael Montalbo (3):
  revision: move -L setup before output_format-to-diff derivation
  line-log: integrate -L output with the standard log-tree pipeline
  line-log: allow non-patch diff formats with -L

 Documentation/line-range-options.adoc         |  10 +-
 line-log.c                                    |  30 ++----
 line-log.h                                    |   2 +-
 log-tree.c                                    |  10 +-
 revision.c                                    |  24 +++--
 t/t4211-line-log.sh                           | 100 +++++++++++++++---
 t/t4211/sha1/expect.parallel-change-f-to-main |   1 -
 .../sha256/expect.parallel-change-f-to-main   |   1 -
 8 files changed, 121 insertions(+), 57 deletions(-)


base-commit: 9f223ef1c026d91c7ac68cc0211bde255dda6199
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2094%2Fmmontalbo%2Fmm%2Fline-log-use-log-tree-diff-flush-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2094/mmontalbo/mm/line-log-use-log-tree-diff-flush-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/2094

Range-diff vs v2:

 1:  9633eb62c6 = 1:  9633eb62c6 revision: move -L setup before output_format-to-diff derivation
 2:  7acfc5376e = 2:  7acfc5376e line-log: integrate -L output with the standard log-tree pipeline
 3:  10a3d8dde2 ! 3:  ae0b7f3ca8 line-log: allow non-patch diff formats with -L
     @@ t/t4211-line-log.sh: test_expect_success '-p shows the default patch output' '
      +test_expect_success '--raw shows mode, oid, status and path' '
      +	git log -L1,24:b.c --raw --format= >actual &&
      +	test_grep "^:100644 100644 [0-9a-f]\{7\} [0-9a-f]\{7\} M	b.c$" actual &&
     -+	! test_grep "^diff --git" actual &&
     -+	! test_grep "^@@" actual
     ++	test_grep ! "^diff --git" actual &&
     ++	test_grep ! "^@@" actual
      +'
      +
      +test_expect_success '--name-only shows path' '
      +	git log -L1,24:b.c --name-only --format= >actual &&
      +	test_grep "^b.c$" actual &&
     -+	! test_grep "^diff --git" actual &&
     -+	! test_grep "^@@" actual
     ++	test_grep ! "^diff --git" actual &&
     ++	test_grep ! "^@@" actual
      +'
      +
      +test_expect_success '--name-status shows status and path' '
      +	git log -L1,24:b.c --name-status --format= >actual &&
      +	test_grep "^M	b.c$" actual &&
     -+	! test_grep "^diff --git" actual &&
     -+	! test_grep "^@@" actual
     ++	test_grep ! "^diff --git" actual &&
     ++	test_grep ! "^@@" actual
      +'
      +
      +test_expect_success '--stat is not yet supported with -L' '

-- 
gitgitgadget

  parent reply	other threads:[~2026-05-28 20:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  4:05 [PATCH 0/3] line-log: integrate -L with the standard log output pipeline Michael Montalbo via GitGitGadget
2026-04-28  4:05 ` [PATCH 1/3] revision: move -L setup before output_format-to-diff derivation Michael Montalbo via GitGitGadget
2026-04-28  4:05 ` [PATCH 2/3] line-log: integrate -L output with the standard log-tree pipeline Michael Montalbo via GitGitGadget
2026-04-28  4:05 ` [PATCH 3/3] line-log: allow non-patch diff formats with -L Michael Montalbo via GitGitGadget
2026-05-12  4:01 ` [PATCH 0/3] line-log: integrate -L with the standard log output pipeline Junio C Hamano
2026-05-22 18:48 ` D. Ben Knoble
     [not found] ` <CALnO6CBh7nDCwT=u1xSN2c6_x88t_gNfAaT_B4PzYKr=5i_bNA@mail.gmail.com>
2026-05-24  2:00   ` Michael Montalbo
2026-05-25 19:40 ` [PATCH v2 " Michael Montalbo via GitGitGadget
2026-05-25 19:40   ` [PATCH v2 1/3] revision: move -L setup before output_format-to-diff derivation Michael Montalbo via GitGitGadget
2026-05-25 19:40   ` [PATCH v2 2/3] line-log: integrate -L output with the standard log-tree pipeline Michael Montalbo via GitGitGadget
2026-05-25 19:40   ` [PATCH v2 3/3] line-log: allow non-patch diff formats with -L Michael Montalbo via GitGitGadget
2026-05-27 20:20   ` [PATCH v2 0/3] line-log: integrate -L with the standard log output pipeline D. Ben Knoble
2026-05-28 18:55     ` Junio C Hamano
2026-05-28 19:31       ` Michael Montalbo
2026-05-28 20:47   ` Michael Montalbo via GitGitGadget [this message]
2026-05-28 20:47     ` [PATCH v3 1/3] revision: move -L setup before output_format-to-diff derivation Michael Montalbo via GitGitGadget
2026-05-28 20:47     ` [PATCH v3 2/3] line-log: integrate -L output with the standard log-tree pipeline Michael Montalbo via GitGitGadget
2026-05-28 20:47     ` [PATCH v3 3/3] line-log: allow non-patch diff formats with -L Michael Montalbo via GitGitGadget
2026-05-29 12:04     ` [PATCH v3 0/3] line-log: integrate -L with the standard log output pipeline Ben Knoble
2026-06-01 21:53       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.2094.v3.git.1780001267.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail$(echo .)com \
    --cc=ben.knoble@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=mmontalbo@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox