Commit Graph

2276 Commits

Author SHA1 Message Date
Russell Belfer
f01fa26690 Fix workdir iterator unit tests
This test is fragile if you leave extra files in the test
data directory, such as a foo.c~ file from editing with
Emacs.  Who would do such a thing?
2012-02-23 11:17:48 -08:00
Russell Belfer
290f240ee0 Fix readdir usage across platforms
This fixes the missing readdir_r from win32 and fixes other
platforms to always use the reentrant readdir_r form for reading
directory contents.
2012-02-23 11:16:47 -08:00
Russell Belfer
1ec1de6d43 Fix warnings about type conversion on win32 2012-02-23 11:15:45 -08:00
Vicent Martí
df16fbcf36 Merge pull request #572 from schu/fix-warning-uninitialized
Fix -Wuninitialized warning
2012-02-23 08:18:54 -08:00
schu
0126954007 Fix -Wuninitialized warning
Signed-off-by: schu <schu-github@schulog.org>
2012-02-23 16:51:07 +01:00
Vicent Martí
36d72a5125 Merge pull request #570 from arrbee/uniform-iterators
Uniform iterators for trees, index, and workdir
2012-02-22 16:06:33 -08:00
Russell Belfer
0534641dfe Fix iterators based on pull request feedback
This update addresses all of the feedback in pull request #570.

The biggest change was to create actual linked list stacks for
storing the tree and workdir iterator state.  This cleaned up
the code a ton.  Additionally, all of the static functions had
their 'git_' prefix removed, and a lot of other unnecessary
changes were removed from the original patch.
2012-02-22 15:15:35 -08:00
Russell Belfer
da337c8064 Iterator improvements from diff implementation
This makes two changes to iterator behavior: first, advance
can optionally do the work of returning the new current value.
This is such a common pattern that it really cleans up usage.

Second, for workdir iterators, this removes automatically
iterating into directories.  That seemed like a good idea,
but when an entirely new directory hierarchy is introduced
into the workdir, there is no reason to iterate into it if
there are no corresponding entries in the tree/index that it
is being compared to.

This second change actually wasn't a lot of code because not
descending into directories was already the behavior for
ignored directories.  This just extends that to all directories.
2012-02-22 11:22:33 -08:00
Vicent Martí
8d36b253e2 Merge pull request #565 from carlosmn/multimap
Add config multivar support
2012-02-22 11:12:20 -08:00
Vicent Martí
20ed8983ea Merge pull request #571 from saurik/development
Export parse_tag_buffer as git_tag__parse_buffer.
2012-02-22 11:09:48 -08:00
Jay Freeman (saurik)
b60deb0235 Export parse_tag_buffer as git_tag__parse_buffer. 2012-02-22 04:45:30 +00:00
Russell Belfer
b6c93aef42 Uniform iterators for trees, index, and workdir
This create a new git_iterator type of object that provides a
uniform interface for iterating over the index, an arbitrary
tree, or the working directory of a repository.

As part of this, git ignore support was extended to support
push and pop of directory-based ignore files as the working
directory is being traversed (so the array of ignores does
not have to be recreated at each directory during traveral).

