Re: Bug: duplicate sections in .git/config after remote removal
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 28, 2018, 16:34 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1803281110260.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
- In-Reply-To
- <CAGZ79ka_dd=4-EVmoKrBVC_y4+eVPSz959BVNmzZkOwiZh_24A@mail.gmail.com>
Hi Stefan & Jason,
On Tue, 27 Mar 2018, Stefan Beller wrote:
Show 10 quoted lines
> On Tue, Mar 27, 2018 at 1:41 PM Jason Frey <jfrey@redhat.com> wrote: > > > at which point you can see the duplicate sections (even though one is > > empty). Also note that if you do the steps again, you will be left > > with 3 sections, 2 of which are empty. This process can be repeated > > over and over. > > I agree that this is an issue for the user, and there were some attempts > to fix it in the past. (feel free to dig them up in the archive at > https://public-inbox.org/git)
Note: as far as I remember, the attempted fixes were exclusively trying to remove the empty section. But this report suggests that we could instead *keep* empty sections, but then reuse them when a new value is added.
Show 6 quoted lines
> IIRC the problem is (a) with the loose file format (What if the user put > a valuable comment just after or before the '[branch "master"]' line?) > as well as (b) the way the parser/writer works (single pass, line by line) > > (b) specifically made it a "huge effort, but little return" bug, > so nobody got around for a proper fix.
Yes, (a) makes removing an empty section something less of a desirable thing. Unless there are no comments before and after the section, of course, and yes, (b) is a real thing.
On a positive note: I just finished work on a set of patches addressing this: https://github.com/git/git/compare/master...dscho:empty-config-section (I plan on submitting this tomorrow)
Ciao, Dscho