Commit Graph

126 Commits

Author SHA1 Message Date
Carlos Martín Nieto
6c1b6b7abc examples: init the threading system 2013-04-23 16:21:47 +02:00
Vicent Marti
32ef1d1c7c Fix examples 2013-04-16 00:17:40 +02:00
Vicent Marti
d064c74794 Merge remote-tracking branch 'ben/unified-revparse' into development 2013-04-15 23:18:24 +02:00
Ben Straub
201566539f Clean up minor details 2013-04-15 13:29:40 -07:00
Ben Straub
5961d5ea7f Clean up example code. 2013-04-15 12:10:18 -07:00
Ben Straub
299a224be1 Change git_revparse to output git_object pointers
This will probably prevent many lookup/free
operations in calling code.
2013-04-15 12:00:04 -07:00
Vicent Marti
0d3ccf0b28 examples: Don't print weird characters 2013-04-10 16:41:05 +02:00
Russell Belfer
9da187e83d Fix clang warnings and improve checks 2013-04-09 11:40:00 -07:00
Ben Straub
ec7e240ba4 Add rev-list example to makefiles 2013-04-09 05:07:12 +04:00
Ben Straub
1aa21fe3b8 Deprecate git_revparse_single and _rangelike 2013-04-09 05:07:04 +04:00
Vicent Marti
d9ecaf8c6f Merge remote-tracking branch 'gnprice/revwalk' into development 2013-04-07 07:22:38 +02:00
Greg Price
2e2332857d examples: a test, for rev-list
This test file could probably be improved by a framework like
the one in git.git:t/, or by using a language like Python instead
of shell.

The other examples would benefit from tests too.  Probably best
to settle on a framework to write them in, then add more tests.

Signed-off-by: Greg Price <price@mit.edu>
2013-04-06 20:51:16 -07:00
Greg Price
8f7f5e5543 examples: rev-list
This demonstrates parts of the interface for specifying revisions that
Git users are familiar with from 'git rev-list', 'git log', and other
Git commands.  A similar query interface is used in out-of-core
command-line programs that browse a Git repo (like 'tig'), and may be
useful for an 'advanced search' interface in GUI or web applications.

In this version, we parse all the query modifiers we can support with
the existing logic in revwalk: basic include/exclude commits, and the
ordering flags.  More logic will be required to support '--grep',
'--author', the pickaxe '-S', etc.

Signed-off-by: Greg Price <price@mit.edu>
2013-04-06 20:51:16 -07:00
Ben Straub
f8591e519a General example: run against testrepo.git
Fixes #1455
2013-04-04 11:44:50 -07:00
lionel vitte
e2886f1e7e Fix link issue in network examples 2013-03-20 21:13:43 +08:00
Russell Belfer
7bd53bf385 Simplify diff example using revparse
When the examples/diff.c was written, there was not yet a revparse
API.  Now we can use it to make command line parsing way better
with less code.  Yay!
2013-03-02 13:52:38 -08:00
Martin Woodward
5c46937b3a Give props to Martin Pool
Martin Pool was the original author of the code referenced in the clone
example. Make note that he's given his permission and also give him the
proper credit.
2013-02-26 09:00:37 +00:00
Russell Belfer
a7ed746093 Add rudimentary error checks and reformat comments
There were a number of functions assigning their return value to
`error` without much explanation.  I added in some rudimentary
error checking to help flesh out the example.

