From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, msysgit@googlegroups.com
Subject: Re: [PATCH] Remove the line length limit for graft files
Date: Fri, 27 Dec 2013 13:48:46 -0800 [thread overview]
Message-ID: <7vr48yj77l.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.DEB.1.00.1312272146590.1191@s15462909.onlinehome-server.info> (Johannes Schindelin's message of "Fri, 27 Dec 2013 21:49:57 +0100 (CET)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Support for grafts predates Git's strbuf, and hence it is understandable
> that there was a hard-coded line length limit of 1023 characters (which
> was chosen a bit awkwardly, given that it is *exactly* one byte short of
> aligning with the 41 bytes occupied by a commit name and the following
> space or new-line character).
>
> While regular commit histories hardly win comprehensibility in general
> if they merge more than twenty-two branches in one go, it is not Git's
> business to limit grafts in such a way.
>
> In this particular developer's case, the use case that requires
> substantially longer graft lines to be supported is the visualization of
> the commits' order implied by their changes: commits are considered to
> have an implicit relationship iff exchanging them in an interactive
> rebase would result in merge conflicts.
>
> Thusly implied branches tend to be very shallow in general, and the
> resulting thicket of implied branches is usually very wide; It is
> actually quite common that *most* of the commits in a topic branch have
> not even one implied parent, so that a final merge commit has about as
> many implied parents as there are commits in said branch.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> builtin/blame.c | 8 ++++----
> commit.c | 10 +++++-----
> 2 files changed, 9 insertions(+), 9 deletions(-)
Makes sense. It is in line with the spirit of ef98c5cafb3e
(commit-tree: lift completely arbitrary limit of 16 parents,
2008-06-27), too ;-)
Thanks, will queue.
> diff --git a/builtin/blame.c b/builtin/blame.c
> index 1407ae7..9047b6e 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -1804,17 +1804,17 @@ static int prepare_lines(struct scoreboard *sb)
> static int read_ancestry(const char *graft_file)
> {
> FILE *fp = fopen(graft_file, "r");
> - char buf[1024];
> + struct strbuf buf = STRBUF_INIT;
> if (!fp)
> return -1;
> - while (fgets(buf, sizeof(buf), fp)) {
> + while (!strbuf_getwholeline(&buf, fp, '\n')) {
> /* The format is just "Commit Parent1 Parent2 ...\n" */
> - int len = strlen(buf);
> - struct commit_graft *graft = read_graft_line(buf, len);
> + struct commit_graft *graft = read_graft_line(buf.buf, buf.len);
> if (graft)
> register_commit_graft(graft, 0);
> }
> fclose(fp);
> + strbuf_release(&buf);
> return 0;
> }
>
> diff --git a/commit.c b/commit.c
> index de16a3c..57ebea2 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -196,19 +196,19 @@ bad_graft_data:
> static int read_graft_file(const char *graft_file)
> {
> FILE *fp = fopen(graft_file, "r");
> - char buf[1024];
> + struct strbuf buf = STRBUF_INIT;
> if (!fp)
> return -1;
> - while (fgets(buf, sizeof(buf), fp)) {
> + while (!strbuf_getwholeline(&buf, fp, '\n')) {
> /* The format is just "Commit Parent1 Parent2 ...\n" */
> - int len = strlen(buf);
> - struct commit_graft *graft = read_graft_line(buf, len);
> + struct commit_graft *graft = read_graft_line(buf.buf, buf.len);
> if (!graft)
> continue;
> if (register_commit_graft(graft, 1))
> - error("duplicate graft data: %s", buf);
> + error("duplicate graft data: %s", buf.buf);
> }
> fclose(fp);
> + strbuf_release(&buf);
> return 0;
> }
>
> --
> 1.8.4.msysgit.0.1109.g3c58b16
>
> --
--
--
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.
You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
prev parent reply other threads:[~2013-12-27 21:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-27 20:49 [PATCH] Remove the line length limit for graft files Johannes Schindelin
2013-12-27 21:04 ` Jonathan Nieder
2013-12-27 21:14 ` Johannes Schindelin
2013-12-27 21:59 ` Jonathan Nieder
2013-12-27 22:51 ` Johannes Schindelin
2013-12-27 22:32 ` Jonathan Nieder
2013-12-27 22:53 ` Johannes Schindelin
2013-12-28 0:50 ` Junio C Hamano
2013-12-27 21:48 ` Junio C Hamano [this message]
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=7vr48yj77l.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=msysgit@googlegroups.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).