Permalink
Switch branches/tags
Nothing to show
Commits on Nov 24, 2008
  1. Allow pthread-based TLS

    pieter committed Nov 24, 2008
    This adds support for pthread when using Thread-local
    storage. Because pthread uses accessor methods, we
    add some macros to make things easier.
    
    This patch is not complete: pthread keys require
    initialization using the pthread_key_create function,
    which we don't call yet
  2. Add oid to hex functions

    pieter committed Nov 24, 2008
Commits on Nov 22, 2008
  1. Make using CFLAGS a bit simpler

    ageric committed with spearce Nov 22, 2008
    This patch introduces the $(ALL_CFLAGS) variable, which holds
    $(BASIC_CFLAGS) as well as userdefined $(CFLAGS) and then
    consistently uses that variable where both were used anyway.
    
    Since we're in the area, we optimize the sparse running a
    bit, getting rid of the shell and just letting sparse iterate
    over the files.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. Add $(CONFIG_H) as a build-dependency for sparse

    ageric committed with spearce Nov 22, 2008
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  3. Make src/git/config.h a macro in Makefile

    ageric committed with spearce Nov 22, 2008
    This makes it far more convenient to reference as a dependency
    for other targets.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  4. Remove license top-comment from public header files

    ageric committed with spearce Nov 22, 2008
    Since it's being added when we install the headers anyway,
    we might as well get rid of it. If anything, we should point
    coders to the COPYING file in the project's root directory
    instead of duplicating the same (large-ish) text everywhere.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  5. Add an embryo of a TLS-aware error handling system

    ageric committed with spearce Nov 18, 2008
    This adds the per-thread global variable git_errno to the
    system, which callers can examine to get information about
    an error.
    
    Two helper functions are added to reduce LoC-count for the
    library code itself.
    
    Also, some exceptions are made for running sparse on GIT_TLS
    definitions, since it doesn't grok thread-local variables at
    all.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  6. Add util.h - utility macros

    ageric committed with spearce Nov 22, 2008
    ARRAY_SIZE() et al go in util.h, included from common.h
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  7. Add internal common.h file

    ageric committed with spearce Nov 22, 2008
    This one pulls in compiler compatibility macros, some
    common header files, and also the public common.h header.
    
    C source files are modified to use the private common.h
    in favour of the public one.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  8. Add cc-compat.h - C compiler compat macros for internal use

    ageric committed with spearce Nov 22, 2008
    Holds things such as FLEX_ARRAY and whatnot.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  9. Rename git_revpool_* functions gitrp_*

    ageric committed with spearce Nov 22, 2008
    Otherwise their prototypes don't match their declarations.
    
    Detected by 'sparse', which is obviously good to run
    before each commit.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  10. Add a 'sparse' make target

    ageric committed with spearce Nov 18, 2008
    Given the confusion on git@vger, we'd better not name
    this target "check" or (worse) "test", but it's still
    useful to have. As "sparse", noone should have problems
    understanding what it does.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  11. s/COPYING/.HEADER/ for install-headers target

    ageric committed with spearce Nov 22, 2008
    We don't want to prepend the entire license; Only the
    file header part of it.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  12. Get rid of GIT__PRIVATE macro

    ageric committed with spearce Nov 18, 2008
    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>
