Commit Graph

162 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
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í
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í
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
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
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
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í
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
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
Michael Schubert
52877c8975 tests-clar/diff: mark output_len unused 2012-05-01 15:13:14 +02:00
nulltoken
4e7a3c76e7 attr: add test coverage related to crlf normalization while staging 2012-05-01 00:33:25 +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
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
Russell Belfer
d58336dda8 Fix leading slash behavior in attrs/ignores
We were not following the git behavior for leading slashes
in path names when matching git ignores and git attribute
file patterns.  This should fix issue #638.
2012-04-26 10:51:45 -07:00
Carlos Martín Nieto
3aa351ea0f error handling: move the missing parts over to the new error handling 2012-04-26 15:38:42 +02:00
nulltoken
eb3d71a5bc diff: fix generation of the header of a removal patch 2012-04-25 15:37:17 -07:00
Russell Belfer
c2b670436f Rename git_khash_str to git_strmap, etc.
This renamed `git_khash_str` to `git_strmap`, `git_hash_oid` to
`git_oidmap`, and deletes `git_hashtable` from the tree, plus
adds unit tests for `git_strmap`.
2012-04-25 15:20:28 -07:00
Russell Belfer
19fa2bc111 Convert attrs and diffs to use string pools
This converts the git attr related code (including ignores) and
the git diff related code (and implicitly the status code) to use
`git_pools` for storing strings.  This reduces the number of small
blocks allocated dramatically.
2012-04-25 10:42:37 -07:00
Russell Belfer
2bc8fa0227 Implement git_pool paged memory allocator
This adds a `git_pool` object that can do simple paged memory
allocation with free for the entire pool at once.  Using this,
you can replace many small allocations with large blocks that
can then cheaply be doled out in small pieces.  This is best
used when you plan to free the small blocks all at once - for
example, if they represent the parsed state from a file or data
stream that are either all kept or all discarded.

There are two real patterns of usage for `git_pools`: either
for "string" allocation, where the item size is a single byte
and you end up just packing the allocations in together, or for
"fixed size" allocation where you are allocating a large object
(e.g. a `git_oid`) and you generally just allocation single
objects that can be tightly packed.  Of course, you can use it
for other things, but those two cases are the easiest.
2012-04-25 10:42:37 -07:00
Carlos Martín Nieto
a7d19b975a config: also allow escaping outside of a quoted string
This limitation was a misparsing of the documentation.
2012-04-25 15:47:53 +02:00
Vicent Martí
f9f2344bd4 Merge pull request #632 from arrbee/win64-cleanup
Code clean up, including fixing warnings on Windows 64-bit build
2012-04-23 17:28:11 -07:00
Vicent Martí
4795807ad5 Merge pull request #637 from nulltoken/issue/odb-refcount
Fix git_repository_set_odb() refcount issue
2012-04-23 17:25:11 -07:00
Russell Belfer
26515e73a1 Rename to git_reference_name_to_oid 2012-04-23 10:06:31 -07:00
nulltoken
baf861a511 Fix git_repository_set_odb() refcount issue
git_repository_free() calls git_odb_free() if the owned odb is not null.

According to the doc, when setting a new odb through git_repository_set_odb() the caller has to take care of releasing the odb by himself.
2012-04-23 11:07:19 +02:00
schu
5c9a794d0b tests-clar: update to latest version of clar
Signed-off-by: schu <schu-github@schulog.org>
2012-04-21 18:36:13 +02:00
Vicent Martí
54e4d0f25b Merge pull request #629 from nulltoken/issue/index-refcount
Index refcount issue
2012-04-18 17:34:52 -07:00
Russell Belfer
44ef8b1b30 Fix warnings on 64-bit windows builds
This fixes all the warnings on win64 except those in deps, which
come from the regex code.
2012-04-17 10:47:39 -07:00
Russell Belfer
f201d613a8 Add git_reference_lookup_oid and lookup_resolved
Adds a new public reference function `git_reference_lookup_oid`
that directly resolved a reference name to an OID without returning
the intermediate `git_reference` object (hence, no free needed).

Internally, this adds a `git_reference_lookup_resolved` function
that combines looking up and resolving a reference.  This allows
us to be more efficient with memory reallocation.

The existing `git_reference_lookup` and `git_reference_resolve`
are reimplmented on top of the new utility and a few places in the
code are changed to use one of the two new functions.
2012-04-17 10:44:50 -07:00
Russell Belfer
1a6e8f8a54 Update clar and remove old helpers
This updates to the latest clar which includes the helpers
`cl_assert_equal_s` and `cl_assert_equal_i`.  Convert the code
over to use those and remove the old libgit2-only helpers.
2012-04-17 10:35:11 -07:00
Carlos Martín Nieto
2c1075d65a config: parse quoted values
Variable values may be quoted to include newlines, literal quotes and
other characters. Add support for these and test it.
2012-04-16 10:25:52 +02:00
schu
3fa1ec4af6 tests-clar/repo: fix unused warning
ifdef GIT_WIN32 helper unposix_path() to avoid unused-function warning
on non-Windows systems.

Signed-off-by: schu <schu-github@schulog.org>
2012-04-15 20:30:12 +02:00
nulltoken
c1aefb35dd Fix git_repository_set_index() refcount issue
git_repository_free() calls git_index_free() if the owned index is not null.

According to the doc, when setting a new index through git_repository_set_index() the caller has still to take care of releasing the index by itself.

In order to cope with this, this fix makes sure the index refcount is incremented when a new repository is being plugged a new index.
2012-04-14 15:05:38 +02:00
nulltoken
fdd1149c29 Fix MSVC compilation warnings
Removed unreferenced variables.
2012-04-14 13:46:13 +02:00
Russell Belfer
14a513e058 Add support for pathspec to diff and status
This adds preliminary support for pathspecs to diff and status.
The implementation is not very optimized (it still looks at
every single file and evaluated the the pathspec match against
them), but it works.
2012-04-13 15:00:29 -07:00
Vicent Martí
d1f331564d Merge remote-tracking branch 'carlosmn/revwalk-merge-base' into new-error-handling 2012-04-13 20:41:06 +02:00
Carlos Martín Nieto
5cf7bccd2b revwalk: add test hiding a commit without a merge base
Nothing should be hidden and this shouldn't bother the merge base
calculation.
2012-04-12 20:25:25 +02:00