summaryrefslogtreecommitdiff
path: root/src/commit.c
Commit message (Collapse)AuthorAgeFilesLines
...
* msvc: Fix a "declaration after statement" compilation errorRamsay Jones2010-06-021-1/+3
| | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Improved error handling on auxilirary functions.Vicent Marti2010-06-021-12/+13
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Added new error codes. Improved error handling.Vicent Marti2010-06-021-18/+20
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Fixed brace placement and converted spaces to tabs.Vicent Marti2010-06-021-235/+222
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Fixed topological commit sorting (no longerd reversed) and commit timeVicent Marti2010-06-021-1/+2
| | | | | | | sorting ('prev' pointers in the linked list are no longer lost). Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Fixed topological sorting stuck in infinite loop.Vicent Marti2010-06-021-4/+10
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Fixed parsing commit times (they weren't being stored at all!)Vicent Marti2010-06-021-1/+8
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Changed commit time sorting to be descending (from newest to oldest).Vicent Marti2010-06-021-1/+1
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add topological sorting and new insertion methods for commit lists.Vicent Marti2010-06-021-3/+65
| | | | | | | | | | | | 'git_commit_list_toposort()' and 'git_commit_list_timesort()' now sort a commit list by topological and time order respectively. Both sorts are stable and in place. 'git_commit_list_append' has been replaced by 'git_commit_list_push_back' and 'git_commit_list_push_front'. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Fixed linked list tail being lost when sorting.Vicent Marti2010-06-021-6/+6
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Added sort method for commit lists.Vicent Marti2010-06-021-3/+57
| | | | | | | Fixed bug when parsing time headers from commits. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add commit caching on the commit table.Vicent Marti2010-06-021-0/+6
| | | | | | | Properly initialize the pending commits list. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add 'git_revpool_object' and 'git_revpool_table' structures.Vicent Marti2010-06-021-8/+6
| | | | | | | | | | | | | | All the objects which will will be eventually transversable from a revision pool (commits, trees, etc) now inherit from the 'git_revpool_object' structure which identifies them with their own OID. Furthermore, the 'git_revpool_table' and related functions have been added, which allow for constant time lookup (hash table) of the loaded revpool objects based on their OID. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Changed 'git_commit_list' from a linked list to a doubly-linked list.Vicent Marti2010-06-021-22/+83
| | | | | | | Changed 'git_commit' to use bit fields instead of flags. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add arbritrary ordering revision walking.Vicent Marti2010-06-021-7/+8
| | | | | | | | The 'gitrp_next()' method now correctly does a revision walking of all the pushed revisions in arbritary ordering. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Split git_commit_lookup into separate functions.Vicent Marti2010-06-021-19/+49
| | | | | | | | | | | git_commit_lookup() now creates commit references without loading them from the ODB. git_commit_parse() creates a commit reference, loads it and parses it from the ODB. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add commit parents to parsed commits and commit lists to the revpool.Vicent Marti2010-06-021-1/+44
| | | | | | | | | | | | | | | | | | Basic support for iterating the revpool. The following functions of the revwalk API have been partially implemented: void gitrp_reset(git_revpool *pool); void gitrp_push(git_revpool *pool, git_commit *commit); void gitrp_prepare_walk(git_revpool *pool); git_commit *gitrp_next(git_revpool *pool); Parsed commits' parents are now also parsed and stored in a "git_commit_list" structure (linked list). Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add unit tests for Commit parsingVicent Marti2010-06-021-0/+3
| | | | | | | | | | | | | | A few initial tests for commit parsing: "parse_buffer_test" tests git_commit__parse_buffer() with several malformed commit messages and a few corner cases which should pass. "parse_oid_test" tests git_commit__parse_oid() with several malformed commit lines containing broken SHA1 OIDs. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Fixed indentation issues in commit.cVicent Marti2010-06-021-8/+9
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add basic functionality for commit lookup/parsingVicent Marti2010-06-021-0/+118
| | | | | | | | | | | | | | | | | | | | The external API function "git_commit_parse" has been renamed to "git_commit_lookup" and has been partially implemented with support for loading commits straight from the ODB. It still lacks the functionality to lookup cached commits in the revpool and to resolve tags to commits. The following internal functions have been partially implemented: int git_commit__parse_buffer(...); int git_commit__parse_time(...); int git_commit__parse_oid(...); Commits are now fully parsed but the generated parent and tree references are not handled yet. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Wrap malloc and friends and report out of memory as GIT_ENOMEMShawn O. Pearce2008-12-301-0/+1
| | | | | | | | | | | | | | | | We now forbid direct use of malloc, strdup or calloc within the library and instead use wrapper functions git__malloc, etc. to invoke the underlying library malloc and set git_errno to a no memory error code if the allocation fails. In the future once we have pack objects in memory we are likely to enhance these routines with garbage collection logic to purge cached pack data when allocations fail. Because the size of the function will grow somewhat large, we don't want to mark them for inline as gcc tends to aggressively inline, creating larger than expected executables. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Get rid of GIT__PRIVATE macroAndreas Ericsson2008-11-221-1/+1
| | | | | | | | | | | | | Using it in the first place means something's wrong. This patch replaces it with an internal header which carries the previously "protected" code instead. Internal source-files simply include "commit.h" and they're done. The internal header includes the public one to make sure we always use the proper prototype. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Switch the license from BSD to GPL+libgcc exceptionShawn O. Pearce2008-11-011-29/+19
| | | | Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Move include files to include/git/, drop git_ prefix from file namesShawn O. Pearce2008-11-011-0/+41
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>