|
ffb55c53
|
2008-12-30T22:29:04
|
|
Rename the path of the objects directory to be more specific
We're likely to add additional path data, like the path of the
refs or the path to the config file into the git_odb structure,
as it may grow into the repository wrapper. Changing the name
of the objects directory reference makes it more clear should
we later add something else.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
4c67e2e9
|
2008-12-30T22:25:30
|
|
Change git_odb__read_packed to return ENOTFOUND until implemented
We didn't search for the object, so we cannot possibly promise it
to the caller of git_odb_read().
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
064301cc
|
2008-12-30T22:07:56
|
|
Fix size_t snprintf warning by using PRIuPTR format macro
This is the correct C99 format code for the size_t type when passed
as an argument to the *printf family. If the platform doesn't
define it, we assume %lu and just cross our fingers that its the
proper setting for a size_t on this system. On most sane platforms,
"unsigned long" is the underlying type of "size_t".
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
a1d34bc0
|
2008-12-30T21:49:38
|
|
Support building on Mac OS X by using pthread_getspecific for TLS
The Mach-O format does not permit gcc to implement the __thread
TLS specification, so we must instead emulate it using a single
int cell allocated from memory and stored inside of the thread
specific data associated with the current pthread.
What makes this tricky is git_errno must be a valid lvalue, so
we really need to return a pointer to the caller and deference it
as part of the git_errno macro.
The GCC-specific __attribute__((constructor)) extension is used
to ensure the pthread_key_t is allocated before any Git functions
are executed in the library, as this is necessary to access our
thread specific storage.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
d7467949
|
2008-12-30T21:50:10
|
|
Remove unnecessary import of stdlib.h from revwalk.h
OS headers are best imported from a more central location anyway.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
b3039bee
|
2008-12-30T21:25:13
|
|
Cleanup formatting in our head files to be more consistent
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
213e720c
|
2008-12-20T20:47:41
|
|
Change usages of static inline to GIT_INLINE
Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
c960d6a3
|
2008-12-27T18:59:43
|
|
Add a routine to determine a git_oid given an git_obj
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
007e0753
|
2008-12-27T18:58:25
|
|
Add some routines for SHA1 hash computation
[sp: Changed signature for output to use git_oid, and added
a test case to verify an allocated git_hash_ctx can be
reinitialized and reused.]
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
42fd40db
|
2008-12-27T18:56:16
|
|
Fix a bug in gitfo_read_file()
In particular, when asked to read an empty file, this function
calls malloc() with a zero size allocation request. Standard C
says that the behaviour of malloc() in this case is implementation
defined.
[C99, 7.20.3 says "... If the size of the space requested is zero,
the behavior is implementation-defined: either a null pointer is
returned, or the behavior is as if the size were some nonzero
value, except that the returned pointer shall not be used to
access an object."]
Finesse the issue by over-allocating by one byte. Setting the extra
byte to '\0' may also provide a useful sentinel for text files.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
3d3552e8
|
2008-12-18T22:58:10
|
|
Implement git_odb__read_loose()
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
75d58430
|
2008-12-18T22:56:14
|
|
Add a file reading routine along with an io buffer type
In particular, the gitfo_read_file() routine can be used to slurp
the complete file contents into an gitfo_buf structure. The buffer
content will be allocated by malloc() and may be released by the
gitfo_free_buf() routine. The io buffer type can be initialised
on the stack with the GITFO_BUF_INIT macro.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
7b6e8067
|
2008-12-10T18:31:28
|
|
Add some git_otype string conversion and testing routines
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
b3be0fc7
|
2008-12-03T23:54:47
|
|
Fix an "implicit function definition" warning on cygwin
In particular, the warning relates to malloc(), which is
declared in <stdlib.h>. This header is now included,
indirectly, via the "common.h" header.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
5ee2fe77
|
2008-12-03T23:53:55
|
|
Add a GIT_PATH_MAX constant
The PATH_MAX symbol is often, but not always, defined
in the <limits.h> header. In particular, on cygwin you
need to include this header to avoid a compilation error.
However, some systems define PATH_MAX to be something as
small as 256, which POSIX is happy to allow, while others
allow much larger values. In general it can vary from
one filesystem to another.
In order to avoid the vagaries of different systems, define
our own symbol.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
192678b5
|
2008-12-03T23:52:57
|
|
Fix some doxygen warnings and errors
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
af795e49
|
2008-12-02T09:56:23
|
|
Add routines to convert git_oid to hex strings
[sp: Credit for some of this implementation goes to Pieter, I
started off a patch he proposed for libgit2 but reworked
enough of it that I don't want to blame him for any bugs.]
Suggested-by: Pieter de Bie <pdebie@ai.rug.nl>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
b72ca267
|
2008-11-29T19:21:24
|
|
Diasble TLS on cygwin
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
17643760
|
2008-11-29T19:20:07
|
|
Use __CHECKER__ to detect when sparse is running
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
43288a07
|
2008-11-29T19:18:43
|
|
Fixup documentation to reflect the "git_obj" rename
commit dff79e27d3d2cdc09790ded80fe2ea8ff5d61034 renamed
the (small object) "git_sobj" to a plain "git_obj", but
neglected to update some of the documentation to reflect
that change.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
ea790f33
|
2008-11-29T15:34:20
|
|
Add a dirent walker to the fileops API
Since at least MS have something like GetFirstDirEnt() and
GetNextDirEnt() (presumably with superior performance), we
can let MS hackers add support for a dirent walker using
that API instead, while we stick with the posix-style
readdir() calls.
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
4188d28f
|
2008-11-29T15:28:12
|
|
Add an io caching layer to the gitfo api
The idea is taken from Junio's work in read-cache.c, where
it's used for writing out the index without tap-dancing on
the poor harddrive. Since it's almost certainly useful for
cached writing of packfiles too, we turn it into a generic
API, making it perfectly simple to reuse it later.
gitfo_write_cached() has the same contract as gitfo_write(), it
returns GIT_SUCCESS if all bytes are successfully written (or were
at least buffered for later writing), and <0 if an error occurs
during buffer writing.
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
ec250c6e
|
2008-11-23T22:37:55
|
|
Remove config.h and make fileops an internal API
Since it doesn't make sense to make the disk access stuff
portable *AND* public (that's a job for each application
imo), we can take a shortcut and just support unixy stuff
for now and get away with coding most of it as macros.
Since we go with an internal API for starters and only
provide higher-level API's to the libgit users, we'll be
ok with this approach.
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
c6ebb4a9
|
2008-11-22T15:17:17
|
|
Remove license top-comment from public header files
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>
|
|
ae234862
|
2008-11-18T22:20:15
|
|
Add an embryo of a TLS-aware error handling system
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>
|
|
3a2aabdc
|
2008-11-22T14:44:47
|
|
Add util.h - utility macros
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>
|
|
76a8c447
|
2008-11-22T14:42:12
|
|
Add internal common.h file
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>
|
|
f501265f
|
2008-11-22T14:40:51
|
|
Add cc-compat.h - C compiler compat macros for internal use
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>
|
|
c215be41
|
2008-11-22T14:57:40
|
|
Rename git_revpool_* functions gitrp_*
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>
|
|
4f0adcd0
|
2008-11-18T21:28:55
|
|
Get rid of GIT__PRIVATE macro
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>
|
|
36f0f61f
|
2008-11-18T19:06:25
|
|
Add compiler/platform agnostic thread-local storage
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>
|
|
d4043ee9
|
2008-11-18T01:18:52
|
|
Move public headers to src/git
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>
|
|
1b9e92c7
|
2008-11-18T01:02:27
|
|
s/git_revp/git_revpool/
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>
|
|
dff79e27
|
2008-11-18T00:59:36
|
|
Rename "git_sobj" "git_obj"
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>
|
|
1699efc4
|
2008-11-03T18:39:37
|
|
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>
|
|
2dbdb824
|
2008-11-03T18:38:57
|
|
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>
|
|
3e9e6909
|
2008-11-03T17:14:25
|
|
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>
|
|
b7c891c6
|
2008-11-03T17:31:16
|
|
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>
|
|
b3a2f90e
|
2008-11-03T18:00:49
|
|
Enable warnings by default and fix warning in oid.c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
16a67770
|
2008-11-01T16:53:06
|
|
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>
|
|
50298f44
|
2008-11-01T15:55:01
|
|
Switch the license from BSD to GPL+libgcc exception
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
d1ea30c3
|
2008-11-01T15:42:23
|
|
Move include files to include/git/, drop git_ prefix from file names
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
3e89665e
|
2008-10-31T18:34:02
|
|
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>
|
|
6533aadc
|
2008-10-31T18:23:01
|
|
Drop the _t suffix as it is a POSIX reserved namespace
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
de2220a4
|
2008-10-31T18:16:26
|
|
Replace git_result_t with int
This seems to be preferred on the mailing list.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
4f9339df
|
2008-10-31T15:10:51
|
|
Hide non-exported symbols when linking the library
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
06160502
|
2008-10-31T12:30:28
|
|
Take the first stab at defining revision traversal
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
8edc2805
|
2008-10-31T11:46:51
|
|
Correct group name of the git_odb module
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
29f0e90f
|
2008-10-31T11:04:48
|
|
Add _t suffix to all data types
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
1cd20d3a
|
2008-10-31T10:57:04
|
|
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>
|
|
b51eb250
|
2008-10-31T10:55:58
|
|
Cleanup git_odb documentation formatting
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
bce499af
|
2008-10-31T11:01:28
|
|
Add a GIT_ prefix to OBJ_ constants to scope them better
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
111d5ccf
|
2008-10-31T10:56:18
|
|
Add a git_sobj_close to release the git_sobj data
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
46d8b885
|
2008-10-31T10:43:20
|
|
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>
|
|
44181c23
|
2008-10-31T10:42:32
|
|
Mark git_oid parameters const when they shouldn't be modified
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|
|
c15648cb
|
2008-10-31T09:57:29
|
|
Initial draft of libgit2
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
|