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

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

Previous: Stefan BellerNext: Ævar Arnfjörð Bjarmason
Message 3 of 8 in “Bug: duplicate sections in .git/config after remote removal”
  1. Jason FreyMar 27, 2018
  2. Stefan BellerMar 27, 2018
  3. Johannes SchindelinMar 28, 2018
  4. Ævar Arnfjörð BjarmasonMar 27, 2018
  5. Philip OakleyMar 28, 2018
  6. Philip OakleyMar 28, 2018
  7. Philip OakleyMar 28, 2018
  8. Philip OakleyMar 28, 2018

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.