From: Giuseppe Bilotta Date: Fri, 31 Jul 2009 20:40:58 GMT Subject: [PATCHv4] git apply: option to ignore whitespace differences Message-ID: <1249072858-21894-1-git-send-email-giuseppe.bilotta@gmail.com> Introduce --ignore-whitespace / --ignore-space-change option and corresponding config apply.ignorewhitespace to ignore changes in whitespace of context lines while applying patches. The two names match the corresponding option resp. in 'patch' and 'git diff'. 'git am', 'git rebase' and the bash git completion are made aware of the option. Signed-off-by: Giuseppe Bilotta --- Changes wrt the previous version: * the option has a dual name * the option management has a cleaner structure, allowing an easier implementation of options such as --ignore-space-at-eol or --ignore-all-space * the documentation mentions that ignoring changes in whitespace prevents context lines from being whitespace-fixed Documentation/config.txt | 8 ++ Documentation/git-am.txt | 5 +- Documentation/git-apply.txt | 13 +++ Documentation/git-rebase.txt | 3 +- builtin-apply.c | 172 ++++++++++++++++++++++++++++++-- cache.h | 1 + contrib/completion/git-completion.bash | 3 + environment.c | 1 + git-am.sh | 4 +- git-rebase.sh | 3 + t/t4107-apply-ignore-whitespace.sh | 149 +++++++++++++++++++++++++++ 11 files changed, 352 insertions(+), 10 deletions(-) create mode 100755 t/t4107-apply-ignore-whitespace.sh diff --git a/Documentation/config.txt b/Documentation/config.txt index c6f09f8..0b53cab 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -461,6 +461,14 @@ it will be treated as a shell command. For example, defining executed from the top-level directory of a repository, which may not necessarily be the current directory. +apply.ignorewhitespace:: + When set to 'change', tells 'git-apply' to ignore changes in + whitespace, in the same way as the '--ignore-space-change' + option. + When set to one of: no, none, never, false tells 'git-apply' to + respect all whitespace differences. + See linkgit:git-apply[1]. + apply.whitespace:: Tells 'git-apply' how to handle whitespaces, in the same way as the '--whitespace' option. See linkgit:git-apply[1]. diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 32e689b..fcacc94 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'git am' [--signoff] [--keep] [--utf8 | --no-utf8] [--3way] [--interactive] [--committer-date-is-author-date] - [--ignore-date] + [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=