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

[PATCH 2/4] blame: add option to show only blamed commits `--blame-only`

From
Philip Oakley <philipoakley@iee.email>
Date
May 25, 2020, 21:57 UTC
Message-ID
<20200525215751.1735-3-philipoakley@iee.email>
In-Reply-To
<20200525215751.1735-1-philipoakley@iee.email>

For large files the will be many lines which are not blamed with the revision range or date period which clutter the output.

Add an option to suppress the display of boundary commits lines, not just the object id (`-b` option).

This is non-functional at this stage. The next commit will add functionality, tests, and documenation.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
---
 Documentation/blame-options.txt | 4 ++++
 Documentation/git-blame.txt     | 2 +-
 builtin/blame.c                 | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt
index 5d122db6e9..b4b27033a6 100644
--- a/Documentation/blame-options.txt
+++ b/Documentation/blame-options.txt
@@ -2,6 +2,10 @@
 	Show blank SHA-1 for boundary commits.  This can also
 	be controlled via the `blame.blankboundary` config option.
 
+--blame-only::
+	Do not show any boundary commit lines created by revision range
+	specifiers. Only show blamed lines.
+
 --root::
 	Do not treat root commits as boundaries.  This can also be
 	controlled via the `blame.showRoot` config option.
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index 02f9ad6fe9..74b6344c7b 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental]
-	    [-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
+	    [-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>] [--blame-only]
 	    [--ignore-rev <rev>] [--ignore-revs-file <file>]
 	    [--progress] [--abbrev=<n>] [<rev> | --contents <file> | --reverse <rev>..<rev>]
 	    [--] <file>
diff --git a/builtin/blame.c b/builtin/blame.c
index bf1cecdf3f..b699c777c4 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -45,6 +45,7 @@ static int max_score_digits;
 static int show_root;
 static int reverse;
 static int blank_boundary;
+static int blame_only;
 static int incremental;
 static int xdl_opts;
 static int abbrev = -1;
@@ -843,6 +844,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 	const struct option options[] = {
 		OPT_BOOL(0, "incremental", &incremental, N_("Show blame entries as we find them, incrementally")),
 		OPT_BOOL('b', NULL, &blank_boundary, N_("Show blank SHA-1 for boundary commits (Default: off)")),
+		OPT_BOOL(0, "blame-only", &blame_only, N_("Only show blamed commits (Default: off)")),
 		OPT_BOOL(0, "root", &show_root, N_("Do not treat root commits as boundaries (Default: off)")),
 		OPT_BOOL(0, "show-stats", &show_stats, N_("Show work cost statistics")),
 		OPT_BOOL(0, "progress", &show_progress, N_("Force progress reporting")),
-- 
2.26.2.windows.1.13.g9dddff6983
Previous: Philip OakleyNext: Philip Oakley
Message 3 of 14 in “Selectively show only blamed limes”
  1. 0/4 Selectively show only blamed limesPhilip Oakley, May 25, 2020
  2. 1/4 doc: blame: show the boundary commit '^' caret markPhilip Oakley, May 25, 2020
  3. 2/4 blame: add option to show only blamed commits `--blame-only`Philip Oakley, May 25, 2020
  4. 3/4 blame: do not show boundary commits, only those blamedPhilip Oakley, May 25, 2020
  5. 4/4 blame: test the -b option, use blank oid for boundary commits.Philip Oakley, May 25, 2020
  6. Jeff KingMay 27, 2020
  7. Philip OakleyMay 27, 2020
  8. Jeff KingMay 27, 2020
  9. Philip OakleyMay 27, 2020
  10. Jeff KingMay 28, 2020
  11. Junio C HamanoMay 28, 2020
  12. Philip OakleyMay 30, 2020
  13. Junio C HamanoMay 31, 2020
  14. Junio C HamanoMay 31, 2020

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.