diff options
author | Junio C Hamano <junkio@cox.net> | 2006-02-28 09:12:52 (GMT) |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-28 09:17:14 (GMT) |
commit | 56248c5a5c77f65fe591dfec3ac413147d227ec4 (patch) | |
tree | 290fa093ceb0da4d49ae0a505bd451bea31b125e | |
parent | 5c0d46eb3d5ab9182a2c6d942189671720f80f74 (diff) | |
download | git-56248c5a5c77f65fe591dfec3ac413147d227ec4.zip git-56248c5a5c77f65fe591dfec3ac413147d227ec4.tar.gz git-56248c5a5c77f65fe591dfec3ac413147d227ec4.tar.bz2 |
git-apply: war on whitespace -- finishing touches.
This changes the default --whitespace policy to nowarn when we
are only getting --stat, --summary etc. IOW when not applying
the patch. When applying the patch, the default is warn (spit
out warning message but apply the patch).
Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r-- | apply.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -75,6 +75,15 @@ static void parse_whitespace_option(const char *option) die("unrecognized whitespace option '%s'", option); } +static void set_default_whitespace_mode(const char *whitespace_option) +{ + if (!whitespace_option && !apply_default_whitespace) { + new_whitespace = (apply + ? warn_on_whitespace + : nowarn_whitespace); + } +} + /* * For "diff-stat" like behaviour, we keep track of the biggest change * we've seen, and the longest filename. That allows us to do simple @@ -1947,9 +1956,11 @@ int main(int argc, char **argv) if (fd < 0) usage(apply_usage); read_stdin = 0; + set_default_whitespace_mode(whitespace_option); apply_patch(fd, arg); close(fd); } + set_default_whitespace_mode(whitespace_option); if (read_stdin) apply_patch(0, "<stdin>"); if (whitespace_error) { |