X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=apply.c;h=453482a035d76a14b04fa4182694a3d46db083e7;hb=56248c5a5c77f65fe591dfec3ac413147d227ec4;hp=af9900ff1e8281e9a1d1c4b2ec98e6408ae49027;hpb=5c0d46eb3d5ab9182a2c6d942189671720f80f74;p=git.git diff --git a/apply.c b/apply.c index af9900ff..453482a0 100644 --- a/apply.c +++ b/apply.c @@ -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, ""); if (whitespace_error) {