From: Junio C Hamano Date: Fri, 3 Jun 2016 21:38:03 +0000 (-0700) Subject: Merge branch 'rs/patch-id-use-skip-prefix' X-Git-Tag: v2.9.0-rc2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=29e54b019f55f48af3f0d4c62eede86058c16b52;p=thirdparty%2Fgit.git Merge branch 'rs/patch-id-use-skip-prefix' Code clean-up. * rs/patch-id-use-skip-prefix: patch-id: use starts_with() and skip_prefix() --- 29e54b019f55f48af3f0d4c62eede86058c16b52 diff --cc builtin/patch-id.c index 366ce5a5d4,f21b6e34f6..a84d0003a3 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@@ -81,19 -81,16 +81,16 @@@ static int get_one_patchid(struct objec while (strbuf_getwholeline(line_buf, stdin, '\n') != EOF) { char *line = line_buf->buf; - char *p = line; + const char *p = line; int len; - if (!memcmp(line, "diff-tree ", 10)) - p += 10; - else if (!memcmp(line, "commit ", 7)) - p += 7; - else if (!memcmp(line, "From ", 5)) - p += 5; - else if (!memcmp(line, "\\ ", 2) && 12 < strlen(line)) + if (!skip_prefix(line, "diff-tree ", &p) && + !skip_prefix(line, "commit ", &p) && + !skip_prefix(line, "From ", &p) && + starts_with(line, "\\ ") && 12 < strlen(line)) continue; - if (!get_sha1_hex(p, next_sha1)) { + if (!get_oid_hex(p, next_oid)) { found_next = 1; break; }