There are a number of other small utility functions in buffer,
path, vector, and fileops that are included in this patch
that made the iterator implementation cleaner.
2012-02-21 14:46:24 -08:00
Carlos Martín Nieto
9c94a356cc Fix check for writing remote's fetch and push configurations
Fix copy-paste error
2012-02-21 12:15:23 +01:00
Vicent Martí
481f5e2721 Merge pull request #568 from carlosmn/remotes
Remotes improvements
2012-02-20 11:35:08 -08:00
Carlos Martín Nieto
f0f3a18af6 Move git_remote_load() to git_buf 2012-02-20 19:48:41 +01:00
Carlos Martín Nieto
89e5ed98dc Add git_remote_save() 2012-02-20 19:48:41 +01:00
Carlos Martín Nieto
bcb8c007f1 Add git_remote_set_{fetch,push}spec()
Allow setting the fetch and push refspecs, which is useful for
creating new refspecs.
2012-02-20 18:42:05 +01:00
Carlos Martín Nieto
b13dbb91ea regex: fix sign warnings 2012-02-18 01:32:13 +01:00
Carlos Martín Nieto
1eaecf2f18 regex: The world uses utf-8 2012-02-18 01:31:48 +01:00
Carlos Martín Nieto
4a1ecba6d9 regex: Move the defines to a config header and include it unconditionally 2012-02-18 01:31:43 +01:00
Carlos Martín Nieto
2b15f61f48 Add GNU LGPL to COPYING 2012-02-17 22:22:12 +01:00
Carlos Martín Nieto
c17b1d0052 Add POSIX regex sources when needed
Windows doesn't support POSIX regex, so we need to include it
ourselves. The sources come from git, which in turn took them from
gawk.
2012-02-17 22:00:17 +01:00
Carlos Martín Nieto
d9da4ccaa0 Document {get,set}_multivar 2012-02-17 19:50:30 +01:00
Carlos Martín Nieto
3005855f7e Implement setting multivars 2012-02-17 19:50:30 +01:00
Carlos Martín Nieto
5e0dc4af01 Support getting multivars 2012-02-17 19:43:43 +01:00
Carlos Martín Nieto
78d65f390f tests: add multivar read test 2012-02-17 19:43:43 +01:00
Carlos Martín Nieto
0774d94d31 Store multivars in the multimap 2012-02-17 19:43:43 +01:00
Carlos Martín Nieto
fefd4551a5 First round of config multimap changes
Move the configuration to use a multimap instead of a list. This
commit doesn't provide any functional changes but changes the support
structures.
2012-02-17 19:43:43 +01:00
Vicent Martí
555c81f335 Merge pull request #563 from schu/notes-fixup
notes: fix assert
2012-02-16 04:22:56 -08:00
schu
0691966a73 notes: fix assert
Hopefully fix issue "Don't sleep and code" - #558.

Signed-off-by: schu <schu-github@schulog.org>
2012-02-16 12:01:09 +01:00
Vicent Martí
6117895fef Merge pull request #558 from schu/notes-api
Notes API
2012-02-15 11:38:40 -08:00
schu
bf477ed4a8 Add git notes API
This commit adds basic git notes support to libgit2, namely:

* git_note_read
* git_note_message
* git_note_oid
* git_note_create
* git_note_remove

In the long run, we probably want to provide some convenience callback
mechanism for merging and moving (filter-branch) notes.

Signed-off-by: schu <schu-github@schulog.org>
2012-02-15 20:32:14 +01:00
Vicent Martí
0c3bae6268 zlib: Remove custom git2/zlib.h header
This is legacy compat stuff for when `deflateBound` is not defined, but
we're not embedding zlib and that function is always available. Kill
that with fire.
2012-02-15 16:56:56 +01:00
schu
905919e63b util: add git__ishex
git__ishex allows to check if a string is a hexadecimal representation.

Signed-off-by: schu <schu-github@schulog.org>
2012-02-15 13:07:50 +01:00
schu
b4b79ac3db commit: actually allow yet to be born update_ref
git_commit_create is supposed to update the given reference
"update_ref", but segfaulted in case of a yet to be born
reference. Fix it.

