Re: [PATCH 15/15] commit: record buffer length in cache

2014-06-10 Thread Jeff King
On Tue, Jun 10, 2014 at 01:27:13AM -0400, Jeff King wrote: I find the above strange. I would have done something like: - set_commit_buffer(commit, strbuf_detach(msg, NULL)); + size_t size; + char *buf = strbuf_detach(msg, size); + set_commit_buffer(commit, buf, size); It

Re: [PATCH 15/15] commit: record buffer length in cache

2014-06-10 Thread Christian Couder
From: Jeff King p...@peff.net Subject: Re: [PATCH 15/15] commit: record buffer length in cache Date: Tue, 10 Jun 2014 16:33:49 -0400 On Tue, Jun 10, 2014 at 01:27:13AM -0400, Jeff King wrote: I find the above strange. I would have done something like: - set_commit_buffer(commit

[PATCH 15/15] commit: record buffer length in cache

2014-06-09 Thread Jeff King
Most callsites which use the commit buffer try to use the cached version attached to the commit, rather than re-reading from disk. Unfortunately, that interface provides only a pointer to the NUL-terminated buffer, with no indication of the original length. For the most part, this doesn't matter.

Re: [PATCH 15/15] commit: record buffer length in cache

2014-06-09 Thread Christian Couder
From: Jeff King p...@peff.net --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2313,7 +2313,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt, ident, ident, path, (!contents_from ? path :

Re: [PATCH 15/15] commit: record buffer length in cache

2014-06-09 Thread Jeff King
On Tue, Jun 10, 2014 at 07:12:37AM +0200, Christian Couder wrote: From: Jeff King p...@peff.net --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2313,7 +2313,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt, ident, ident, path,