summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Added sort method for commit lists.Vicent Marti2010-06-022-3/+58
| | | | | | | 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-025-23/+63
| | | | | | | 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-025-11/+216
| | | | | | | | | | | | | | 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-024-67/+128
| | | | | | | 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>
* Removed 'git_commit_uninteresting' from the public API.Vicent Marti2010-06-021-8/+0
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add arbritrary ordering revision walking.Vicent Marti2010-06-025-19/+68
| | | | | | | | 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-025-28/+82
| | | | | | | | | | | 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-024-1/+114
| | | | | | | | | | | | | | | | | | 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-022-12/+13
| | | | | 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-023-2/+129
| | | | | | | | | | | | | | | | | | | | 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>
* Fixed typos in the revwalk API documentationVicent Marti2010-06-021-2/+2
| | | | | Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Add support to enable the library to use OpenSSL SHA1 functionsRamsay Jones2010-05-044-22/+24
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Add functions to open a '*.pack' file and perform some basic validationRamsay Jones2010-04-302-1/+116
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Add some more (macro) file operation wrappersRamsay Jones2010-04-303-2/+6
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Fix the memory leak caused by failing to free the 'offset index'Ramsay Jones2010-04-301-0/+2
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* MSVC: Fix some compiler warningsRamsay Jones2010-04-281-4/+4
| | | | | | | | | | | | | | | | In particular, using the normal (or production) compiler warning level (-W3), msvc complains as follows: .../sha1.c(244) : warning C4018: '<' : signed/unsigned mismatch .../sha1.c(270) : warning C4244: 'function' : conversion from \ 'unsigned __int64' to 'unsigned long', possible loss of data .../sha1.c(271) : warning C4244: 'function' : conversion from \ 'unsigned __int64' to 'unsigned long', possible loss of data Note that gcc issues a similar complaint about line 244 when compiling with -Wextra. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* MSVC: Fix a syntax error caused by an inline function definitionRamsay Jones2010-04-281-1/+1
| | | | | | | | | | | | | | | | Commit 5dddf7c (Add block-sha1 in favour of the mozilla routines 2010-04-14) introduced the "bswap.h" header file which contains an inline function (default_swab32()). The msvc compiler does not support the inline keyword which causes the build to fail with a syntax error. However, msvc does support inline functions using the __inline keyword language extension. We already have the GIT_INLINE() macro that allows us to hide this syntatic difference. In order to fix the build, we simply use GIT_INLINE() in the definition of the default_swab32() function. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Merge remote branch 'ramsay/dev'Andreas Ericsson2010-04-2311-116/+400
|\ | | | | | | | | | | | | | | | | | | | | | | * ramsay/dev: Add a pack index 'virtual function' to fetch an index entry Add a pack index 'virtual function' to search by file offset Change the interface of the pack index search function Add an 64-bit offset table index bounds check for v2 pack index Add a minimum size check when opening an v2 pack index file win32: Add separate MinGW and MSVC compatability header files Makefile: Add support for custom build options in config.mak file Fix some coding style issues
| * Add a pack index 'virtual function' to fetch an index entryRamsay Jones2010-02-281-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | Given an index entry number, the idx_get() function returns an (version agnostic) index_entry structure containing all of the information required to unpack the corresponding object from the '.pack' file. Since the v1 and v2 file formats differ in the layout of the object records, we provide two implementations of the get function and initialise the function pointer appropriately. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
| * Add a pack index 'virtual function' to search by file offsetRamsay Jones2010-02-281-26/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition to searching the index by oid, we need to search by '.pack' file offset, particularly when processing OBJ_OFS_DELTA objects. Since the v1 and v2 file formats differ in the layout of the object records, we provide two implementations of the search function and initialise the (virtual) function pointer appropriately. Note that, as part of the creation of the 'offset index', we also add a check that the offset data in the index is within the bounds of the '.pack' file. Having sorted the file offsets, while creating the index, we only need to check the smallest and largest values. The offset index consists of the im_off_idx array, which contains the index entry numbers sorted into file offset order, and the im_off_next mapping array. The im_off_next array maps an index entry number to the 'next' index entry in file offset order. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
| * Change the interface of the pack index search functionRamsay Jones2010-02-281-24/+20
| | | | | | | | | | | | | | In particular, on a successful search, we now return the index entry number of the object rather than the '.pack' file offset. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
| * Add an 64-bit offset table index bounds check for v2 pack indexRamsay Jones2010-02-281-2/+17
| | | | | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
| * Add a minimum size check when opening an v2 pack index fileRamsay Jones2010-02-281-0/+8
| | | | | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
| * win32: Add separate MinGW and MSVC compatability header filesRamsay Jones2010-02-283-41/+57
| | | | | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
| * Fix some coding style issuesRamsay Jones2010-02-288-24/+23
| | | | | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* | Add block-sha1 in favour of the mozilla routinesAndreas Ericsson2010-04-148-248/+377
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since block-sha1 from git.git has such excellent performance, we can also get rid of the openssl dependency. It's rather simple to add it back later as an optional extra, but we really needn't bother to pull in the entire ssl library and have to deal with linking issues now that we have the portable and, performance-wise, truly excellent block-sha1 code to fall back on. Since this requires a slight revamp of the build rules anyway, we take the opportunity to fix including EXTRA_OBJS in the final build as well. The block-sha1 code was originally implemented for git.git by Linus Torvalds <torvalds@linux-foundation.org> and was later polished by Nicolas Pitre <nico@cam.org>. Signed-off-by: Andreas Ericsson <ae@op5.se>
* | Add assembly sha1 implementation for ppcAndreas Ericsson2010-04-143-0/+321
|/ | | | | | | | | | We don't use it yet, but now we have it there at least. All the non-trivial parts of it appears to have been written and contributed to git.git by some anonymous genius. The original implementation was done by Paul Mackerras <paulus@samba.org>. Signed-off-by: Andreas Ericsson <ae@op5.se>
* msvc: Fix some "unreferenced formal parameter" warningsRamsay Jones2010-01-202-0/+9
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* msvc: Fix some -W4 warningsRamsay Jones2010-01-203-6/+11
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Fix some "unused parameter" warnings with -WextraRamsay Jones2010-01-203-2/+20
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Fix "'__thread' not at start of declaration" warnings (-Wextra)Ramsay Jones2010-01-202-2/+13
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Fix some "signed v unsigned comparison" warnings with -WextraRamsay Jones2010-01-204-11/+11
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Fix an always false comparison "unsigned < 0" warningRamsay Jones2010-01-201-1/+1
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Save the git_file in the gitfo_cache when enabling cachingRamsay Jones2010-01-201-0/+1
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* win32: Add a 'git__' prefix to the directory reading routinesRamsay Jones2010-01-202-13/+23
| | | | | | | | This reduces the global namespace pollution and allows for a win32 compiler (eg. Open Watcom) to provide these routines in a header other than <dirent.h> (eg in <io.h>). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* win32: Use an 64-bit file offset typeRamsay Jones2010-01-204-6/+29
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Add support for the MinGW platformRamsay Jones2010-01-202-4/+4
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Use a 64 bit off_t throughout the library and tests on POSIXRamsay Jones2010-01-202-3/+3
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Add the git_oid_to_string() utility functionRamsay Jones2009-10-132-1/+38
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* win32: Define the ssize_t type using SSIZE_T if supportedRamsay Jones2009-10-131-5/+8
| | | | | | | | | | | Some win32 compilers define the SSIZE_T type, with the same meaning and intent as ssize_t. If available, make ssize_t a synonym of SSIZE_T. At present, the Digital-Mars compiler is known not to define SSIZE_T, so we provide an SSIZE_T macro to use in the typedef. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Disable some msvc "deprecated function" warnings againRamsay Jones2009-10-131-0/+6
| | | | | | | | | | | | | In addition to removing the inline #define, commit 209849a also removed a #pragma to disable msvc deprecated function warnings. Without this #pragma, msvc currently issues 19 warnings related to "deprecated insecure c-library functions", such as strcpy() and 22 warnings related to "deprecated POSIX function names", such as open(). In order to supress these warnings, re-instate the #pragma. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Use GIT_INLINE macro instead of keyword inline.Julio Espinoza-Sokal2009-06-162-10/+2
| | | | | | | | No need to define inline as __inline because libgit2 code should be using GIT_INLINE instead. Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
* win32: Add an fsync() implementation for windowsRamsay Jones2009-06-152-5/+26
| | | | | | | | | | | | | | | | | | For information on FlushFileBuffers(), see the msdn document at msdn.microsoft.com/en-us/library/aa364439(VS.85).aspx Note that Windows 2000 is shown as the minimum windows version to support FlushFileBuffers(), so if we wish to support Win9X and NT4, we will need to add code to dynamically check if kernel32.dll contains the function. The only error return mentioned in the msdn document is ERROR_INVALID_HANDLE, which is returned if the file/device (eg console) is not buffered. The fsync(2) manpage says that EINVAL is returned in errno, if "fd is bound to a special file which does not support synchronization". Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* win32: Add support for the MS Visual C/C++ compilerRamsay Jones2009-06-154-5/+56
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Correct the spelling of the FLEX_ARRAY macroRamsay Jones2009-06-152-7/+7
| | | | | | | | | | | | | | When setting the default value, the macro name was specified as GIT_FLEX_ARRAY, which is inconsistent with it's earlier usage in the file. This caused a compilation error, using the MS Visual C/C++ compiler, when compiling the git_packlist struct definition in src/odb.c. In addition to changing the spelling of the FLEX_ARRAY macro to GIT_FLEX_ARRAY, including it's use in src/odb.c, we also rename the TYPEOF macro to GIT_TYPEOF. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Fix some "signed/unsigned mismatch" (msvc) compiler warningsRamsay Jones2009-06-052-3/+3
| | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Improve the portability of the gitfo_cache code (to 64-bit systems)Ramsay Jones2009-06-051-1/+1
| | | | | | | | | This supresses some "conversion from 'size_t' to 'unsigned int', possible loss of data" warning messages from the MS Visual C/C++ compiler with -Wp64. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
* thread-utils.h: Avoid using a non-standard C constructRamsay Jones2009-06-051-1/+1
| | | | | | | | | | | | | | In particular, in standard C, a struct or union must have at least one member declared (ie. structs and unions cannot be empty). Some compilers allow empty structs as an extension and won't even issue a warning unless asked for it (eg, gcc requires -pedantic). Some compilers allow empty structs as an extension and will only treat it as an error if asked for strict checking (eg Digital-Mars with -A). Some compilers simply treat it as an error (eg MS Visual C/C++). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Implement git_odb_write()Ramsay Jones2009-06-052-4/+181
| | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>