Re: Minor bug in git branch --set-upstream-to adding superfluous branch section to config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> Jeff King <peff@xxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]