Also, I reformatted all of the comments down to 80 cols (and in
some cases, slightly updated the wording).
2013-02-15 15:58:13 -08:00
Russell Belfer
9c258af094 Merge pull request #1316 from ben/clone-cancel
Allow network operations to cancel
2013-02-12 10:13:56 -08:00
Carlos Scheidegger
ef41ab880c removed other references to api.html 2013-02-06 17:37:51 -05:00
Ben Straub
fe95ac1b67 Allow progress callback to cancel fetch
This works by having the indexer watch the return
code of the callback, so will only take effect
on object boundaries.
2013-02-05 10:59:58 -08:00
Ben Straub
7602cb7c0e Add user-from-url param to auth callback 2013-01-31 10:44:57 -08:00
Edward Thomson
c27e211219 update examples to work on windows 2013-01-23 17:38:00 -06:00
Sebastian Bauer
75a0a80029 Don't clear the opt instance in the diff example.
The version field is overwritten otherwise. The opt instance is
already initialized properly.
2013-01-23 07:47:40 +01:00
Sebastian Bauer
cea994b902 Don't call pthread_exit() in the callback.
Compilers that are not aware that pthread_exit() does not return
issue a warning when compiling the present code. This change
exchanges the call to pthread_exit() with a simple return
statement. According to the pthread specification this is
equivalent.
2013-01-10 12:39:17 +01:00
Vicent Martí
cd5ca5b97f Merge pull request #1152 from ben/clone-api-structification
Segregate in-memory and persisted remotes
2013-01-02 13:50:41 -08:00
Ben Straub
730df6d0f7 Include checkout options inline 2013-01-02 13:43:54 -08:00
Ben Straub
0642c1431e Move url to last place in parameter list 2013-01-02 12:44:47 -08:00
Russell Belfer
dbc4aa0750 Update showindex example
I find the showindex example to be pretty useful on occasion, but
there were are couple of output tweaks I wanted, plus I wanted the
ability to specify a path to an actual index file instead of having
to open the whole repository.  This makes those changes and expands
the example slightly.
2012-12-28 22:00:24 -08:00
Ben Straub
3de2256708 Fix warnings in example 2012-12-27 11:12:14 -08:00
Ben Straub
69d1bd9125 Fix examples 2012-12-21 15:30:46 -08:00
Ben Straub
29f27599ea Rename remote creation APIs
git_remote_add -> git_remote_create
git_remote_new -> git_remote_create_inmemory
2012-12-20 10:52:57 -08:00
Ben Straub
316bca697f Fix clone sample 2012-12-19 17:07:12 -08:00
Russell Belfer
56c72b759c Fix diff constructor name order confusion
The diff constructor functions had some confusing names, where the
"old" side of the diff was coming after the "new" side.  This
reverses the order in the function name to make it less confusing.

Specifically...

* git_diff_index_to_tree becomes git_diff_tree_to_index
* git_diff_workdir_to_index becomes git_diff_index_to_workdir
* git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
2012-12-17 11:00:53 -08:00
Ben Straub
cc3e9b5af4 Make building samples more friendly 2012-12-16 10:50:10 -08:00
Ben Straub
b9e7e2b4e1 Move non-options back out of options struct 2012-12-14 13:46:45 -08:00
Ben Straub
0015b5875e Deploy git_clone_options to network sample 2012-12-14 13:18:06 -08:00
Ben Straub
2b10a2b0e8 Enable authenticated clones in network sample 2012-12-13 11:47:14 -08:00
Ben Straub
24393ea6d3 Stop premature remote freeing when cloning 2012-12-13 09:14:56 -08:00
Ben Straub
34c8c75433 Fix network example 2012-12-13 08:54:23 -08:00
Ben Straub
9267ff586f Deploy GIT_REMOTE_CALLBACKS_INIT 2012-11-30 13:12:15 -08:00
Ben Straub
2f8d30becb Deploy GIT_DIFF_OPTIONS_INIT 2012-11-30 13:12:14 -08:00
Ben Straub
b81aa2f1de Deploy GIT_CHECKOUT_OPTS_INIT 2012-11-30 13:12:14 -08:00
Ben Straub
df705148ec API updates for remote.h
Includes typedef for git_direction, and renames for
GIT_DIR_[FETCH|PUSH] to GIT_DIRECTION_(\1).
2012-11-27 13:19:49 -08:00
Ben Straub
f45d51ff8e API updates for index.h 2012-11-27 13:18:28 -08:00
Russell Belfer
793c438559 Update diff callback param order
This makes the diff functions that take callbacks both take
the payload parameter after the callback function pointers and
pass the payload as the last argument to the callback function
instead of the first.  This should make them consistent with
other callbacks across the API.
2012-11-27 13:18:28 -08:00
Russell Belfer
e120123e36 API review / update for tree.h 2012-11-27 13:18:28 -08:00
Ben Straub
3f63cc9e6d Examples: fix clone api 2012-11-27 13:18:28 -08:00
Ben Straub
bac695b58c Examples: fix reference names 2012-11-27 13:18:28 -08:00
nulltoken
aa8a76eff9 tag: rename git_tag_type to git_tag_target_type 2012-11-17 05:41:20 -08:00