1. 12 Aug, 2010 5 commits
    • Finish the tree object API · 003c2690
      The interface for loading and parsing tree objects from a repository has
      been completed with all the required accesor methods for attributes,
      support for manipulating individual tree entries and a new unit test
      t0901-readtree which tries to load and parse a tree object from a
      repository.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
    • Add unit tests for index manipulation · ff17642d
      Three new unit tests, t06XX files have been added.
      
      	t0601-read: tests for loading index files from disk,
      				for creating in-memory indexes and for accessing
      				index entries.
      	t0602-write: tests for writing index files back to disk
      	t0603-sort: tests for properly sorting the entries array of an index
      
      Two test indexes have been added in 'tests/resources/':
      
      	test/resources/index: a sample index from a libgit2 repository
      
      	test/resources/gitgit.index: a sample index from a git.git
      		repository (includes TREE extension data)
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
    • Move test resources to a common directory · 1baa25ee
      All the external resources used by the tests are now placed inside the
      common 'tests/resources' directory.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
    • Redesigned the walking/object lookup interface · 3315782c
      The old 'git_revpool' object has been removed and
      split into two distinct objects with separate
      functionality, in order to have separate methods for
      object management and object walking.
      
      *	A new object 'git_repository' does the high-level
      	management of a repository's objects (commits, trees,
      	tags, etc) on top of a 'git_odb'.
      
      	Eventually, it will also manage other repository
      	attributes (e.g. tag resolution, references, etc).
      
      	See: src/git/repository.h
      
      *	A new external method
      		'git_repository_lookup(repo, oid, type)'
      	has been added to the 'git_repository' API.
      
      	All object lookups (git_XXX_lookup()) are now
      	wrappers to this method, and duplicated code
      	has been removed. The method does automatic type
      	checking and returns a generic 'git_revpool_object'
      	that can be cast to any specific object.
      
      	See: src/git/repository.h
      
      *	The external methods for object parsing of repository
      	objects (git_XXX_parse()) have been removed.
      
      	Loading objects from the repository is now managed
      	through the 'lookup' functions. These objects are
      	loaded with minimal information, and the relevant
      	parsing is done automatically when the user requests
      	any of the parsed attributes through accessor methods.
      
      	An attribute has been added to 'git_repository' in
      	order to force the parsing of all the repository objects
      	immediately after lookup.
      
      	See: src/git/commit.h
      	See: src/git/tag.h
      	See: src/git/tree.h
      
      *	The previous walking functionality of the revpool
      	is now found in 'git_revwalk', which does the actual
      	revision walking on a repository; the attributes
      	when walking through commits in a database have been
      	decoupled from the actual commit objects.
      	This increases performance when accessing commits
      	during the walk and allows to have several
      	'git_revwalk' instances working at the same time on
      	top of the same repository, without having to load
      	commits in memory several times.
      
      	See: src/git/revwalk.h
      
      *	The old 'git_revpool_table' has been renamed to
      	'git_hashtable' and now works as a generic hashtable
      	with support for any kind of object and custom hash
      	functions.
      
      	See: src/hashtable.h
      
      *	All the relevant unit tests have been updated, renamed
      	and grouped accordingly.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
    • Add loading and parsing of tag objects · f8758044
      Tag objects are now properly loaded from the revision pool.
      New test t0801 checks for loading a parsing a series of tags, including
      the tag of a tag.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  2. 06 Aug, 2010 2 commits
    • Refactor parsing methods · 364788e1
      The 'parse_oid' and 'parse_person' methods which were used by the commit
      parser are now global so they can be used when parsing other objects.
      
      The 'git_commit_person' struct has been changed to a generic
      'git_person'.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
    • Add packfile reading · 7e4f56a5
      Packed objects inside packfiles are now properly unpacked when calling
      the git_odb__read_packed() method; delta'ed objects are also properly
      generated when needed.
      
      A new unit test 0204-readpack tries to read a couple hundred packed
      objects from a standard packed repository.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  3. 15 Jul, 2010 3 commits
    • Changed test files to use tabs instead of spaces · 3e590fb2
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
    • Add external API to access detailed commit attributes · 52f2390b
      The following new external methods have been added:
      
      GIT_EXTERN(const char *) git_commit_message_short(git_commit *commit);
      GIT_EXTERN(const char *) git_commit_message(git_commit *commit);
      GIT_EXTERN(time_t) git_commit_time(git_commit *commit);
      GIT_EXTERN(const git_commit_person *) git_commit_committer(git_commit *commit);
      GIT_EXTERN(const git_commit_person *) git_commit_author(git_commit *commit);
      GIT_EXTERN(const git_tree *) git_commit_tree(git_commit *commit);
      
      A new structure, git_commit_person has been added to represent a
      commit's author or committer.
      
      The parsing of a commit has been split in two phases.
      When adding a commit to the revision pool:
      	- the commit's ODB object is opened
      	- its raw contents are parsed for commit TIME, PARENTS and TREE
      		(the minimal amount of data required to traverse the pool)
      	- the commit's ODB object is closed
      
      When querying for extended information on a commit:
      	- the commit's ODB object is reopened
      	- its raw contents are parsed for the requested information
      	- the commit's ODB object remains open to handle additional queries
      
      New unit tests have been added for the new functionality:
      
      	In t0401-parse: parse_person_test
      	In t0402-details: query_details_test
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
    • Add new tests: t0502-table, t0503-tableit · b231ef3a
      "t0502-table" tests for basic functionality of the objects
      table:
      	table_create	(creating a new object table)
      	table_populate	(fill & lookup on the object table)
      	table_resize	(dynamically resize the table)
      
      "t0503-tableit" tests the iterator for object tables:
      	table_iterator (make sure the iterator reaches all objects)
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  4. 10 Jul, 2010 1 commit
    • Fixed memory leaks in test suite · 088a731f
      Created commit objects in t0401-parse weren't being freed properly.
      Updated the API documentation to note that commit objects are owned
      by the revision pool and should not be freed manually.
      
      The parents list of each commit was being freed twice after each test.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  5. 07 Jun, 2010 3 commits
  6. 02 Jun, 2010 9 commits
  7. 04 May, 2010 1 commit
  8. 28 Apr, 2010 2 commits
  9. 28 Feb, 2010 2 commits
  10. 01 Feb, 2010 1 commit
  11. 20 Jan, 2010 6 commits
  12. 13 Oct, 2009 4 commits
    • Add the git_oid_to_string() utility function · 960ca1d7
      Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
      Ramsay Jones committed
    • Add test-suite coverage testing using gcov · e4553584
      Add a new "coverage" Makefile target that re-builds the
      library and tests using the gcc compiler/linker flags
      required by gcov, runs the test suite to capture the
      runtime data, then compiles a coverage report.
      
      The report, which is saved in a file named "untested",
      consists of a list of untested files, followed by a list
      of untested functions. More detailed execution statistics
      are given in the gcov log files which are saved in the
      top-level directory (named like src#hash.c.gcov).
      
      Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
      Ramsay Jones committed
    • t0101-oid.c: Fix a memory leak reported by valgrind · d2ef83fc
      Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
      Ramsay Jones committed
    • Add support for running the tests via valgrind · cac5d927
      Add some makefile targets, which use valgrind's memcheck tool to
      run the tests, in order to help diagnose memory problems in the
      library.
      
      In addition, we enable the '--leak-check' option to report on any
      memory leaks. However, unlike the other memory problems reported
      by memcheck, memory leak reports do not result in an error exit
      from valgrind. (So memory leaks are reported on stderr, but don't
      halt the test run.)
      
      A suppressions file (tests.supp) is included since libz triggers
      some false positives.
      
      Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
      Ramsay Jones committed
  13. 16 Jun, 2009 1 commit
    • Add noreturn declaration compatible with the MSVC compiler. · 73c4dd92
      MSVC provides a compiler declaration to declare that a function
      never returns. This declaration is required in front of the
      function definition rather than at the end, but fortunately gcc
      is compatible with this location as well.
      
      Explicit returns are no longer required after calls to test_die.
      
      Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com>
      Signed-off-by: Andreas Ericsson <ae@op5.se>
      Julio Espinoza-Sokal committed