author | Michael Schubert <mschub@elegosoft.com> | |
Wed, 21 Sep 2011 12:42:22 +0000 (14:42 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 22 Sep 2011 16:35:07 +0000 (09:35 -0700) | ||
commit | b9ab810b1826a7757e16f152faf0c28c2fdaa679 | |
tree | 13219d03e5a0e867c75b902a924376d68119be6a | tree | snapshot |
parent | f696543dad6c7ba27b0c4fab167a5687263a9ba0 | commit | diff |
patch-id.c: use strbuf instead of a fixed buffer
get_one_patchid() uses a rather dumb heuristic to determine if the
passed buffer is part of the next commit. Whenever the first 40 bytes
are a valid hexadecimal sha1 representation, get_one_patchid() returns
next_sha1.
Once the current line is longer than the fixed buffer, this will break
(provided the additional bytes make a valid hexadecimal sha1). As a result
patch-id returns incorrect results. Instead, use strbuf and read one line
at a time.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
get_one_patchid() uses a rather dumb heuristic to determine if the
passed buffer is part of the next commit. Whenever the first 40 bytes
are a valid hexadecimal sha1 representation, get_one_patchid() returns
next_sha1.
Once the current line is longer than the fixed buffer, this will break
(provided the additional bytes make a valid hexadecimal sha1). As a result
patch-id returns incorrect results. Instead, use strbuf and read one line
at a time.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/patch-id.c | diff | blob | history |