]> source.dussan.org Git - jgit.git/commit
Don't confuse empty configuration variables with booleans 42/242/1
authorShawn O. Pearce <spearce@spearce.org>
Sun, 24 Jan 2010 01:17:23 +0000 (17:17 -0800)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 24 Jan 2010 01:28:14 +0000 (17:28 -0800)
commit869c8434f6bfa6093299031942026084a5610165
tree066cb23b819f9aba0c09f6d56b229e16c64d08cf
parent0238a21b624abf079ae21835a13067d2c8dedd81
Don't confuse empty configuration variables with booleans

Config was confusing the following two variables when writing the
file back to text format:

  [my]
    empty =
    enabled

When parsed, we say that my.empty has 1 value, null, and my.enabled
is an empty string value that in boolean context should be evaluated
as true.

Saving this configuration file back to text format was ignoring the
null value for my.empty, producing a completely different file than
what Config read:

  [my]
    empty
    enabled

Instead handle the writing differently to ensure the original format
is output.  New tests cases cover the expected behavior and return
values from accessor methods.

Change-Id: Id37379ce20cb27e3330923cf989444dd9f2bdd96
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java