From: Junio C Hamano <gitster@pobox.com> Date: Wed, 9 Jul 2014 18:33:27 +0000 (-0700) Subject: Merge branch 'jk/skip-prefix' X-Git-Tag: v2.1.0-rc0~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e91ae32a01ffe294b8510c1d8cd7138493a0712f;p=git Merge branch 'jk/skip-prefix' * jk/skip-prefix: http-push: refactor parsing of remote object names imap-send: use skip_prefix instead of using magic numbers use skip_prefix to avoid repeated calculations git: avoid magic number with skip_prefix fetch-pack: refactor parsing in get_ack fast-import: refactor parsing of spaces stat_opt: check extra strlen call daemon: use skip_prefix to avoid magic numbers fast-import: use skip_prefix for parsing input use skip_prefix to avoid repeating strings use skip_prefix to avoid magic numbers transport-helper: avoid reading past end-of-string fast-import: fix read of uninitialized argv memory apply: use skip_prefix instead of raw addition refactor skip_prefix to return a boolean avoid using skip_prefix as a boolean daemon: mark some strings as const parse_diff_color_slot: drop ofs parameter --- e91ae32a01ffe294b8510c1d8cd7138493a0712f diff --cc commit.c index 4ff8077dbf,dfc0eb0241..fb7897c2a4 --- a/commit.c +++ b/commit.c @@@ -612,10 -544,19 +612,9 @@@ static void record_author_date(struct a char *date_end; unsigned long date; - if (!commit->buffer) { - unsigned long size; - enum object_type type; - buffer = read_sha1_file(commit->object.sha1, &type, &size); - if (!buffer) - return; - } - - for (buf = commit->buffer ? commit->buffer : buffer; - buf; - buf = line_end + 1) { + for (buf = buffer; buf; buf = line_end + 1) { line_end = strchrnul(buf, '\n'); - ident_line = skip_prefix(buf, "author "); - if (!ident_line) { + if (!skip_prefix(buf, "author ", &ident_line)) { if (!line_end[0] || line_end[1] == '\n') return; /* end of header */ continue; diff --cc fsck.c index a7233c8d0b,bdbea2b995..a4e8593e78 --- a/fsck.c +++ b/fsck.c @@@ -276,10 -276,9 +276,9 @@@ static int fsck_ident(const char **iden return 0; } -static int fsck_commit(struct commit *commit, fsck_error error_func) +static int fsck_commit_buffer(struct commit *commit, const char *buffer, + fsck_error error_func) { - const char *tmp; - const char *buffer = commit->buffer; unsigned char tree_sha1[20], sha1[20]; struct commit_graft *graft; int parents = 0;