author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Mon, 16 Mar 2009 18:38:42 +0000 (19:38 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 17 Mar 2009 22:10:12 +0000 (15:10 -0700) | ||
commit | 50fd6997c60f926efe4b3591f6c0a37568d02185 | |
tree | d46e68d31f209931e6ca0acf90a4521cf7ec532b | tree | snapshot |
parent | 01d386121758ac72aedd5f268feb763d53fc3cdf | commit | diff |
pickaxe: count regex matches only once
When --pickaxe-regex is used, forward past the end of matches instead of
advancing to the byte after their start. This way matches count only
once, even if the regular expression matches their tail -- like in the
fixed-string fork of the code.
E.g.: /.*/ used to count the number of bytes instead of the number of
lines. /aa/ resulted in a count of two in "aaa" instead of one.
Also document the fact that regexec() needs a NUL-terminated string as
its second argument by adding an assert().
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When --pickaxe-regex is used, forward past the end of matches instead of
advancing to the byte after their start. This way matches count only
once, even if the regular expression matches their tail -- like in the
fixed-string fork of the code.
E.g.: /.*/ used to count the number of bytes instead of the number of
lines. /aa/ resulted in a count of two in "aaa" instead of one.
Also document the fact that regexec() needs a NUL-terminated string as
its second argument by adding an assert().
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-pickaxe.c | diff | blob | history |