- 01 Jan, 2009 3 commits
-
-
Currently we only catalog the available pack files into a table, storing their path names relative to the pack directory. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
When scanning the pack directory we need to see if the path name is present for ".idx" when we discover a ".pack" file. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
Checking the return value of snprintf is a pain, as it must be >= 0 and < sizeof(buffer). git__fmt is a simple wrapper to perform these checks. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
-
- 31 Dec, 2008 19 commits
-
-
Our fileops API is currently private. We aren't planning on supplying a cross-platform file API to applications that link to us. If we did, we'd probably whole-sale publish fileops, not just the dirent code. By moving it to be private we can also change the call signature to permit the buffer to be passed down through the call chain. This is very helpful when we are doing a recursive scan as we can reuse just one buffer in all stack frames, reducing the impact the recursion has on the stack frames in the data cache. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones committed -
Some linkers require ranlib to build a symbol table on the archive in order to work with it. Most platforms that don't have this requirement permit ranlib as a noop. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
We grab the lock while accessing the alternates list, ensuring that we only initialize it once for the given git_odb. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
These abstractions can be used to implement an efficient resource reference counter and simple mutual exclusion. On pthreads we use pthread_mutex_t, except when we are also on glibc and can directly use its asm/atomic.h definitions. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
If we are using threads we need to make sure pthread.h comes in before just about anything else. Some platforms enable macros that alter what other headers define. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
This way we can be fairly certain we run tests of lower-level parts of the library before we run tests of higher-level more complex parts. If there is any problem in a lower-level part of the library, the earlier test will identify it and stop, making it easire to troubleshoot the failure. A rough naming guide has been added for the test suite to explain the current category structure. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
Some systems may use cpp macros to define these functions, glibc appears to be one of them. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
This error code indicates the OS error code has a better value describing the last error, as it is likely a network or local file IO problem identified by a C library function call. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
We now forbid direct use of malloc, strdup or calloc within the library and instead use wrapper functions git__malloc, etc. to invoke the underlying library malloc and set git_errno to a no memory error code if the allocation fails. In the future once we have pack objects in memory we are likely to enhance these routines with garbage collection logic to purge cached pack data when allocations fail. Because the size of the function will grow somewhat large, we don't want to mark them for inline as gcc tends to aggressively inline, creating larger than expected executables. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
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>
Shawn O. Pearce committed -
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>
Shawn O. Pearce committed -
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>
Shawn O. Pearce committed -
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>
Shawn O. Pearce committed -
OS headers are best imported from a more central location anyway. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Julio Espinoza-Sokal committed -
libz and libcrypto dependencies were added recently while libgit2.pc did not get updated. Signed-off-by: Steve Frécinaux <code@istique.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Steve Frécinaux committed
-
- 30 Dec, 2008 5 commits
-
-
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones committed -
[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>
Ramsay Jones committed -
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>
Ramsay Jones committed -
The libgit2.pc is generated on make install and installed, to allow using the lib through the pkg-config helper. Signed-off-by: Steve Frécinaux <code@istique.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Steve Frécinaux committed -
It accepts a prefix= parameter (default: /usr/local). Signed-off-by: Steve Frécinaux <code@istique.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Steve Frécinaux committed
-
- 19 Dec, 2008 2 commits
-
-
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones committed -
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>
Ramsay Jones committed
-
- 18 Dec, 2008 2 commits
-
-
It was removed in ec250c6e. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed -
This way tests can run in parallel without stepping on each other's temporary work files. If a test passes the directory is removed completely; if a test fails only empty directories are removed. This permits inspection of the failed test's left behind state. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
-
- 10 Dec, 2008 1 commit
-
-
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones committed
-
- 09 Dec, 2008 4 commits
-
-
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>
Ramsay Jones committed -
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>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones committed -
Signed-off-by: Andreas Ericsson <ae@op5.se>
Andreas Ericsson committed
-
- 02 Dec, 2008 4 commits
-
-
[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>
Shawn O. Pearce committed -
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>
Ramsay Jones committed -
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>
Ramsay Jones committed -
cgcc is the recommended way to run sparse, since it provides many -Defines suitable to the given gcc platform. For example, on some Ubuntu/glibc versions, a plain sparse invocation gives the following warning: "warning: This machine appears to be neither x86_64 nor i386." Using "cgcc -no-compile" instead eliminates this warning. 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>
Ramsay Jones committed
-