git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Mar 29, 2013, 17:23 UTC
Message-ID
<20130329172307.GA11099@sigill.intra.peff.net>
In-Reply-To
<87ip4ayvfn.fsf@linux-k42r.v.cablecom.net>
On Fri, Mar 29, 2013 at 06:20:28PM +0100, Thomas Rast wrote:
Show 23 quoted lines
> 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
Previous: Thomas RastNext: Jeff King
Message 4 of 13 in “Minor bug in git branch --set-upstream-to adding superfluous branch section to config”
  1. Phil HaackMar 29, 2013
  2. Jeff KingMar 29, 2013
  3. Thomas RastMar 29, 2013
  4. Jeff KingMar 29, 2013
  5. t1300: document some aesthetic failures of the config editorJeff King, Mar 29, 2013
  6. Junio C HamanoMar 29, 2013
  7. Jeff KingMar 29, 2013
  8. Junio C HamanoMar 29, 2013
  9. Jeff KingMar 30, 2013
  10. Johannes SchindelinMar 28, 2018
  11. Jeff KingMar 28, 2018
  12. Junio C HamanoMar 29, 2013
  13. Junio C HamanoMar 29, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.