mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
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>
This commit is contained in:
parent
621603b76a
commit
f21d672615
11
apply.c
11
apply.c
|
@ -75,6 +75,15 @@ static void parse_whitespace_option(const char *option)
|
||||||
die("unrecognized whitespace option '%s'", 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
|
* 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
|
* we've seen, and the longest filename. That allows us to do simple
|
||||||
|
@ -1955,9 +1964,11 @@ int main(int argc, char **argv)
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
usage(apply_usage);
|
usage(apply_usage);
|
||||||
read_stdin = 0;
|
read_stdin = 0;
|
||||||
|
set_default_whitespace_mode(whitespace_option);
|
||||||
apply_patch(fd, arg);
|
apply_patch(fd, arg);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
set_default_whitespace_mode(whitespace_option);
|
||||||
if (read_stdin)
|
if (read_stdin)
|
||||||
apply_patch(0, "<stdin>");
|
apply_patch(0, "<stdin>");
|
||||||
if (whitespace_error) {
|
if (whitespace_error) {
|
||||||
|
|
Loading…
Reference in a new issue