author | Junio C Hamano <junkio@cox.net> | |
Mon, 21 May 2007 06:51:06 +0000 (23:51 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 21 May 2007 06:51:06 +0000 (23:51 -0700) | ||
commit | 077e1af5983000266bc7c1423a87b7768ca03754 | |
tree | 972c5b8f9823cad61171fdd378ff23690de31faa | tree | snapshot |
parent | efe7f3586156bff4d29c347a1c41f93627c9f3e3 | commit | diff |
git-apply: Fix removal of new trailing blank lines.
The earlier code removed one newline too many from the hunk that
adds new lines at the end of the file. Also the way the code
counted the added blank lines was somewhat roundabout; I think
the way updated code does it is more direct and easier to
follow:
* We keep track of the number of blank lines added;
* While processing each line, we notice if it adds a blank
line, and increment the counter, or reset it to zero
otherwise;
* When actually we apply the data, we remove the empty lines we
counted earlier if we are applying it at the end of the
file.
Signed-off-by: Junio C Hamano <junkio@cox.net>
The earlier code removed one newline too many from the hunk that
adds new lines at the end of the file. Also the way the code
counted the added blank lines was somewhat roundabout; I think
the way updated code does it is more direct and easier to
follow:
* We keep track of the number of blank lines added;
* While processing each line, we notice if it adds a blank
line, and increment the counter, or reset it to zero
otherwise;
* When actually we apply the data, we remove the empty lines we
counted earlier if we are applying it at the end of the
file.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-apply.c | diff | blob | history |