git-blame -w: ignore whitespace
When refactoring code to split one iteration of a too deeply nested loop into a separate function, it inevitably makes the indentation levels shallower (that's the sole point of such a refactoring). With "git blame -w", you can ignore such re-indentation and pass blame for such moved lines to the parent. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 9, 2007 at 18:14 UTC
b82871b3c32faa8a317007f343fdf2d0ddc9954e
2 files changed
+12
-3
Documentation/git-blame.txt
+6
-1
@@ -8,7 +8,7 @@ git-blame - Show what revision and author last modified each line of a file
8
SYNOPSIS
9
--------
10
[verse]
11
-'git-blame' [-c] [-b] [--root] [-s] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m]
11
+'git-blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [--incremental] [-L n,m]
12
[-S <revs-file>] [-M] [-C] [-C] [--since=<date>]
13
[<rev> | --contents <file>] [--] <file>
14
@@ -63,6 +63,11 @@ include::blame-options.txt[]
63
-s::
64
Suppress author name and timestamp from the output.
65
66
+-w::
67
+ Ignore whitespace when comparing parent's version and
68
+ child's to find where the lines came from.
69
+
70
+
71
THE PORCELAIN FORMAT
72
--------------------
73
builtin-blame.c
+6
-2
@@ -20,7 +20,7 @@
20
#include "mailmap.h"
21
22
static char blame_usage[] =
23
-"git-blame [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [--contents <filename>] [--incremental] [commit] [--] file\n"
23
+"git-blame [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [--contents <filename>] [--incremental] [commit] [--] file\n"
24
" -c Use the same output mode as git-annotate (Default: off)\n"
25
" -b Show blank SHA-1 for boundary commits (Default: off)\n"
26
" -l Show long commit SHA1 (Default: off)\n"
@@ -30,6 +30,7 @@ static char blame_usage[] =
30
" -n, --show-number Show original linenumber (Default: off)\n"
31
" -s Suppress author name and timestamp (Default: off)\n"
32
" -p, --porcelain Show in a format designed for machine consumption\n"
33
+" -w Ignore whitespace differences\n"
34
" -L n,m Process only line range n,m, counting from 1\n"
35
" -M, -C Find line movements within and across files\n"
36
" --incremental Show blame entries as we find them, incrementally\n"
@@ -45,6 +46,7 @@ static int show_root;
46
static int blank_boundary;
47
static int incremental;
48
static int cmd_is_annotate;
49
+static int xdl_opts = XDF_NEED_MINIMAL;
50
static struct path_list mailmap;
51
52
#ifndef DEBUG
@@ -515,7 +517,7 @@ static struct patch *compare_buffer(mmfile_t *file_p, mmfile_t *file_o,
517
xdemitconf_t xecfg;
518
xdemitcb_t ecb;
519
518
- xpp.flags = XDF_NEED_MINIMAL;
520
+ xpp.flags = xdl_opts;
521
xecfg.ctxlen = context;
522
xecfg.flags = 0;
523
ecb.outf = xdiff_outf;
@@ -2159,6 +2161,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
2161
output_option |= OUTPUT_LONG_OBJECT_NAME;
2162
else if (!strcmp("-s", arg))
2163
output_option |= OUTPUT_NO_AUTHOR;
2164
+ else if (!strcmp("-w", arg))
2165
+ xdl_opts |= XDF_IGNORE_WHITESPACE;
2166
else if (!strcmp("-S", arg) && ++i < argc)
2167
revs_file = argv[i];
2168
else if (!prefixcmp(arg, "-M")) {