Commits on Nov 18, 2008
  1. Add compiler/platform agnostic thread-local storage

    ageric committed with spearce Nov 18, 2008
    It doesn't cover all cases, but we can work on those as
    we go along. For now, gcc, MSVC++, Intel C/C++, IBM XL C/C++,
    Sun Studio C/C++ and Borland C++ Builder are the supported
    compilers (although we boldly assume that they all are of
    a recent enough version to support thread-local storage).
    
    This is intended to be used in upcoming patches that implement
    graceful (but TLS-dependant) error-handling in the library.
    
    As an added bonus, we also bring the online_cpus() function
    from git.git to detect the number of usable cpu's.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. Add a fake and phony install-headers target

    ageric committed with spearce Nov 18, 2008
    It actually does what it's supposed to (more or less),
    but not very portably and not to the correct directory.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  3. Move public headers to src/git

    ageric committed with spearce Nov 18, 2008
    It's arguably smoother to keep them close to the source,
    as that's where one's working when modifying them. More
    importantly, though, is the ability to use private headers
    in the src/ dir that simply include "git/$samename.h" to
    get to the public API at the same time.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  4. s/git_revp/git_revpool/

    ageric committed with spearce Nov 18, 2008
    git_revp is something I personally can't stop pronouncing
    "rev pointer". I'm sure others would suffer the same
    problem.
    
    Also, rename the git_revp_ sub-api "gitrp_". This is the
    first of many such renames, primarily done to prevent
    extreme inflation in the "git_" namespace, which we'd like
    to reserve for a higher-level API.
    
    While we're at it, we remove the noise-char "c" from a lot
    of functions. Since revision walking is all about commits,
    the common case should be that we're dealing with commits.
    Exceptions can get a more mnemonic description as needed.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  5. Rename "git_sobj" "git_obj"

    ageric committed with spearce Nov 17, 2008
    The 's' never really made sense, since it's not a "small"
    object at all, but rather a plain object. As such, it should
    have a "plain" object name.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  6. Use same-directory include for public headers

    ageric committed with spearce Nov 17, 2008
    It doesn't make sense to use "git/somefile.h" in the
    public git headers, as it's quite likely that projects
    using them will have a git directory themselves. This
    alters it, making the public headers look for headers
    in the same directory they themselves are in.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  7. List git.git authors consenting to relicense their code

    ageric committed with spearce Nov 17, 2008
    Since re-using code from git.git proper is the quick way
    forward, we need to list those who have given their consent
    to do just that. The relicense permission is only valid for
    use with libgit2, and only for GPLv2 + gcc-exception (as
    specified by 'COPYING'.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Nov 4, 2008
  1. Add a zlib support shell

    spearce committed Nov 4, 2008
    Some versions of zlib don't have a deflateBound defined, so
    we define it ourselves after including zlib.h.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. Implement some of the basic git_odb open and close API

    spearce committed Nov 4, 2008
    Far from being complete, but its a good start.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  3. Add git_fsize to the os file API

    spearce committed Nov 4, 2008
    This permits us to get the size of an opened file.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  4. Redefine git_fread, git_fwrite to transfer the whole unit

    spearce committed Nov 4, 2008
    We never want to accept a short read or a short write when
    transferring data to or from a local file.
    
    Either the entire read (or write) completes or the operation
    failed and we will not recover gracefully from it.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  5. Add git_oid_cpy, git_oid_cmp as inline functions

    spearce committed Nov 4, 2008
    These are easily built off the standard C library functions memcpy
    and memcmp.  By marking these inline we stand a good chance of
    the C compiler replacing the entire thing with tight machine code,
    because many compilers will actually inline a memcmp or memcpy when
    the 3rd argument (the size) is a constant value.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  6. Add an extra oid test to verify control characters aren't read

    spearce committed Nov 4, 2008
    We only want hex digits to be read, any other character in the 8-bit
    character set is invalid within an id string.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  7. Change test_main to run a single test case out of the suite

    spearce committed Nov 4, 2008
    By passing the name of the test function on the command line
    we execute exactly that one test, and then exit successfully
    if the test did not fail.  This permits multiple functions in
    the same .c file, so they could be called from a shell script
    or debugged independently externally.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  8. Fix Makefile to correctly handle 'make -j4 test'

    spearce committed Nov 4, 2008
    If we have more than one test build running we cannot use the same
    file for each test case; instead we need to use a per-test path so
    there aren't any collisions.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  9. Fix GIT_EXTERN to actually mark the prototype as extern

    spearce committed Nov 4, 2008
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  10. Move GIT_NORETURN into test_lib.h only

    spearce committed Nov 4, 2008
    We should never have a noreturn style function in the library
    itself, as such a function would prevent the calling application
    from handling error conditions the way it wants.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  11. Enable warnings by default and fix warning in oid.c

    spearce committed Nov 4, 2008
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  12. Correct indentation in git/odb.h

    spearce committed Nov 4, 2008
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Nov 2, 2008
  1. Create a basic test suite for the library and test oid functions

    spearce committed Nov 2, 2008
    This is a horribly simple test suite that makes it fairly easy to
    put together some basic function level unit tests on the library.
    Its patterned somewhat after the test suite in git.git, but also
    after the "Check" test library.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Nov 1, 2008
  1. Create a micro abstraction around the POSIX file APIs

    spearce committed Nov 1, 2008
    This way we can start to write IO code to read and write files in the
    Git object database, but provide a hook to inject native Win32 APIs
    instead so libgit2 can be ported to run natively on that platform.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>