Sascha Cunz [Fri, 11 May 2012 02:25:23 +0000 (04:25 +0200)]
Specifiy dllimport to MSVC if we're not building libgit2.dll
Building a "shared object" (DLL) in Windows includes 2 steps:
- specify __declspec(dllexport)
when building the library itself. MSVC will disallow itself from
optimizing these symbols out and reference them in the PE's
Exports-Table.
Further, a static link library will be generated. This library
contains the symbols which are exported via the declsepc above.
The __declspec(dllexport) becomes part of the symbol-signature
(like parameter types in C++ are 'mangled' into the symbol name,
the export specifier is mingled with the name)
- specify __declspec(dllimport)
when using the library. This again mingles the declspec into the
name and declares the function / variable with external linkage.
cmake automatically adds -Dgit2_EXPORTS to the compiler arguments
when compiling the libgit2 project.
The 'git2' is the name specified via PROJECT() in CMakeLists.txt.
Scott J. Goldman [Mon, 14 May 2012 06:12:51 +0000 (23:12 -0700)]
Add a test to verify FILENAME_MAX
Since we now rely on it (at least under Solaris), I figured we probably
want to make sure it's accurate. The new test makes sure that creating a
file with a name of length FILENAME_MAX+1 fails.
Scott J. Goldman [Thu, 10 May 2012 06:45:55 +0000 (23:45 -0700)]
Fix readdir_r() usage for Solaris
On Solaris, struct dirent is defined differently than Linux. The field
containing the path name is of size 0, rather than NAME_MAX. So, we need to
use a properly sized buffer on Solaris to avoid a stack overflow.
Russell Belfer [Thu, 10 May 2012 18:08:59 +0000 (11:08 -0700)]
Add cache busting to attribute cache
This makes the git attributes and git ignores cache check
stat information before using the file contents from the
cache. For cached files from the index, it checks the SHA
of the file instead. This should reduce the need to ever
call `git_attr_cache_flush()` in most situations.
This commit also fixes the `git_status_should_ignore` API
to use the libgit2 standard parameter ordering.
Russell Belfer [Tue, 8 May 2012 20:50:40 +0000 (13:50 -0700)]
Improve repo initialization to be more like git
This adds a bunch of template files to the initialization for
hooks, info/exclude, and description. This makes our initialized
repo look more like core gits.
fetch: filter tag annotation pseudo-refs while generating wants
These objects aren't considered as being advertised, so asking for
them will cause the remote end to close the connection. This makes the
checking in update_tips() unnecessary, because they don't get inserted
in the list.
Russell Belfer [Tue, 8 May 2012 22:03:59 +0000 (15:03 -0700)]
Add support for diffing index with no HEAD
When a repo is first created, there is no HEAD yet and attempting
to diff files in the index was showing nothing because a tree
iterator could not be constructed. This adds an "empty" iterator
and falls back on that when the head cannot be looked up.
Russell Belfer [Mon, 7 May 2012 20:30:27 +0000 (13:30 -0700)]
Fix directory finding for attrs
The fix to support attrs on bare repos went a little too far
in trying to avoid using the working directory and ended up
not processing the input path quite correctly.
nulltoken [Sun, 6 May 2012 11:04:12 +0000 (13:04 +0200)]
compat: make p_open able to accept optional mode when passing the O_CREAT flag
This has the nice side effect of making test_attr_repo__staging_properly_normalizes_line_endings_according_to_gitattributes_directives() test pass again on Windows. This test started to fail after commit 674a198 was applied.
nulltoken [Thu, 1 Mar 2012 16:03:32 +0000 (17:03 +0100)]
commit/tag: ensure the message is cleaned up
'git commit' and 'git tag -a' enforce some conventions, like cleaning up excess whitespace and making sure that the last line ends with a '\n'. This fix replicates this behavior.
Previously, it was defined in netops.c, but it's also needed in one of the
clar tests, so I figured we might as well just make it global for the
whole project.
Without it, the mingw32 linker won't resolve GetProcessId() (called from
the core/errors.c clar test) because of some conditionals in windows.h.
gitno_connect() can return an error or socket, which is fine on most
platforms where sockets are file descriptors (signed int), but on Windows,
SOCKET is an unsigned type, which is problematic when we are trying to
test if the socket was actually a negative error code.
This fix seperates the error code and socket in gitno_connect(), and fixes
the error handling in do_connect() functions to compensate. It appears
that git_connect() and the git-transport do_connect() functions had bugs
in the non-windows cases too (leaking sockets, and not properly reporting
connection error, respectively) so I went ahead and fixed those too.
MINGW32 does not define _mktemp_s, so we can just use _mktemp instead. See
the non-compressed/non-base64-encoded version of the patch here:
http://gist.github.com/2605249
Russell Belfer [Fri, 4 May 2012 23:46:46 +0000 (16:46 -0700)]
Fix valgrind issues
There are three changes here:
- correctly propogate error code from failed object lookups
- make zlib inflate use our allocators
- add OID to notfound error in ODB lookups