Commit Graph

2276 Commits

Author SHA1 Message Date
nulltoken
3191ae89c6 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.
2012-05-07 12:18:54 +02:00
Carlos Martín Nieto
9b62e40ecd clar helper: don't dereference giterr_last() if it's NULL
It can cause segfaults if the call didn't set an error
2012-05-07 11:29:10 +02:00
Carlos Martín Nieto
49ac5ac8fc transport git: don't use 'error' uninitialized 2012-05-06 13:17:39 +02:00
Vicent Martí
3972ca43d8 compat: Add stdarg.h include 2012-05-05 22:14:02 -07:00
Vicent Martí
cd58c15c58 Merge remote-tracking branch 'scottjg/fix-mingw32' into development
Conflicts:
	src/netops.c
	src/netops.h
	src/transports/http.c
	tests-clar/clar
2012-05-05 16:47:20 -07:00
Vicent Martí
48ecd122ea Merge pull request #659 from libgit2/development-merge
New-error-handling
2012-05-05 14:22:53 -07:00
Vicent Martí
4ef14af935 Merge pull request #664 from arrbee/attrs-from-index
Support git attrs from index (and bare repo)
2012-05-05 14:22:06 -07:00
Vicent Martí
f95e8cc07c notes: Cleanup error handling 2012-05-05 14:18:10 -07:00
Vicent Martí
d3a60dc244 Merge pull request #663 from schu/notes-honor-config
Honor core.notesRef config option
2012-05-05 14:14:58 -07:00
Scott J. Goldman
35cdd261f3 Fix unsigned/signed comparison on Windows in commitstagedfile.c 2012-05-05 13:54:33 -07:00
Scott J. Goldman
b47e0a7171 Fix missing prototype warning in utf-conv.c 2012-05-05 13:52:48 -07:00
Scott J. Goldman
b4b96d56bf Fix gitno_connect() error handling on Windows
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.
2012-05-05 13:33:46 -07:00
Scott J. Goldman
06ac3e7f34 Fix clar generated code to compile on MINGW32
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
2012-05-05 13:16:48 -07:00
Russell Belfer
282283acc6 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
2012-05-04 16:46:46 -07:00
Vicent Martí
674a198599 clar: Properly create files in helper 2012-05-04 16:05:14 -07:00
Russell Belfer
3ec1fa5e1c Fixing issue with test data 2012-05-04 13:55:07 -07:00
Vicent Martí
1adf8c6a9c compat: va_copy on Win32 systems 2012-05-04 13:52:38 -07:00
Russell Belfer
b709e95146 Fix memory leaks and use after free 2012-05-04 11:06:12 -07:00
Russell Belfer
f917481ee8 Support reading attributes from index
Depending on the operation, we need to consider gitattributes
in both the work dir and the index.  This adds a parameter to
all of the gitattributes related functions that allows user
control of attribute reading behavior (i.e. prefer workdir,
prefer index, only use index).

This fix also covers allowing us to check attributes (and
hence do diff and status) on bare repositories.

This was a somewhat larger change that I hoped because it had
to change the cache key used for gitattributes files.
2012-05-03 16:37:25 -07:00
Michael Schubert
630c5a4a54 notes: add git_note_default_ref()
Add git_note_default_ref to allow easy retrieval of the currently set
default notes reference.
2012-05-03 22:31:29 +02:00
Michael Schubert
caea5e5433 notes: honor core.notesRef
Setting core.notesRef allows to change the default notes reference used
by Git. Check if set before using GIT_NOTES_DEFAULT_REF. Fixes #649.
2012-05-03 22:31:29 +02:00
Vicent Martí
76873c0905 Silence return value warning 2012-05-03 13:30:14 -07:00
Vicent Martí
2277216613 errors: Use a git_buf for building error strings 2012-05-03 00:04:04 -07:00
Vicent Martí
baaf1c4710 buffer: Add git_buf_vprintf 2012-05-03 00:03:58 -07:00
Vicent Martí
3fbcac89c4 Remove old and unused error codes 2012-05-02 19:56:38 -07:00
Vicent Martí
b02bcd97f8 Boom 2012-05-02 16:57:16 -07:00
Russell Belfer
17f1c9fb33 chmod for writability when writing test files 2012-05-02 16:44:47 -07:00
Vicent Martí
a1d0802576 Backport more test data 2012-05-02 16:33:26 -07:00
Vicent Martí
8c83fead91 Move test resources 2012-05-02 16:18:55 -07:00
Vicent Martí
946a6dc4e6 Update test suite 2012-05-02 16:14:30 -07:00
Vicent Martí
40879facad Merge branch 'new-error-handling' into development
Conflicts:
	.travis.yml
	include/git2/diff.h
	src/config_file.c
	src/diff.c
	src/diff_output.c
	src/mwindow.c
	src/path.c
	tests-clar/clar_helpers.c
	tests-clar/object/tree/frompath.c
	tests/t00-core.c
	tests/t03-objwrite.c
	tests/t08-tag.c
	tests/t10-refs.c
	tests/t12-repo.c
	tests/t18-status.c
	tests/test_helpers.c
	tests/test_main.c
