Commit Graph

39 Commits

Author SHA1 Message Date
Vicent Martí
904b67e69f errors: Rename error codes 2012-05-18 01:48:50 +02:00
Vicent Martí
e172cf082e errors: Rename the generic return codes 2012-05-18 01:26:26 +02:00
Russell Belfer
706a9974a2 Basic setup for profiling
This fixes the examples so they will build and adds a PROFILE
option to the CMakeFile that enabled gprof info on non-Windows
2012-05-17 13:05:17 -07:00
Carlos Martín Nieto
41178b419a examples: fix an oopsie 2012-05-11 21:49:33 +02:00
Carlos Martín Nieto
fb49bdf9c7 examples: update network examples error handling
Use giterr_last() and make sure it's not NULL.
2012-05-10 16:52:12 +02:00
Carlos Martín Nieto
baaa8a447e remotes: change git_remote_new's signature
Add a fetch refspec arguemnt and make the arguments (name, url,
refspec), as that order makes more sense.
2012-05-08 21:36:40 +02: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
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
Carlos Martín Nieto
f184836bd2 remote: run a callback when updating the branch tips
This allows the caller to update an internal structure or update the
user output with the tips that were updated.

While in the area, only try to update the ref if the value is
different from its old one.
2012-04-25 13:25:45 +02:00
Carlos Martín Nieto
bf4ef0c567 examples: run fetch in a background thread
This allows us to give updates on how it's doing
2012-04-25 12:44:52 +02:00
Carlos Martín Nieto
db0f96a6af examples: port 'fetch' to the new API 2012-04-25 12:39:17 +02:00
Carlos Martín Nieto
907ebe8556 examples: stream indexer example 2012-04-13 22:19:45 +02:00
Carlos Martín Nieto
fc1cc2051e Use new error handling in the example network code 2012-04-11 19:16:10 +02:00
schu
288c8a2575 examples/diff: update example code
Signed-off-by: schu <schu-github@schulog.org>
2012-03-13 16:51:16 +01:00
Russell Belfer
74fa4bfae3 Update diff to use iterators
This is a major reorganization of the diff code.  This changes
the diff functions to use the iterators for traversing the
content.  This allowed a lot of code to be simplified.  Also,
this moved the functions relating to outputting a diff into a
new file (diff_output.c).

This includes a number of other changes - adding utility
functions, extending iterators, etc. plus more tests for the
diff code.  This also takes the example diff.c program much
further in terms of emulating git-diff command line options.
2012-03-02 15:49:29 -08:00
Russell Belfer
a2e895be82 Continue implementation of git-diff
* Implemented git_diff_index_to_tree
* Reworked git_diff_options structure to handle more options
* Made most of the options in git_diff_options actually work
* Reorganized code a bit to remove some redundancy
* Added option parsing to examples/diff.c to test most options
2012-03-02 15:49:29 -08:00
Russell Belfer
3a4375901a Clean up diff implementation for review
This fixes several bugs, updates tests and docs, eliminates the
FILE* assumption in favor of printing callbacks for the diff patch
formatter helpers, and adds a "diff" example function that can
perform a diff from the command line.
2012-03-02 15:49:28 -08:00
Carlos Martín Nieto
2866c01685 examples: use git_repository_odb instead of _database 2012-01-13 18:20:13 +01:00
Vicent Marti
d88d4311c7 remote: Cleanup the remotes code
- Hide the remaining transports code
- Drop `git_headarray`, switch to using a callback to list refs. Makes
the code cleaner.
2011-11-28 08:40:40 +01:00
Vicent Marti
45e79e3701 Rename all _close methods
There's no difference between `_free` and `_close` semantics: keep
everything with the same name to avoid confusions.
2011-11-26 08:48:00 +01:00
Brandon Casey
0b142c9cb2 examples/network/.gitignore: ignore 'git2' 2011-11-06 20:07:27 -06:00
Brandon Casey
349532d0b1 examples/network/git2.c: exit with proper status, and avoid segfault
This function should exit after printing usage information if too few
arguments were specified.

Additionally, it should exit with a failure status if the first argument
supplied is not one in the internal command list.
2011-11-06 19:44:29 -06:00
Brandon Casey
983562e475 examples/network/git2.c: add newline to usage message 2011-11-06 19:43:44 -06:00
Brandon Casey
faeebd06e4 examples/network/fetch.c: revert overzealous conversion of free to git__free
Since git__free is not exported (it's actually a macro), it should not be
used in client programs.  Change this call to 'git__free' back to 'free'.
2011-11-06 19:35:35 -06:00
Brandon Casey
54ccc71786 examples/general.c: update for recent API renaming of git_config_get_int
git_config_get_int --> git_config_get_int32
2011-11-05 18:01:32 -05:00
Vicent Marti
3286c408ec global: Properly use git__ memory wrappers
Ensure that all memory related functions (malloc, calloc, strdup, free,
etc) are using their respective `git__` wrappers.
2011-10-28 19:02:36 -07:00
Carlos Martín Nieto
2401262778 examples: add ls-remote, fetch and index-pack examples
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-03 02:32:32 +02:00
David Boyce
784b3b494f Fixed typo in example Makefile code and slimmed it down more.
Reverted signature of git_signature_new.
Removed error check wrappers (voted down). Made Makefile
work out of the box on Linux and Solaris when standard
cmake build instructions for the library are followed.
2011-09-15 23:15:38 -04:00
David Boyce
0251733e01 Changes to allow examples/*.c to compile and link. This required on
change to the signature of an API function (git_signature_new).
Also, the examples/general.c had a lot of unchecked return values
which were addresed with a couple of macros. The resulting example
still does not work correctly but at least now it fails with an
error message rather than not compiling or dumping core. Example
runtime issues may be addressed in a later commit.
2011-09-12 23:39:47 -04:00
David Boyce
9940a01c3f Fixed to build examples with knowledge of include and lib locations. 2011-09-12 23:38:58 -04:00
Kirill A. Shutemov
6f2b0a3ae2 examples/general: fix misc warnings
examples/general.c:393:25: warning: unused variable ‘reftarget’ [-Wunused-variable]
examples/general.c:357:19: warning: unused variable ‘e’ [-Wunused-variable]
examples/general.c:444:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-05 14:20:10 +03:00
Kirill A. Shutemov
d6d877d20f examples/general: fix warnings on not handled reference type in switch
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_INVALID’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_PACKED’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_HAS_PEEL’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_LISTALL’ not handled in switch [-Wswitch]

Signe-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-05 14:20:10 +03:00
Kirill A. Shutemov
51cc50a37d examples/general: fix git_commit_create_v() arguments type
general.c:208: warning: passing argument 7 of 'git_commit_create_v' from incompatible pointer type

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-05 14:20:10 +03:00
Kirill A. Shutemov
932d1baf29 cleanup: remove trailing spaces
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-01 18:02:56 +02:00
Vicent Marti
920e000d38 config: Update examples 2011-06-18 01:17:58 +02:00
Vicent Marti
fa48608ec3 oid: Rename methods
Yeah. Finally. Fuck the old names, this ain't POSIX
and they don't make any sense at all.
2011-06-16 02:36:21 +02:00
Scott Chacon
96da90ae1f update examples content to be compilable and up to date 2011-06-15 09:40:06 -07:00
Scott Chacon
2e6d8ec436 fix the example urls 2011-06-14 16:02:23 -07:00
Scott Chacon
388f37b37b add examples for docs 2011-06-14 14:18:13 -07:00