git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] line-log: suppress diff output with "-s"

From
Jeff King <peff@peff.net>
Date
Mar 8, 2019, 16:20 UTC
Message-ID
<20190308162031.GA17326@sigill.intra.peff.net>
In-Reply-To
<nycvar.QRO.7.76.6.1903081636350.41@tvgsbejvaqbjf.bet>
On Fri, Mar 08, 2019 at 04:38:44PM +0100, Johannes Schindelin wrote:
Show 13 quoted lines
> On Thu, 7 Mar 2019, Jeff King wrote:
> 
> > When "-L" is in use, we ignore any diff output format that the user
> > provides to us, and just always print a patch (with extra context lines
> > covering the whole area of interest). It's not entirely clear what we
> > should do with all formats (e.g., should "--stat" show just the diffstat
> > of the touched lines, or the stat for the whole file?).
> > 
> > But "-s" is pretty clear: the user probably wants to see just the
> > commits that touched those lines, without any diff at all. Let's at
> > least make that work.
> 
> Agree. The patch looks obviously good.

Thanks. This leaves the other formats as silently ignored. Do we want to do something like this:

diff --git a/revision.c b/revision.c
index eb8e51bc63..a1b4fe2aa6 100644
--- a/revision.c
+++ b/revision.c
@@ -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;
 

?

-Peff
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 6 in “line-log: suppress diff output with "-s"”
  1. line-log: suppress diff output with "-s"Jeff King, Mar 7, 2019
  2. Johannes SchindelinMar 8, 2019
  3. Jeff KingMar 8, 2019
  4. Johannes SchindelinMar 8, 2019
  5. Jeff KingMar 11, 2019
  6. Junio C HamanoMar 11, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.