diff --git a/crudini b/crudini index d9e7939..d4ccb65 100755 --- a/crudini +++ b/crudini @@ -179,6 +179,9 @@ class LockedFile(FileLock): class CrudiniConfigParser(iniparse.RawConfigParser): def __init__(self, preserve_case=False): iniparse.RawConfigParser.__init__(self) + # Without the following we can't have params starting with "rem"! + # We ignore lines starting with '%' which mercurial uses to include + iniparse.change_comment_syntax('%;#', allow_rem=False) if preserve_case: self.optionxform = str diff --git a/tests/test.sh b/tests/test.sh index b35f15d..8f09a45 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -217,6 +217,13 @@ printf '%s\n' '#comment' '[section1]' > test.ini test "$(crudini --get test.ini)" = 'section1' || fail ok +# Ensure we handle comments correctly +printf '%s\n' '[DEFAULT]' '#c1' ';c2' '%inc1' > test.ini +test "$(crudini --get test.ini)" = '' || fail +printf '%s\n' '[section1]' 'remote=1' > test.ini +test "$(crudini --get test.ini 'section1')" = 'remote' || fail +ok + # missing bits :> test.ini crudini --get missing.ini 2>/dev/null && fail