Re: [PATCH 15/16] refs: add LMDB refs backend
- From
David Turner <dturner@twopensource.com>
- Date
- Dec 5, 2015, 00:25 UTC
- Message-ID
- <1449275136.3858.2.camel@twopensource.com>
- In-Reply-To
- <xmqqzixpoiyt.fsf@gitster.mtv.corp.google.com>
On Fri, 2015-12-04 at 16:08 -0800, Junio C Hamano wrote:
Show 31 quoted lines
> David Turner <dturner@twopensource.com> writes:
>
> > + while (!mdb_ret) {
> > + if (starts_with(key.mv_data, refname) &&
> > + ((char*)key.mv_data)[refname_len - 2] == '/') {
>
> ERROR: "(foo*)" should be "(foo *)"
> #877: FILE: refs/lmdb-backend.c:514:
> + ((char*)key.mv_data)[refname_len - 2] == '/') {
>
> > +static int show_one_reflog_ent(struct strbuf *sb, each_reflog_ent_fn fn, void *cb_data)
> > +{
> > + unsigned char osha1[20], nsha1[20];
> > + char *email_end, *message;
> > + unsigned long timestamp;
> > + int tz;
> > +
> > + /* old (raw) new (raw) name <email> SP time TAB msg LF */
> > + if (sb->len < 41 || sb->buf[sb->len - 1] != '\n' ||
> > + !(email_end = strchr(sb->buf + 40, '>')) ||
> > + email_end[1] != ' ' ||
> > + !(timestamp = strtoul(email_end + 2, &message, 10)) ||
> > + !message || message[0] != ' ' ||
> > + (message[1] != '+' && message[1] != '-') ||
> > + !isdigit(message[2]) || !isdigit(message[3]) ||
> > + !isdigit(message[4]) || !isdigit(message[5]))
> > + return 0; /* corrupt? */
>
> ERROR: do not use assignment in if condition
> #1024: FILE: refs/lmdb-backend.c:661:
> + if (sb->len < 41 || sb->buf[sb->len - 1] != '\n' ||This code is based on code from files-backend.c. But I can change it anyway.
I'll also fix the rest, but wait for further review to post.