summaryrefslogtreecommitdiff
path: root/builtin-blame.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-06-10 01:14:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-06-10 01:34:58 (GMT)
commitb82871b3c32faa8a317007f343fdf2d0ddc9954e (patch)
tree0e925e128b7b83750e2b8b0d901d7d518cadbdaf /builtin-blame.c
parentf291504563a5c96862e600247d233f91572a005f (diff)
downloadgit-b82871b3c32faa8a317007f343fdf2d0ddc9954e.zip
git-b82871b3c32faa8a317007f343fdf2d0ddc9954e.tar.gz
git-b82871b3c32faa8a317007f343fdf2d0ddc9954e.tar.bz2
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>
Diffstat (limited to 'builtin-blame.c')
-rw-r--r--builtin-blame.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin-blame.c b/builtin-blame.c
index 5905333..f7e2c13 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -20,7 +20,7 @@
#include "mailmap.h"
static char blame_usage[] =
-"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"
+"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"
" -c Use the same output mode as git-annotate (Default: off)\n"
" -b Show blank SHA-1 for boundary commits (Default: off)\n"
" -l Show long commit SHA1 (Default: off)\n"
@@ -30,6 +30,7 @@ static char blame_usage[] =
" -n, --show-number Show original linenumber (Default: off)\n"
" -s Suppress author name and timestamp (Default: off)\n"
" -p, --porcelain Show in a format designed for machine consumption\n"
+" -w Ignore whitespace differences\n"
" -L n,m Process only line range n,m, counting from 1\n"
" -M, -C Find line movements within and across files\n"
" --incremental Show blame entries as we find them, incrementally\n"
@@ -45,6 +46,7 @@ static int show_root;
static int blank_boundary;
static int incremental;
static int cmd_is_annotate;
+static int xdl_opts = XDF_NEED_MINIMAL;
static struct path_list mailmap;
#ifndef DEBUG
@@ -515,7 +517,7 @@ static struct patch *compare_buffer(mmfile_t *file_p, mmfile_t *file_o,
xdemitconf_t xecfg;
xdemitcb_t ecb;
- xpp.flags = XDF_NEED_MINIMAL;
+ xpp.flags = xdl_opts;
xecfg.ctxlen = context;
xecfg.flags = 0;
ecb.outf = xdiff_outf;
@@ -2159,6 +2161,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
output_option |= OUTPUT_LONG_OBJECT_NAME;
else if (!strcmp("-s", arg))
output_option |= OUTPUT_NO_AUTHOR;
+ else if (!strcmp("-w", arg))
+ xdl_opts |= XDF_IGNORE_WHITESPACE;
else if (!strcmp("-S", arg) && ++i < argc)
revs_file = argv[i];
else if (!prefixcmp(arg, "-M")) {