From: Jeff King <peff@peff.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Junio C Hamano <gitster@pobox.com>, Johannes Sixt <j6t@kdbg.org>,
Michael Blume <blume.mike@gmail.com>,
Git List <git@vger.kernel.org>
Subject: [PATCH 0/3] convert read_packed_refs to use strbuf
Date: Wed, 10 Dec 2014 05:39:07 -0500 [thread overview]
Message-ID: <20141210103907.GA22186@peff.net> (raw)
In-Reply-To: <20141210095319.GA9099@peff.net>
On Wed, Dec 10, 2014 at 04:53:19AM -0500, Jeff King wrote:
> > Clarification: for-each-ref ignores the ref when the full line read
> > from packed-refs hits length 1024 (not when the refname itself hits
> > length 1024).
>
> Yes, the problem is in read_packed_refs:
>
> char refline[PATH_MAX];
> ...
> while (fgets(refline, sizeof(refline), f)) {
> ...
> }
>
> This could be trivially converted to strbuf_getwholeline, but I am not
> sure what else would break, or whether such a system would actually be
> _usable_ with such long refs (e.g., would it break the first time you
I accidentally cut off the next line, but it was something like
"...first time you actually tried writing to the ref)".
> Using fgets like this does shear lines, though. The next fgets call will
> see the second half of the line. I think we are saved from doing
> anything stupid by parse_ref_line, but it is mostly luck. So perhaps for
> that reason the trivial conversion to strbuf is worth it, even if it
> doesn't help any practical cases.
Here's a patch to do that. It still doesn't let you create long refs on
OS X, as we get caught up in the PATH_MAX found in git_path() and
friends. Still, I think it's a step in the right direction, and it fixes
the shearing issue.
Patches 2 and 3 are just follow-on cleanups.
[1/3]: read_packed_refs: use a strbuf for reading lines
[2/3]: read_packed_refs: pass strbuf to parse_ref_line
[3/3]: read_packed_refs: use skip_prefix instead of static array
I checked, and this miraculously does not conflict with any of the refs
work in pu. :)
-Peff
next prev parent reply other threads:[~2014-12-10 10:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 17:49 [RFC/PATCH] pkt-line: allow writing of LARGE_PACKET_MAX buffers Jeff King
2014-12-09 18:09 ` Jeff King
2014-12-09 22:41 ` Junio C Hamano
2014-12-10 4:36 ` Michael Blume
2014-12-10 7:34 ` [PATCH v3] " Jeff King
2014-12-10 8:36 ` Eric Sunshine
2014-12-10 9:42 ` Eric Sunshine
2014-12-10 9:49 ` Eric Sunshine
2014-12-10 9:53 ` Jeff King
2014-12-10 10:39 ` Jeff King [this message]
2014-12-10 10:40 ` [PATCH 1/3] read_packed_refs: use a strbuf for reading lines Jeff King
2014-12-10 10:40 ` [PATCH 2/3] read_packed_refs: pass strbuf to parse_ref_line Jeff King
2014-12-10 10:40 ` [PATCH 3/3] read_packed_refs: use skip_prefix instead of static array Jeff King
2014-12-10 17:43 ` [PATCH 0/3] convert read_packed_refs to use strbuf Junio C Hamano
2014-12-10 9:47 ` [PATCH v4] pkt-line: allow writing of LARGE_PACKET_MAX buffers Jeff King
2014-12-10 9:56 ` Eric Sunshine
2014-12-10 20:14 ` Eric Sunshine
2014-12-10 21:06 ` Jeff King
2014-12-09 19:58 ` [RFC/PATCH] " Johannes Sixt
2014-12-09 20:00 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141210103907.GA22186@peff.net \
--to=peff@peff.net \
--cc=blume.mike@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).