diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-02-19 23:36:55 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-28 13:55:56 -0800 |
commit | c5a589740601789dc5af3790885c3d21e09cc6a4 (patch) | |
tree | a6cc65ea3316e5ef4724b4d449f446887b5fd145 /revision.c | |
parent | e325bf7d045de2976cc3c048922f1b727a468d41 (diff) | |
download | git-jc/diff-ignore-case.tar.gz |
diff: -i is "--ignore-case" but means a bit more in "log"jc/diff-ignore-case
The previous patch to teach "--ignore-case" option to our "diff" machinery
deliberately omitted a short-and-sweet "-i" that GNU diff uses to ask for
"--ignore-case". This is because our diff machinery is often used by and
shares the command line options with the commands in the "git log" family,
where the short option already means something entirely different.
Namely, it instructs us to use case-insensitive match when looking for
commits that match strings that appear in the commit object itself,
e.g. --author and --grep.
Tweak the option parser so that "-i" means both, so that
$ git log --grep=frotz -i -p
first picks commits that have string "frotz" in any combination of cases,
and then shows patches that ignore case-only changes for them, while
"--ignore-case" and "--regexp-ignore-case" can be used to mean only one,
that is:
$ git log --grep=frotz --regexp-ignore-case -p
would pick the same set of commits, but the patches shown by it does not
ignore case-only changes while:
$ git log --grep=frotz --ignore-case -p
would pick commits that has "frotz" in all lowercase, but shows patches
that ignore case-only changes for the chosen commits.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/revision.c b/revision.c index 8764dde381..f1a13548e2 100644 --- a/revision.c +++ b/revision.c @@ -13,6 +13,7 @@ #include "decorate.h" #include "log-tree.h" #include "string-list.h" +#include "xdiff-interface.h" volatile show_early_output_fn_t show_early_output; @@ -1557,7 +1558,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg return argcount; } else if (!strcmp(arg, "--extended-regexp") || !strcmp(arg, "-E")) { revs->grep_filter.regflags |= REG_EXTENDED; - } else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) { + } else if (!strcmp(arg, "-i")) { + DIFF_XDL_SET(&revs->diffopt, IGNORE_CASE); + revs->grep_filter.regflags |= REG_ICASE; + } else if (!strcmp(arg, "--regexp-ignore-case")) { revs->grep_filter.regflags |= REG_ICASE; } else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) { revs->grep_filter.fixed = 1; |