cfg_readline: really ignore empty lines

Simplify cfg_readline and at the same time fix it so that it does
really ignore empty lines.

This fixes point 2-1 of Issue #210

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Guard against double-freeing the current section

If parse_section_header{,_ext} return an error, current_section
doesn't get allocated. Set it to NULL after freeing so we don't try to
free it again.

This fixes part 2-2 of Issue #210.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Parse section header ext: don't leak on error

Also free the subsection if we find too many quotes

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Config parse header ext: don't allow text after closing quote

Nothing is allowed betwen the closing quotation mark and the ] so
return an error if there is.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Add config test for empty line

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Add test for invalid ext header

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Don't try to parse an empty config file

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Add test for empty config file

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Fix tag and signature parsing

Before this commit, malformed tag and signature were considered as
valid by the parser. See the test t3800-mktag.sh of git to see example
of malformed tag and signature.
object: Update documentation
index: Change the memory management for repo indexes

The `git_repository_index` call now returns a brand new index that must
be manually free'd.
Allow read_tree_internal to return an error code

There are two reasons why read_tree_internal might return a NULL
tree. The first one is a corrupt index, but the second one is an
invalidated TREE extension. Up to now, its only way to communicate
with its caller was through the return value being NULL or not.

Allow read_tree_internal to report its exit status independently from
the tree pointer.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
index: correctly parse invalidated TREE extensions

A TREE extension with an entry count of -1 means that it was
invalidated and we should ignore it. Do so instead of returning an
error.

This fixes issue #202

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
index: Cleanup tree parsing
Merge pull request #206 from nulltoken/topic/is-bare

Add git_repository_is_bare() accessor
Merge pull request #222 from carlosmn/config-bugfix

Config bugfix
Merge pull request #223 from carlosmn/valgrind

Plug a leak in the index unmerged entries vector
Merge pull request #218 from schu/tests-fflush

test_lib.c: flush stdout after every test-run
Merge pull request #215 from schu/typos

Fix typos
Merge pull request #224 from glesserd/tagparsing

Fix tag and signature parsing