Signed-off-by: schu <schu-github@schulog.org>
2012-02-15 13:07:41 +01:00
Vicent Martí
66faeb5c5d Merge pull request #557 from schu/copyright
Update Copyright header
2012-02-13 08:19:40 -08:00
schu
5e0de32818 Update Copyright header
Signed-off-by: schu <schu-github@schulog.org>
2012-02-13 17:11:09 +01:00
Vicent Martí
2c19b5658c Merge pull request #474 from schu/clang-unused
Fix "clang warning: expression result unused"
2012-02-13 07:02:42 -08:00
schu
15f52ae1d6 config_file: fix clang sizeof-pointer-memaccess 2012-02-13 13:30:04 +01:00
Vicent Martí
4ef52315d9 Merge pull request #556 from schu/fix-sign-compare
tests-clar: fix warning sign-compare
2012-02-13 04:21:24 -08:00
schu
90e6c6203d tests-clar: fix warning sign-compare
Signed-off-by: schu <schu-github@schulog.org>
2012-02-13 12:13:05 +01:00
Vicent Martí
6d39c0dd6f Merge pull request #554 from carlosmn/revwalk-reset
revwalk: unmark commits as uninteresting on reset
2012-02-11 06:44:54 -08:00
Vicent Martí
f19e3ca288 odb: Proper symlink hashing 2012-02-10 20:16:42 +01:00
Vicent Martí
18e5b8547d odb: Add internal git_odb__hashfd 2012-02-10 19:47:02 +01:00
Vicent Martí
9b8d56087c makefile: Define _GNU_SOURCE in the embed mkfile 2012-02-09 01:18:26 +01:00
Carlos Martín Nieto
97313ce2a3 revwalk: unmark commits as uninteresting on reset
Not doing so hides commits we want to get at during a second walk.
2012-02-07 11:33:02 +01:00
Vicent Martí
61eba2d836 Merge pull request #553 from nacho/glib
Add libgit2-glib link to README.md
2012-02-07 02:27:17 -08:00
Ignacio Casal Quinteiro
13f7707169 Add libgit2-glib link to README.md 2012-02-07 10:20:03 +01:00
Vicent Martí
242a1cea8d libgit2 v0.16.0 "Dutch Fries"
This lovely and much delayed release of libgit2 ships from the cold city
of Brussels, which is currently hosting FOSDEM 2012.

There's been plenty of changes since the latest stable release, here's a
full summary:

- Git Attributes support (see git2/attr.h)
	There is now support to efficiently parse and retrieve information
	from `.gitattribute` files in a repository. Note that this
	information is not yet used e.g. when checking out files.

- .gitignore support
	Likewise, all the operations that are affected by `.gitignore` files
	now take into account the global, user and local ignores when
	skipping the relevant files.

- Cleanup of the object ownership semantics
	The ownership semantics for all repository subparts (index, odb,
	config files, etc) has been redesigned. All these objects are now
	reference counted, and can be hot-swapped in the middle of
	execution, allowing for instance to add a working directory and an
	index to a repository that was previously opened as bare, or to
	change the source of the ODB objects after initialization.

	Consequently, the repository API has been simplified to remove all
	the `_openX` calls that allowed setting these subparts *before*
	initialization.

- git_index_read_tree()
	Git trees can now be read into the index.

- More reflog functionality
	The reference log has been optimized, and new API calls to rename
	and delete the logs for a reference have been added.

- Rewrite of the References code with explicit ownership semantics
	The references code has been mostly rewritten to take into account
	the cases where another Git application was modifying a repository's
	references while the Library was running.

	References are now explicitly loaded and free'd by the user, and
	they may be reloaded in the middle of execution if the user suspects
	that their values may have changed on disk. Despite the new
	ownership semantics, the references API stays the same.

- Simplified the Remotes API
	Some of the more complex Remote calls have been refactored into
	higher level ones, to facilitate the usual `fetch` workflow of a
	repository.

- Greatly improved thread-safety
	The library no longer has race conditions when loading objects from
	the same ODB and different threads at the same time. There's now
	full TLS support, even for error codes. When the library is built
	with `THREADSAFE=1`, the threading support must be globally
	initialized before it can be used (see `git_threads_init()`)

- Tree walking API
	A new API can recursively traverse trees and subtrees issuing callbacks for
	every single entry.

- Tree diff API
	There is basic support for diff'ing an index against two trees.

- Improved windows support
	The Library is now codepage aware under Windows32: new API calls
	allow the user to set the default codepage for the OS in order to
	avoid strange Unicode errors.
2012-02-05 17:14:14 +01:00
Vicent Martí
199b7d940d Merge pull request #551 from schu/treebuilder-entries
treebuilder: remove needless variable entry_count
2012-02-05 07:42:06 -08:00