Commit Graph

4488 Commits

Author SHA1 Message Date
Andreas Ericsson
257bd746cf Use same-directory include for public headers
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>
2008-11-18 10:32:53 -08:00
Andreas Ericsson
eb160e949e List git.git authors consenting to relicense their code
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>
2008-11-18 10:32:53 -08:00
Shawn O. Pearce
8b6f008eda Add a zlib support shell
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>
2008-11-03 18:53:09 -08:00
Shawn O. Pearce
1699efc421 Implement some of the basic git_odb open and close API
Far from being complete, but its a good start.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-03 18:52:32 -08:00
Shawn O. Pearce
2dbdb824f0 Add git_fsize to the os file API
This permits us to get the size of an opened file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-03 18:52:28 -08:00
Shawn O. Pearce
3e9e69098a Redefine git_fread, git_fwrite to transfer the whole unit
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>
2008-11-03 18:43:04 -08:00
Shawn O. Pearce
b7c891c629 Add git_oid_cpy, git_oid_cmp as inline functions
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>
2008-11-03 18:43:04 -08:00
Shawn O. Pearce
367ab010d6 Add an extra oid test to verify control characters aren't read
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>
2008-11-03 18:43:04 -08:00
Shawn O. Pearce
b81dd80e8c Change test_main to run a single test case out of the suite
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>
2008-11-03 18:42:54 -08:00
Shawn O. Pearce
b923f2f97d Fix Makefile to correctly handle 'make -j4 test'
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>
2008-11-03 18:42:54 -08:00
Shawn O. Pearce
3b8ab0b935 Fix GIT_EXTERN to actually mark the prototype as extern
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-03 18:42:54 -08:00
Shawn O. Pearce
fbbfdf9f13 Move GIT_NORETURN into test_lib.h only
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>
2008-11-03 18:42:54 -08:00
Shawn O. Pearce
b3a2f90e54 Enable warnings by default and fix warning in oid.c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-03 18:42:54 -08:00
Shawn O. Pearce
8722a77ec3 Correct indentation in git/odb.h
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-03 18:40:06 -08:00
Shawn O. Pearce
15bffce9f7 Create a basic test suite for the library and test oid functions
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>
2008-11-01 18:24:39 -07:00
Shawn O. Pearce
16a67770b7 Create a micro abstraction around the POSIX file APIs
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>
2008-11-01 16:53:06 -07:00
Shawn O. Pearce
50298f44a4 Switch the license from BSD to GPL+libgcc exception
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-01 15:55:47 -07:00
Shawn O. Pearce
d1ea30c399 Move include files to include/git/, drop git_ prefix from file names
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-01 15:42:23 -07:00
Shawn O. Pearce
3e89665eb6 Scratch the git_revp_attr configuration of a git_revp
This isn't the best idea I've head.  Pierre Habouzit was suggesting
a technique of assigning a unique integer to each commit and then
allocating storage out of auxiliary pools, using the commit's unique
integer to index into any auxiliary pool in constant time.  This way
both applications and the library can efficiently attach arbitrary
data onto a commit, such as rewritten parents, or flags, and have
them disconnected from the main object hash table.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 18:34:02 -07:00
Shawn O. Pearce
6dafd05667 Document the return NULL style of calling convention
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 18:30:43 -07:00
Shawn O. Pearce
6533aadc21 Drop the _t suffix as it is a POSIX reserved namespace
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 18:30:43 -07:00
Shawn O. Pearce
de2220a48f Replace git_result_t with int
This seems to be preferred on the mailing list.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 18:30:40 -07:00
Pierre Habouzit
4f9339df94 Hide non-exported symbols when linking the library
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 15:10:51 -07:00
Shawn O. Pearce
061605020c Take the first stab at defining revision traversal
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 12:47:11 -07:00
Shawn O. Pearce
0e7fa1fe68 Note that comments should be doxygen javadoc style
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 12:30:04 -07:00
Shawn O. Pearce
13ce9f1b96 Fix Makefile targets to correctly depend on *.h files
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 12:28:49 -07:00
Shawn O. Pearce
8edc2805f1 Correct group name of the git_odb module
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:46:51 -07:00
Shawn O. Pearce
b39843f3e4 Use wildcard to avoid listing out all source files by hand
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:44:00 -07:00
Shawn O. Pearce
7335ffc31f Begin a description of our naming and coding conventions
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:37:58 -07:00
Shawn O. Pearce
29f0e90ff4 Add _t suffix to all data types
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:21:24 -07:00
Shawn O. Pearce
bce499af70 Add a GIT_ prefix to OBJ_ constants to scope them better
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:05:05 -07:00
Shawn O. Pearce
1cd20d3af0 Hide git_odb's internal structure from applcation code
This way only structures we ask the caller to allocate on their
call stack or which we want to allow them to use members from
are shown in the API docs.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:05:05 -07:00
Shawn O. Pearce
111d5ccf0b Add a git_sobj_close to release the git_sobj data
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:05:05 -07:00
Shawn O. Pearce
b51eb250ed Cleanup git_odb documentation formatting
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:05:05 -07:00
Shawn O. Pearce
171aaf21d9 Hide GIT_{BEGIN,END}_DECL from doxygen as its not part of our API
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:05:05 -07:00
Shawn O. Pearce
46d8b885bd Rename git_odb_sread to just git_odb_read
Most read calls will use the small object format, as the
majority of the content within the database is very small
objects (under 20 KB when inflated).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 11:05:02 -07:00
Shawn O. Pearce
44181c23ea Mark git_oid parameters const when they shouldn't be modified
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 10:42:32 -07:00
Shawn O. Pearce
c15648cbd0 Initial draft of libgit2
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-31 09:57:29 -07:00