Log

Author Commit Date CI Message
Vicent Marti 0cf02ff9 2010-05-26T21:23:01 Added t0501-walk (simple test for all revision pool walking modes) Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 1d1be8ee 2010-05-26T01:42:18 Fixed topological commit sorting (no longerd reversed) and commit time 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>
Vicent Marti 69dca959 2010-05-25T22:30:09 Fixed parsing commit times (they weren't being stored at all!) Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 655d381a 2010-05-23T16:51:31 Add topological sorting and new insertion methods for commit lists. '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>
Vicent Marti 47c31f58 2010-05-23T16:28:32 Fixed linked list tail being lost when sorting. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 82b1db3b 2010-05-25T22:00:55 Changed commit time sorting to be descending (from newest to oldest). Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti a7c182c5 2010-05-23T04:41:31 Add object cache to the revision pool. Fixed issue when generating pending commits list during iteration. The 'git_commit_lookup' function will now check the pool's cache for commits which have been previously loaded/parsed; there can only be a single 'git_commit' structure for each commit on the same pool. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti d047b47a 2010-05-23T04:41:07 Updated t0401 (commit parsing) to reflect the new API changes. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 1f798df2 2010-05-25T22:59:50 Fixed topological sorting stuck in infinite loop. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti e5d1faef 2010-05-25T19:48:13 Add external API for revision sorting. The GIT_RPSORT_XXX flags have been moved to the external API, and a new method 'gitrp_sorting(...)' has been added to safely change the sorting method of a revision pool. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 089c2d93 2010-05-23T04:39:33 Add unit tests for list sorting. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 9bdb7594 2010-05-23T17:12:28 Properly reset all commit properties when doing a gitrp_reset(). Add git_revpool_table_free() method. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 36b7cdb6 2010-05-22T18:15:42 Changed 'git_commit_list' from a linked list to a doubly-linked list. 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>
Vicent Marti 89039682 2010-05-22T14:36:36 Removed 'git_commit_uninteresting' from the public API. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 1a895dd7 2010-05-22T14:32:59 Add arbritrary ordering revision walking. 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>
Vicent Marti 8add0153 2010-05-21T02:35:40 Split git_commit_lookup into separate functions. 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>
Vicent Marti 08d5d000 2010-05-18T20:55:19 Add commit parents to parsed commits and commit lists to the revpool. 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>
Vicent Marti 42281e00 2010-05-16T01:52:31 Add unit tests for Commit parsing 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>
Vicent Marti 4caa8962 2010-05-14T18:57:50 Fixed indentation issues in commit.c Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 417f0abc 2010-05-14T18:44:49 Add basic functionality for commit lookup/parsing 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>
Vicent Marti 1bb11859 2010-05-06T21:35:18 Fixed typos in the revwalk API documentation Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti b60488e1 2010-05-23T04:37:39 Added sort method for commit lists. Fixed bug when parsing time headers from commits. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 5e15176d 2010-05-23T02:39:57 Add commit caching on the commit table. Properly initialize the pending commits list. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti c5696427 2010-05-22T23:21:10 Add 'git_revpool_object' and 'git_revpool_table' structures. 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>
Ramsay Jones 38c513b9 2010-04-28T19:07:14 Add support to enable the library to use OpenSSL SHA1 functions Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 89217d8f 2010-04-28T20:20:00 Add functions to open a '*.pack' file and perform some basic validation Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 3cc60635 2010-03-05T19:06:28 Add some more (macro) file operation wrappers Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 54b9460f 2010-04-07T20:13:56 Fix the memory leak caused by failing to free the 'offset index' Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 19d13c65 2010-04-27T17:00:30 Makefile(s): Don't include the OpenSSL crypto library in the link Also, fully purge the NO_OPENSSL build variable. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones f019bd17 2010-04-27T16:36:52 Makefile: 'make clean' wipe all editor backup files in src/*/ In a similar way to commit 9b17380 ("Make 'make clean' wipe all object files in src/*/", 2010-04-14), we use a shell glob when removing editor backup files. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 44debd80 2010-04-27T16:13:57 Makefile: Add source for the built-in SHA1 routines to $(SRC_C) This results in the 'sparse' and 'coverage' targets including the C source files for the built-in SHA1 routines. In addition to the sparse check, this results in the generation of the '.gcov' file and inclusion in the test coverage report. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 70aab459 2010-04-26T22:04:10 win32: Remove wsock32 from the list of libraries to link Commit 5dddf7c (Add block-sha1 in favour of the mozilla routines 2010-04-14) introduced the "bswap.h" header file which, for x86 or x86-64 machines, provides a "sane" implementation of ntohl() and htonl(). The wsock32 library, on the msvc and MinGW build, is only included in the link to supply the ntohl()/htonl() routines. Since we now have a built-in implementation, we can remove the wsock32 library from the link. [This will break a Windows build on a non-intel machine] Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e272b103 2010-04-26T20:10:44 MSVC: Fix some compiler warnings 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>
Ramsay Jones e2337f39 2010-04-25T21:55:41 MSVC: Fix a syntax error caused by an inline function definition 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>
Andreas Ericsson fb799dfe 2010-04-23T09:59:22 Merge remote branch 'ramsay/dev' * 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
Andreas Ericsson 10074651 2009-04-08T09:56:07 Correct Adam Simpkins' name Signed-off-by: Andreas Ericsson <ae@op5.se>
Andreas Ericsson 5dddf7c8 2010-04-14T20:41:57 Add block-sha1 in favour of the mozilla routines 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>
Andreas Ericsson d15e94c0 2010-04-14T20:23:36 Add assembly sha1 implementation for ppc 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>
Andreas Ericsson a7335c51 2010-04-14T19:40:10 Add generic buildrule for assembly files Signed-off-by: Andreas Ericsson <ae@op5.se>
Andreas Ericsson 9b173803 2010-04-14T19:38:38 Make 'make clean' wipe all object files in src/*/ Instead of naming the subdirectories explicitly (which will result in us forgetting about one sooner or later), we change the shell glob pattern to wipe all object files from all subdirectories under src/. Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 2cdc4544 2010-02-26T22:53:10 Add a pack index 'virtual function' to fetch an index entry 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>
Ramsay Jones 608d33fa 2010-02-26T19:59:06 Add a pack index 'virtual function' to search by file offset 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>
Ramsay Jones abf5681c 2010-02-26T19:29:54 Change the interface of the pack index search function 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>
Ramsay Jones 238e54bc 2010-02-21T15:34:53 Add an 64-bit offset table index bounds check for v2 pack index Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 255a0dab 2010-02-19T22:36:31 Add a minimum size check when opening an v2 pack index file Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e8cc449f 2010-02-19T21:49:22 win32: Add separate MinGW and MSVC compatability header files Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 56931d1a 2010-02-19T20:07:03 Makefile: Add support for custom build options in config.mak file Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 1e5dd572 2010-02-12T16:50:33 Fix some coding style issues Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 74eff33f 2010-02-01T10:39:10 Makefile: Add support for building with MSVC Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 73dcf287 2010-01-12T16:39:25 msvc: Fix some "unreferenced formal parameter" warnings Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e8a95256 2010-01-04T18:57:13 msvc: Fix some -W4 warnings Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 1a7bae4d 2010-01-11T22:51:42 Fix some "unused parameter" warnings with -Wextra Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e3fe32b6 2010-01-11T21:11:55 Fix "'__thread' not at start of declaration" warnings (-Wextra) Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 0ef9d2aa 2010-01-03T22:56:54 Fix some "signed v unsigned comparison" warnings with -Wextra Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones a4f863af 2010-01-03T19:37:04 Fix an always false comparison "unsigned < 0" warning Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 803a6b4d 2010-01-03T19:12:05 Save the git_file in the gitfo_cache when enabling caching Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 1cfb0ff4 2009-12-30T19:12:35 Makefile: Add some missing $(GIT_LIB) dependencies Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e97179b6 2010-01-13T20:01:11 win32: Add a 'git__' prefix to the directory reading routines 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>
Ramsay Jones 90d4d2f0 2010-01-11T19:27:50 win32: Use an 64-bit file offset type Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones a1c0728d 2009-12-21T15:54:50 Add support for the MinGW platform Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones cfe3a027 2010-01-15T22:07:44 Use a 64 bit off_t throughout the library and tests on POSIX Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 960ca1d7 2009-08-28T21:22:46 Add the git_oid_to_string() utility function Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e4553584 2009-08-19T17:06:39 Add test-suite coverage testing using gcov 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 d2ef83fc 2009-08-28T20:22:03 t0101-oid.c: Fix a memory leak reported by valgrind Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones cac5d927 2009-08-27T16:11:07 Add support for running the tests via valgrind 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 04e88240 2009-06-17T22:21:10 win32: Define the ssize_t type using SSIZE_T if supported 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>
Ramsay Jones 5cae6c25 2009-06-17T15:54:59 Disable some msvc "deprecated function" warnings again 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>
Julio Espinoza-Sokal 209849a4 2009-06-15T21:27:49 Use GIT_INLINE macro instead of keyword inline. 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>
Julio Espinoza-Sokal 73c4dd92 2009-06-15T21:26:02 Add noreturn declaration compatible with the MSVC compiler. 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>
Ramsay Jones c79dded3 2009-06-14T22:13:35 win32: Add an fsync() implementation for windows 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>
Ramsay Jones 8a086f87 2009-06-14T22:12:20 win32: Add support for the MS Visual C/C++ compiler Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 2bf93fa1 2009-06-14T22:10:23 Correct the spelling of the FLEX_ARRAY macro 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>
Ramsay Jones 10aa3fa7 2009-06-04T17:14:35 Fix some "signed/unsigned mismatch" (msvc) compiler warnings Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 4c9a3973 2009-06-04T17:13:49 Improve the portability of the gitfo_cache code (to 64-bit systems) 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>
Ramsay Jones 3e0fb8fb 2009-06-04T17:12:59 thread-utils.h: Avoid using a non-standard C construct 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>
Ramsay Jones c8d42b9b 2009-06-04T17:12:00 t0020-dirent.c: Add explicit returns to the callback functions In particular, the one_entry() and dont_call_me() callback functions require explicit returns, in order to suppress some "control path" compiler warnings (from MS Visual C/C++). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones aee8b26e 2009-06-04T17:11:06 Makefile: move test related targets to a new tests/Makefile Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones cf33ac7a 2009-06-04T17:10:17 Makefile: Add CFLAGS to the "test_main.c" compile target Also, add the <string.h> include to test_main.c, in order to suppress the resulting "implicit declaration of strcmp()" warning. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones e17a3f56 2009-06-04T16:47:59 Implement git_odb_write() Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones ca481fc4 2009-06-04T16:46:54 Add the git_move_file() function Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 4319860c 2009-06-04T16:45:59 win32: Add some file operation stubs and wrapper functions Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 4d503f88 2009-06-04T16:48:53 gitfo_exists: replace call to stat() with access() Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones ac04bdf6 2009-06-04T16:44:54 Fix a usage error in a call to the object_file_name() function In 82324ac, the new static function exists_loose() called object_file_name() and, in order to detect an error return, tested for a negative value. This usage is incorrect, as the error return is indicated by a positive return value. (A successful call is indicated by a zero return value) The only error return from object_file_name() relates to insufficient buffer space and the return value gives the required minimum buffer size (which will always be >0). If the caller requires a dynamically allocated buffer, this allows something like the following call sequence: size_t len = object_file_name(NULL, 0, db->object_dir, id); char *buf = git__malloc(len); if (!buf) error(...); object_file_name(buf, len, db->object_dir,id); ... No current callers take advantage of this capability. Fix up the call site and change the return type of the function, from int to size_t, which more accurately reflects the implementation. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones fd0ec033 2009-03-23T18:52:00 Fix comments in renamed t020?-readloose tests Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 498bc090 2009-03-23T18:47:18 t0020-dirent.c: allow test to be run standalone This test assumed that it was invoked in an empty directory, which is true when run from the Makefile, and so would fail if run standalone. In order to allow the test to work when run from any directory, create a sub directory "dir-walk" and chdir() into this directory while running the tests. Also, add some additional tests. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 502acd16 2009-03-23T18:37:51 win32: Add missing include for mkdir() and rmdir() Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 0234c186 2009-03-20T19:52:50 win32: Add <dirent.h> directory reading routines Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 79ca2edc 2009-03-20T19:51:48 win32: Add routines to abstract memory-mapped file functions In particular, the git__mmap() and git__munmap() routines provide the interface to platform specific memory-mapped file facilities. We provide implementations for unix and win32, which can be found in their own sub-directories. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 7a6cf815 2009-03-16T17:08:45 win32: Open or create files in binary mode On windows, unless we use the O_BINARY flag in the open() call, the file I/O routines will perform line ending conversion (\r\n => \n on input, \n => \r\n on output). In addition to the performance penalty, most files in the object database are binary and will, therefore, become corrupted by this conversion. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Julio Espinoza-Sokal 0f39781c 2009-03-12T22:10:32 Add a test to check existence of loose objects. Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Julio Espinoza-Sokal 491442f9 2009-03-12T22:10:22 Factor out test helper methods for creating/deleting loose objects Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 840fb8b7 2009-02-18T18:53:48 win32: fixup some headers to improve win32 compilation Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones a9984a4e 2009-02-18T18:52:13 Fix some (digital-mars) compiler warnings In particular, conditional expressions which contain an assignment statement, where the expression type is not explicitly made to be boolean, elicits the following message: warning 2: possible unintended assignment Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones fc3c3a20 2009-02-18T18:50:36 Avoid using a gcc compiler language extension In particular, using pointer arithmetic on void pointers, despite being quite useful, is not legal in standard C. Avoiding non-standard C constructs will help in porting the library to other compilers/platforms. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 1906f236 2009-02-26T20:37:20 Add built-in (Mozilla) SHA1 routines Paul agreed to the GCC-exception license by email: | | From: Paul Kocher <paul@cryptography.com> | Date: Sun, 15 Mar 2009 11:37:23 -0700 | Subject: Re: Adding Mozilla SHA1 implementation to libgit2 | | Yes - that's fine. | | At 01:56 AM 3/5/2009, Andreas Ericsson wrote: | > Hi Paul. We spoke earlier about this, if you remember? | > We'd like to add the GCC-exception to the GPL license | > for these files. Signed-off-by: Paul Kocher <paul@cryptography.com> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 04c9c16e 2009-02-03T18:16:11 Correct some comments in readloose tests Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 82324ac1 2009-02-10T21:49:48 Add the git_odb_exists() object query function This function determines if the given object can be found in the object database. At present, only the local object database is searched. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones e9f5e877 2009-02-03T18:25:13 Rearrange some code to improve clarity In particular, the test for z-stream input completion (zs.avail_in != 0) logically belongs with the test for the Z_STREAM_END stream status. This is also consistent with the identical check in finish_inflate(). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 236e7579 2009-02-03T18:23:50 Check for error returns from inflateInit() At present, it is sufficient to ensure that an error return from inflateInit() is not ignored. Most error returns, like Z_VERSION_ERROR and Z_STREAM_ERROR, indicate programming or build errors. These errors could, perhaps, be handled with simple asserts. However, for a Z_MEM_ERROR, we may want to perform some further error handling in the future. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones c94eb4aa 2009-02-03T18:22:09 Fix a potential memory leak In particular, neglecting to call inflateEnd() along various codepaths in the inflate_tail() routine, would result in the failure to release zlib internal state. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>