git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: git@vger.kernel.org
Subject: Empty config sections are neither deleted nor reused
Date: Fri, 13 May 2016 16:55:51 +0200	[thread overview]
Message-ID: <87r3d6knwo.fsf@bernoul.li> (raw)

After running

  git init .
  git config foo.bar baz
  git config --unset foo.bar    # 1
  git config foo.bar baz        # 2

.git/config contains

  [core]
          repositoryformatversion = 0
          filemode = true
          bare = false
          logallrefupdates = true
  [foo]
  [foo]
          bar = baz

(1) did not remove the "foo" section when the last contained variable
was unset and (2) did not reuse the empty "foo" section when "foo.bar"
was set again.

I would prefer if unsetting the last variable in a section would cause
the heading of the now empty section would be removed.

But it might also make sense to not remove an empty section and to
instead reuse an empty section.  That would prevent a section from being
moved to eof because it became temporarily empty.  Maybe that was the
intention and Git at some point stopped re-using an empty section?

It could even be argued that it would make sense for empty sections to
be removed *and* reused (in order to "cleanup" old empty sections).

The only possible combination which doesn't make sense is to not remove
an empty section and to also not reuse an empty section - unfortunately
that's what Git currently does.

  Best regards,
  Jonas

             reply	other threads:[~2016-05-13 15:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13 14:55 Jonas Bernoulli [this message]
2016-05-13 16:47 ` Empty config sections are neither deleted nor reused Junio C Hamano
2016-05-14 13:21   ` Jonas Bernoulli
2016-05-14 15:10     ` Matthieu Moy
2016-05-14 17:33       ` Junio C Hamano
2016-05-14 18:54         ` Jonas Bernoulli

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=87r3d6knwo.fsf@bernoul.li \
    --to=jonas@bernoul.li \
    --cc=git@vger.kernel.org \
    /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).