git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Phil Haack <haacked@gmail.com>, git@vger.kernel.org
Subject: Re: Minor bug in git branch --set-upstream-to adding superfluous branch section to config
Date: Fri, 29 Mar 2013 13:23:07 -0400	[thread overview]
Message-ID: <20130329172307.GA11099@sigill.intra.peff.net> (raw)
In-Reply-To: <87ip4ayvfn.fsf@linux-k42r.v.cablecom.net>

On Fri, Mar 29, 2013 at 06:20:28PM +0100, Thomas Rast wrote:

> Jeff King <peff@peff.net> writes:
> 
> > I think what happens is that the config editor runs
> > through the files linearly, munging whatever lines necessary for the
> > requested operation, and leaving everything else untouched (as it must,
> > to leave comments and whitespace intact). But it does not keep a
> > look-behind buffer to realize that a section name is now obsolete (which
> > we don't know until we get to the next section, or to EOF). In the worst
> > case, this buffer can grow arbitrarily large, like:
> >
> >   [foo]
> >   # the above section is now empty
> >   # but we have to read through all of
> >   # these comments to actually
> >   # realize it
> >   [bar]
> 
> If we treat this case as having a bunch of comments that make the
> section non-empty, then we both avoid needing an arbitrarily large
> lookbehind and deleting the user's precious comments...
> 
> I.e. the rule would be that we only delete the section if there is
> nothing but whitespace until the next section header.

I think that is sane. Technically it does not remove the need for the
buffer, unless we are also collapsing whitespace (which I think is
probably a sane thing to do, too). I'm looking at a patch now...

-Peff

  reply	other threads:[~2013-03-29 17:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29 16:29 Minor bug in git branch --set-upstream-to adding superfluous branch section to config Phil Haack
2013-03-29 17:00 ` Jeff King
2013-03-29 17:20   ` Thomas Rast
2013-03-29 17:23     ` Jeff King [this message]
2013-03-29 17:50       ` [PATCH] t1300: document some aesthetic failures of the config editor Jeff King
2013-03-29 18:51         ` Junio C Hamano
2013-03-29 19:51           ` Jeff King
2013-03-29 20:35             ` Junio C Hamano
2013-03-30  0:21               ` Jeff King
2018-03-28 16:33             ` Johannes Schindelin
2018-03-28 17:59               ` Jeff King
2013-03-29 20:00           ` Junio C Hamano
2013-03-29 17:27 ` Minor bug in git branch --set-upstream-to adding superfluous branch section to config Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130329172307.GA11099@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=haacked@gmail.com \
    --cc=trast@student.ethz.ch \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).