2012-05-02 15:59:02 -07:00
Russell Belfer
3fd99be98a Convert from strnlen to git_text_is_binary
Since strnlen is not supported on all platforms and since we
now have the shiny new git_text_is_binary in the filtering
code, let's convert diff binary detection to use the new stuff.
2012-05-02 15:36:38 -07:00
Russell Belfer
8b2bcfbe68 Copy values to avoid strict aliasing warning
To make this code more resilient to future changes, we'll
explicitly translate the libgit2 structure to the libxdiff
structure.
2012-05-02 15:36:33 -07:00
Russell Belfer
16b83019af Fix usage of "new" for fieldname in public header
This should restore the ability to include libgit2 headers
in C++ projects.

Cherry picked 2de60205df from
development into new-error-handling.
2012-05-02 15:34:58 -07:00
Vicent Martí
b88021463f Merge remote-tracking branch 'carlosmn/remaining-errors' into new-error-handling
Conflicts:
	src/refspec.c
2012-05-01 19:16:14 -07:00
Vicent Martí
5587a9c930 Merge pull request #658 from schu/remote-disconnect
remote: don't free transport on disconnect
2012-05-01 17:55:22 -07:00
Michael Schubert
42ea35c061 remote: don't free transport on disconnect
Currently, git_remote_disconnect not only closes the connection but also
frees the underlying transport object, making it impossible to write
code like

	// fetch stuff
	git_remote_download()

	// close connection
	git_remote_disconnect()

	// call user provided callback for each ref
	git_remote_update_tips(remote, callback)

because remote->refs points to references owned by the transport object.
This means, we have an idling connection while running the callback for
each reference.

Instead, allow immediate disconnect and free the transport later in
git_remote_free().
2012-05-02 01:06:49 +02:00
Michael Schubert
52877c8975 tests-clar/diff: mark output_len unused 2012-05-01 15:13:14 +02:00
Vicent Martí
960d778619 Merge pull request #655 from nulltoken/topic/cr-normalization-test
crlf normalization test coverage
2012-04-30 15:57:20 -07:00
nulltoken
4e7a3c76e7 attr: add test coverage related to crlf normalization while staging 2012-05-01 00:33:25 +02:00
Vicent Martí
ced9da5412 Merge pull request #654 from carlosmn/pkt-err
Recognize and report server-side error messages
2012-04-30 14:38:15 -07:00
Russell Belfer
0dc8e95e19 Merge pull request #652 from nulltoken/topic/diff-callbacks
diff: provide more context to the consumer of the callbacks
2012-04-30 13:32:09 -07:00
Carlos Martín Nieto
39e6af6a7c net: recognize and report server-side error messages
When e.g. a repository isn't found, the server sends an error saying
so. Put that error message in our error buffer.
2012-04-30 18:24:14 +02:00
nulltoken
2de0652bb6 Leverage GIT_UNUSED macro to explicitly mark a function parameter as purposely unused 2012-04-30 07:41:33 +02:00
nulltoken
fa6420f73e buf: deploy git_buf_len() 2012-04-30 07:12:37 +02:00
nulltoken
1d2dd864ad diff: provide more context to the consumer of the callbacks
Update the callback to provide some information related to the file change being processed and the range of the hunk, when applicable.
2012-04-30 07:12:26 +02:00
nulltoken
da3c187d5e buf: add git_buf_len() accessor to expose the current length of the buffer content 2012-04-29 19:16:26 +02:00
Carlos Martín Nieto
8b9ec201ed Add a travis config file
Teach travis how to build the project.
2012-04-29 01:38:36 +02:00
Carlos Martín Nieto
fdc0c5f654 pkt: bring back GIT_ESHORTBUFFER
The recent 64-bit Windows fixes changed the return code in
git_pkt_parse_line() so it wouldn't signal a short buffer, breaking
the network code. Bring it back.
2012-04-29 01:21:53 +02:00
Michael Schubert
8af503bc85 remote: add more doc on git_remote_free 2012-04-28 20:49:05 +02:00