src


Log

Author Commit Date CI Message
Vicent Marti 44908fe7 2010-12-06T23:03:16 Change the library include file Libgit2 is now officially include as #include "<git2.h>" or indidividual files may be included as #include <git2/index.h> Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti d12299fe 2010-12-03T22:22:10 Change include structure for the project The maze with include dependencies has been fixed. There is now a global include: #include <git.h> The git_odb_backend API has been exposed. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 7d7cd885 2010-12-03T18:01:30 Decouple storage from ODB logic Comes with two default backends: loose object and packfiles. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 86bfec39 2010-12-06T01:13:09 Revert changes in odb.c to eventually rebase The odb.c will disappear after the decoupling changes. Signed-off-by: Vicent Marti <tanoku@gmail.com>
nulltoken 6f02c3ba 2010-12-05T20:18:56 Small source code readability improvements. Replaced magic number "0" with GIT_SUCCESS constant wherever it made sense.
Vicent Marti 691aa968 2010-12-02T18:35:38 Add 'git_repository_open2' to customize repo folders Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti eec95235 2010-12-02T04:58:22 Commit parents now use the common 'vector' code No more linked lists, no more O(n) access. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 41109a7e 2010-12-02T04:42:33 Merge branch 'commitparents' of https://github.com/JustinLove/libgit2 into JustinLove-commitparents
Vicent Marti c4034e63 2010-12-02T04:31:54 Refactor all 'vector' functions into common code All the operations on the 'git_index_entry' array and the 'git_tree_entry' array have been refactored into common code in the src/vector.c file. The new vector methods support: - insertion: O(1) (avg) - deletion: O(n) - searching: O(logn) - sorting: O(logn) - r. access: O(1) Signed-off-by: Vicent Marti <tanoku@gmail.com>
Justin Love eb095435 2010-11-30T21:28:39 add git_commit_parent to retrieve a parent by index
Justin Love 12114415 2010-11-30T21:01:47 add git_commit_parentcount
Vicent Marti 8c1f9e4d 2010-11-29T18:07:17 Make the bitmasks for Index Entry flags public Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 91e88941 2010-11-29T18:06:22 Properly write Index Entry 'flags_extended' Always write the 'flags_extended' attribute to disk if it's available. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 25e9b4dd 2010-11-24T17:48:31 Do proper symbol exports on MSVC Yes, if you are wondering why the shared library was failing to build under MSVC, it's because it was empty. Oh wow. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 322086f9 2010-11-24T17:46:46 Do not use STDINT types in public headers Old versions of MSVC don't have such types available. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 8b0e448f 2010-11-23T16:51:18 Removed unreachable code (MSVC warning)
Vicent Marti 43e380a8 2010-11-23T15:18:53 Fix gitfo_isdir() in Win32 systems Because adhering to the POSIX standards is overrated. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 6b1eab39 2010-11-23T14:36:31 Fix MSVC warnings and errors Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 824f4acd 2010-11-23T22:33:28 Fix redeclaration warnings in MSVC Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 30b171a1 2010-11-20T17:37:32 Change blob API to return temp refs to the content If the user wants permanent references, he can duplicate the temporary one manually. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 69a09b7c 2010-11-19T17:17:46 Fix wrong pointer check in git__strdup Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti c3dd69a9 2010-11-17T04:59:11 Fix resizing the index array No longer segfaults when resizing an empty array. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 50dd6ca5 2010-11-17T04:58:32 Fix repository initialization We cannot assume that non-bare repositories have an index file, because 'git index' doesn't create it by default. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 111e3622 2010-11-16T03:24:39 Fix freeing blob objects from the ODB The internal contents of the blob were being free'd but not the blob object itself. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti c3a20d5c 2010-11-14T22:11:46 Add support for 'index add' Actually add files to the index by creating their corresponding blob and storing it on the repository, then getting the hash and updating the index file. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 7a3924fc 2010-11-14T22:07:48 Fix overcomplicated return statement Note to self: don't be stupid Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 237da401 2010-11-14T22:06:10 Add support for blob files Blob files can now be loaded from the repository like all the other base Git types. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Scott Chacon 0be42199 2010-11-10T13:43:55 accessor for index entry count
Colin Timmermans 69f0295c 2010-11-06T00:14:18 Fix compiler warning in commit.c
Colin Timmermans 1081d909 2010-11-05T18:04:46 Fix parsing of commits that have no newlines in the message.
Vicent Marti 3f43678e 2010-11-07T01:24:45 Make the Index API public Several private methods of the Index API are now public, including the methods to remove, get and add index entries. All the methods only take an integer value for the position of the entry to get/remove. To get or remove entries based on their path names, look them up first using the git_index_find method. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Dave Borowitz 88d035bd 2010-11-04T15:08:01 Update commit_time along with committer.
Vicent Marti a8bfce69 2010-11-05T03:50:24 Add string descriptions for all error codes Old descriptions have been updated and new ones have been added for the 'git_strerror' function. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 1795f879 2010-11-05T03:20:17 Improve error handling All initialization functions now return error codes instead of pointers. Error codes are now properly propagated on most functions. Several new and more specific error codes have been added in common.h Signed-off-by: Vicent Marti <tanoku@gmail.com>
Dave Borowitz 1544bc31 2010-11-02T16:02:37 Only require an index for non-bare repos.
Vicent Marti 6fd195d7 2010-11-02T18:42:42 Change git_repository initialization to use a path The constructor to git_repository is now called 'git_repository_open(path)' and takes a path to a git repository instead of an existing ODB object. Unit tests have been updated accordingly and the two test repositories have been merged into one. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti d80e9d55 2010-10-31T06:01:46 Fix in-memory commit getters trying to parse Issue 9 on the tracker. The commit object getters for in-memory objects were trying to parse an inexistant on-disk object when one of the commit attributes which were still not set was queried. We now return a NULL value when this happens. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 57450775 2010-10-29T02:44:32 Do a full parse on commits before modifying them Before changing the attributes of a commit, make sure that the internal status is consistent with the one in the repository. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti a13bc8e7 2010-10-29T02:22:38 Add getter methods for object owners You can know access the owning repository of any existing object, or the repository on which a revision walker is working on. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti adc0327a 2010-10-29T00:44:15 Add git_odb_read_header method to the ODB As requested, git_odb_read_header looks up an object on the ODB, but loads only the header information (type & size) without loading any of the actual file contents in memory. It is significantly faster than doing a git_odb_read if you only need an object's information and not its contents. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 58519018 2010-10-28T02:07:18 Fix internal memory management on the library String mememory is now managed in a much more sane manner. Fixes include: - git_person email and name is no longer limited to 64 characters - git_tree_entry filename is no longer limited to 255 characters - raw objects are properly opened & closed the minimum amount of times required for parsing - unit tests no longer leak - removed 5 other misc memory leaks as reported by Valgrind - tree writeback no longer segfaults on rare ocassions The git_person struct is no longer public. It is now managed by the library, and getter methods are in place to access its internal attributes. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Ramsay Jones e3005627 2010-10-12T19:11:51 bswap.h: Add ntohs() and htons() functions Since commit 70aab459, the msvc and MinGW builds have relied on the built-in implementation of ntohl() and htonl(), rather than linking the wsock32 library. The new index manipulation code now calls ntohs()/htons() in addition to ntohl()/htonl(), so we need to provide a built-in implementation of the 16-bit functions. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Benjamin C Meyer 0d95f32c 2010-10-25T22:26:14 Change /* to /** at the start of comment blocks in public api so doxygen will generate documenation and not hide them. Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
Benjamin C Meyer 0037e491 2010-10-25T16:32:16 Fix spelling mistakes in the documentation. Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
Benjamin C Meyer 544d1519 2010-10-25T16:32:31 Remove whitespace from the end of the line in documentation. Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
Vicent Marti e4def81a 2010-10-08T13:52:17 Fix issue 3 (memory corruption resize_tree_array) The tree array wasn't being initialized when instantiating a tree object in memory instead of loading it from disk. New unit tests added to check for the problem. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti ec25391d 2010-10-07T00:20:08 Add write-back support for Tag files Tag files can now be created and modified in-memory (all the setter methods have been implemented), and written back to disk using the generic git_object_write() method. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti c4b5bedc 2010-10-07T00:07:32 Fix possible segfaults in src/tree.c (issue 1) git_tree_entry_byname was dereferencing a NULL pointer when the searched file couldn't be found on the tree. New test cases have been added to check for entry access methods. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 2a884588 2010-09-21T17:17:10 Add write-back support for git_tree All the setter methods for git_tree have been added, including the setters for attributes on each git_tree_entry and methods to add/remove entries of the tree. Modified trees and trees created in-memory from scratch can be written back to the repository using git_object_write(). Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti d45b4a9a 2010-09-20T21:39:11 Add support for in-memory objects All repository objects can now be created from scratch in memory using either the git_object_new() method, or the corresponding git_XXX_new() for each object. So far, only git_commits can be written back to disk once created in memory. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 0c3596f1 2010-09-20T01:57:53 Add setter methods & write support for git_commit All the required git_commit_set_XXX methods have been implemented; all the attributes of a commit object can now be modified in-memory. The new method git_object_write() automatically writes back the in-memory changes of any object to the repository. So far it only supports git_commit objects. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti e802d8cc 2010-09-19T03:53:57 Implement internal methods to write on sources The new 'git__source_printf' does an overflow-safe printf on a source bfufer. The new 'git__source_write' does an overflow-safe byte write on a source buffer. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti f49a2e49 2010-09-19T03:21:06 Give object structures more descriptive names The 'git_obj' structure is now called 'git_rawobj', since it represents a raw object read from the ODB. The 'git_repository_object' structure is now called 'git_object', since it's the base object class for all objects. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti a7a7ddbe 2010-09-18T19:16:04 Add generic methods for object writeback git_repository_object has now several internal methods to write back the object information in the repository. - git_repository__dbo_prepare_write() Prepares the DBO object to be modified - git_repository__dbo_write() Writes new bytes to the DBO object - git_repository__dbo_writeback() Writes back the changes to the repository Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 46f8566a 2010-09-12T23:43:21 Add methods to access internal attributes in git_repo Added several methods to access: - The ODB behind a repo - The SHA1 id behind a generic repo object - The type of a generic repo object Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 370ce569 2010-08-14T20:35:10 Fix: do not export custom types in the extern API Some compilers give linking problems when exporting 'uint32_t' as a return type in the external API. Use generic types instead. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 9c9f4fc1 2010-08-12T23:40:54 Add support for manually freeing repo objects A new method 'git_repository_object_free' allows to manually force the freeing of a repository object, even though they are still automatically managed by the repository and don't need to be freed by the user. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti f2408cc2 2010-08-12T19:59:32 Fix object handling in git_repository All loaded objects through git_repository_lookup are properly parsed & free'd on failure. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 0e465f97 2010-08-12T18:47:32 Add auxiliary method git__hexdump New function in util.c to do a dump of a buffer's contents in hexadecimal to stdout. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 003c2690 2010-08-12T18:45:31 Finish the tree object API 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 68535125 2010-07-09T20:19:56 Add support for git index files The new 'git_index' structure is an in-memory representation of a git index on disk; the 'git_index_entry' structures represent each one of the file entries on the index. The following calls for index instantiation have been added: git_index_alloc(): instantiate a new index structure git_index_free(): free an existing index git_index_clear(): clear all the entires in an existing file The following calls for index reading and writing have been added: git_index_read(): update the contents of the index structure from its file on disk. Internally implemented through: git_index__parse() Index files are stored on disk in network byte order; all integer fields inside them are properly converted to the machine's byte order when loading them in memory. The parsing engine also distinguishes between normal index entries and extended entries with 2 extra bytes of flags. The 'TREE' extension for index entries is also loaded into memory: Tree caches stored in Index files are loaded into the 'git_index_tree' structure pointed by the 'tree' pointer inside 'git_index'. 'index->tree' points to the root node of the tree cache; the full tree can be traversed through each of the node's 'tree->children'. Index files can be written back to disk through: git_index_write(): atomic writing of existing index objects backed by internal method git_index__write() The following calls for entry manipulation have been added: git_index_add(): insert an empty entry to the index git_index_find(): search an entry by its path name git_index__append(): appends a new index entry to the end of the list, resizing the entries array if required New index entries are always inserted at the end of the array; since the index entries must be sorted for it to be internally consistent, the index object is only sorted once, and if required, before accessing the whole entriea array (e.g. before writing to disk, before traversing, etc). git_index__remove_pos(): remove an index entry in a specific position git_index__sort(): sort the entries in the array by path name The entries array is sorted stably and in place using an insertion sort, which ought to be the most efficient approach since the entries array is always mostly-sorted. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti bd0a51c0 2010-07-09T20:17:00 Add support for atomic file locking The struct 'git_filelock' represents an atomically-locked file, git-style. Locked files can be modified atomically through the new file lock interface: int git_filelock_init(git_filelock *lock, const char *path); int git_filelock_lock(git_filelock *lock, int append); void git_filelock_unlock(git_filelock *lock); int git_filelock_commit(git_filelock *lock); int git_filelock_write(git_filelock *lock, const char *buffer, size_t length); Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 3315782c 2010-08-08T14:12:17 Redesigned the walking/object lookup interface 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 f8758044 2010-08-07T01:02:20 Add loading and parsing of tag objects 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 364788e1 2010-08-07T00:59:58 Refactor parsing methods 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 7e4f56a5 2010-08-06T18:37:59 Add packfile reading 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 d8603ed9 2010-07-10T16:51:15 Add parsing of tree file contents. The basic information (pointed trees and blobs) of each tree object in a revision pool can now be parsed and queried. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 52f2390b 2010-07-07T14:56:05 Add external API to access detailed commit attributes 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 225fe215 2010-06-18T13:06:34 Add support for tree objects in revision pools Commits now store pointers to their tree objects. Tree objects now work as separate git_revpool_object entities. Tree objects can be loaded and parsed inedependently from commits. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 40721f6b 2010-07-10T11:50:16 Changed revpool's object table to support arbitrary objects git_revpool_object now has a type identifier for each object type in a revpool (commits, trees, blobs, etc). Trees can now be stored in the revision pool. git_revpool_tableit now supports filtering objects by their type when iterating through the object table. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 088a731f 2010-06-09T14:54:22 Fixed memory leaks in test suite 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 58b0cbea 2010-07-10T12:14:30 Actually free all commits when freeing a commit pool Previously the objects table was being freed, but not the actuall commits. All git_commit objects are freed and hence invalidated when freeing the git_rp object they belong to. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 3cd8b687 2010-07-10T12:08:04 Fix warning in util.h (signed vs unsigned comparison) This fix had been delayed by Ramsay because on 32-bit systems it highlights the fact that off_t is set to an invalid value. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Ramsay Jones ca3939e6 2010-06-03T22:28:30 msvc: Disable a level 4 warning and change -W3 to -W4 Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 4386ee2a 2010-06-05T21:09:03 Add a 'git__' prefix to the block-sha1 functions This reduces the global namespace pollution. These functions were the only remaining external symbols (with the exception of an PPC_SHA1 build) which did not start with 'git', and since these are private library symbols the 'git__' prefix is appropriate. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones d03f5675 2010-06-04T18:20:31 Remove the sha1.h header file and inline the content into hash.c Given that the sha1.h header file should never be included into any other file, since it represents an implementation detail of hash.c, we remove the header and inline it's content. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones bc874e11 2010-05-13T20:53:58 msvc: Select the "fast" definition of the {get,put}_be32() macros On Intel machines, the msvc compiler defines the CPU architecture macros _M_IX86 and _M_X64 (equivalent to __i386__ and __x86_64__ respectively). Use these macros in the pre-processor expression to select the "fast" definition of the {get,put}_be32() macros. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 552e23ba 2010-06-02T19:16:28 Fix a bug in the git_oid_to_string() function When git_oid_to_string() was passed a buffer size larger than GIT_OID_HEXSZ+1, the function placed the c-string NUL char at the wrong position. Fix the code to place the NUL at the end of the (possibly truncated) oid string. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones f2924934 2010-06-01T19:41:55 Style: Do not use (C99) // comments Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones b2bc567f 2010-06-01T19:40:58 Style: Fix brace placement and spacing Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 702bd705 2010-06-01T19:39:24 Fix a memory leak shown by valgrind Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 28f98329 2010-06-01T19:37:10 Fix inconsistent definition of off_t on Linux In order to avoid inconsistent definitions of type off_t, all compilation units should include the "common.h" header file before certain system headers (those which directly or indirectly lead to the definition of off_t). The "common.h" header contains the definition of _FILE_OFFSET_BITS to select 64-bit file offsets. The symptom of this inconsistency, while compiling with -Wextra, is the following warning: In file included from src/common.h:50, from src/commit.c:28: src/util.h: In function git__is_sizet: src/util.h:41: warning: comparison between signed and unsigned In order to fix the problem, we simply remove the #include <time.h> statement at the head of src/commit.c. Note that src/commit.h also includes <time.h>. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones c1b62b2e 2010-06-01T19:35:49 Fix a "dereference of type-punned pointer" compiler warning gcc (4.4.0) issues the following warning: src/revobject.c:33: warning: dereferencing type-punned pointer \ will break strict-aliasing rules We suppress the warning by copying the first 4 bytes from the oid structure into an 'unsigned int' using memcpy(). This will also fix any potential alignment issues on certain platforms. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 6e0fa05b 2010-06-01T19:34:48 Fix a doxygen warning In particular, doxygen issues the following warning: .../src/git/revwalk.h:86: Warning: The following parameters of \ gitrp_sorting(git_revpool *pool, unsigned int sort_mode) are \ not documented: parameter 'pool' Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 84b9cec7 2010-06-01T19:33:57 Fix sparse warnings: "symbol not declared. Should it be static?" In particular, sparse issues the following warnings: src/revobject.c:29:14: warning: symbol 'max_load_factor' was \ not declared. Should it be static? src/revobject.c:31:14: warning: symbol 'git_revpool_table__hash' was \ not declared. Should it be static? In order to suppress these warnings, we simply declare them as static, since they are not (currently) referenced outside of this file. In the case of max_load_factor, this is probably correct. However, this may not be appropriate for git_revpool_table__hash(), given how it is named. So, this should either be re-named to reflect it's non-external status, or a declaration needs to be added to the revobject.h header file. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones ee1765e5 2010-06-01T19:32:41 Fix sparse warnings: "Using plain integer as NULL pointer" In order to suppress this warning, we could simply replace the constant 0 with NULL. However, in this case, replacing the comparison with 0 by !buffer is more idiomatic. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 4e0d6d86 2010-06-01T19:30:29 msvc: Fix an "conversion, loss of data" compiler warning In particular, the compiler issues the following warning: src/revwalk.c(61) : warning C4244: '=' : conversion from \ 'unsigned int' to 'unsigned char', possible loss of data In order to suppress the warning, we change the type of the sorting "enum" field of the git_revpool structure to be consistent with the sort_mode parameter of the gitrp_sorting() function. Note that if the size of the git_revpool structure is an issue, then we could change the type of the sort_mode parameter instead. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 5440906f 2010-06-01T19:29:15 msvc: Fix some compiler warnings In particular, the compiler issues the following warnings: src/revobject.c(29) : warning C4305: 'initializing' : truncation \ from 'double' to 'const float' src/revobject.c(56) : warning C4244: '=' : conversion from \ 'const float' to 'unsigned int', possible loss of data src/revobject.c(149) : warning C4244: '=' : conversion from \ 'const float' to 'unsigned int', possible loss of data In order to suppress the warnings we change the type of max_load_factor to double, rather than change the initialiser to 0.65f, and cast the result type of the expressions to 'unsigned int' as expected by the assignment operators. Note that double should be able to represent all unsigned int values without loss. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 8a7d625f 2010-06-01T19:28:04 Fix some "signed/unsigned comparison" compilation warnings These warnings are issued by both gcc (-Wextra) and msvc (-W3). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 5b7487be 2010-06-01T19:26:42 Fix a memory corruption runtime error On the msvc build, the tests t0401-parse and t0501-walk both crash with a runtime error (ACCESS_VIOLATION). This is caused by writing to un-allocated memory due to an under-allocation of a git_revpool_table data structure. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 331578fb 2010-06-01T19:25:28 msvc: Fix a "declaration after statement" compilation error Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti de141d4b 2010-05-28T02:02:02 Improved error handling on auxilirary functions. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti c2550609 2010-05-28T01:50:59 Use the first 4 bytes of an OID as hash, instead of full hashing. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 6bb7aa13 2010-05-28T01:48:59 Added new error codes. Improved error handling. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 9b3577ed 2010-05-28T00:23:43 Fixed brace placement and converted spaces to tabs. 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 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 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 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 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>