author | Linus Torvalds <torvalds@osdl.org> | |
Sat, 25 Mar 2006 21:28:28 +0000 (13:28 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 26 Mar 2006 00:34:05 +0000 (16:34 -0800) | ||
commit | c150462824008957f568ca7aa05a65b35d860eb9 | |
tree | 9f0213576687c9fb2389e8f404b336901383f430 | tree | snapshot |
parent | 6a1640ffc6431d66fa33c8256fd19b5ee0bc1b47 | commit | diff |
git-apply: safety fixes
This was triggered by me testing the "@@" numbering shorthand by GNU
patch, which not only showed that git-apply thought it meant the number
was duplicated (when it means that the second number is 1), but my tests
showed than when git-apply mis-understood the number, it would then not
raise an alarm about it if the patch ended early.
Now, this doesn't actually _matter_, since with a three-line context, the
only case that "x,1" will be shorthanded to "x" is when x itself is 1 (in
which case git-apply got it right), but the fact that git-apply would also
silently accept truncated patches was a missed opportunity for additional
sanity-checking.
So make git-apply refuse to look at a patch fragment that ends early.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This was triggered by me testing the "@@" numbering shorthand by GNU
patch, which not only showed that git-apply thought it meant the number
was duplicated (when it means that the second number is 1), but my tests
showed than when git-apply mis-understood the number, it would then not
raise an alarm about it if the patch ended early.
Now, this doesn't actually _matter_, since with a three-line context, the
only case that "x,1" will be shorthanded to "x" is when x itself is 1 (in
which case git-apply got it right), but the fact that git-apply would also
silently accept truncated patches was a missed opportunity for additional
sanity-checking.
So make git-apply refuse to look at a patch fragment that ends early.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
apply.c | diff | blob | history |