Commit Graph

52 Commits

Author SHA1 Message Date
Carlos Martín Nieto
97c0a85fc6 Merge pull request #3306 from libgit2/cmn/fetch-ex-fetch
examples: modernise the fetch example
2015-07-13 11:23:07 +02:00
Matthew Plough
768f8be31c Fix #3094 - improve use of portable size_t/ssize_t format specifiers.
The header src/cc-compat.h defines portable format specifiers PRIuZ, PRIdZ, and PRIxZ. The original report highlighted the need to use these specifiers in examples/network/fetch.c.  For this commit, I checked all C source and header files not in deps/ and transitioned to the appropriate format specifier where appropriate.
2015-07-12 19:55:19 +02:00
Carlos Martín Nieto
6c7e86e158 examples: modernise the fetch example
Under normal conditions, git_remote_fetch() should be the only function
used to perform a fetch. Don't let the example lead people astray.
2015-07-12 19:41:01 +02:00
Carlos Martín Nieto
ae5b93629c remote: remove fetch parameter from create_anonymous
An anonymous remote is not configured and cannot therefore have
configured refspecs. Remove the parameter which adds this from the
constructor.
2015-05-28 15:32:20 +02:00
Carlos Martín Nieto
3fec548a98 examples: adjust to the new remote API 2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
659cf2029f Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.

In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
209425ce26 remote: rename _load() to _lookup()
This brings it in line with the rest of the lookup functions.
2014-11-08 13:28:27 +01:00
Carlos Martín Nieto
3f89420523 remote: allow overriding the refspecs for download and fetch
With opportunistic ref updates, git has introduced the concept of having
base refspecs *and* refspecs that are active for a particular fetch.

Let's start by letting the user override the refspecs for download.
2014-09-30 15:42:32 +02:00
Linquize
2c22193ba0 Fix typo 2014-09-16 08:56:33 +08:00
Jacques Germishuys
48e60ae75e Don't redefine the same callback types, their signatures may change 2014-04-21 11:28:49 +02:00
Carlos Martín Nieto
fd536d29c1 remote: rename inmemory to anonymous and swap url and fetch order
The order in this function is the opposite to what
create_with_fetchspec() has, so change this one, as url-then-refspec is
what git does.

As we need to break compilation and the swap doesn't do that, let's take
this opportunity to rename in-memory remotes to anonymous as that's
really what sets them apart.
2014-04-01 13:38:04 +02:00
Ben Straub
5c8be32559 Fix a few references to changed function signatures 2014-02-05 13:32:45 -08:00
Ben Straub
ea8ce3d17e Fix warnings 2013-11-04 15:50:33 -08:00
Ben Straub
4f62d55968 Fix typos 2013-11-01 05:39:21 -07:00
Carlos Martín Nieto
c44820c616 A few formatting changes for rocco
I'm not too happy about manually inserting < and > but those get
output as html tags otherwise.
2013-11-01 09:08:22 +01:00
Vicent Martí
5c50f22a93 Merge pull request #1891 from libgit2/cmn/fix-thin-packs
Add support for thin packs
2013-10-28 09:25:44 -07:00
Carlos Martín Nieto
ab46b1d8eb indexer: include the delta stats
The user is unable to derive the number of deltas in the pack, as that
would require them to capture the stats exactly in the moment between
download and final processing, which is abstracted away in the fetch.

Capture these numbers for the user and expose them in the progress
struct. The clone and fetch examples now also present this information
to the user.
2013-10-23 15:08:18 +02:00
Carlos Martín Nieto
ebbd48f00e examples: show used local objects in fetch
Show how many local objects were used to fix the thin pack in our fetch
example.
2013-10-23 14:22:44 +02:00
Carlos Martín Nieto
e3c131c544 remote: move the credentials callback to the struct
Move this one as well, letting us have a single way of setting the
callbacks for the remote, and removing fields from the clone options.
2013-10-02 06:41:42 +02:00
Carlos Martín Nieto
d31402a3fc remote: put the _download() callback with the others
The text progress and update_tips callbacks are already part of the
struct, which was meant to unify the callback setup, but the download
one was left out.
2013-10-02 06:41:42 +02:00
Krzysztof Adamski
255836ddac Adding credentials callback to ls-remote and fetch too. 2013-09-01 19:00:16 +02:00
Russell Belfer
9da187e83d Fix clang warnings and improve checks 2013-04-09 11:40:00 -07:00
Edward Thomson
c27e211219 update examples to work on windows 2013-01-23 17:38:00 -06: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
Ben Straub
0642c1431e Move url to last place in parameter list 2013-01-02 12:44:47 -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
9267ff586f Deploy GIT_REMOTE_CALLBACKS_INIT 2012-11-30 13:12:15 -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
Russell Belfer
0f3def715d Fix various cross-platform build issues
This fixes a number of warnings and problems with cross-platform
builds.  Among other things, it's not safe to name a member of a
structure "strcmp" because that may be #defined.
2012-11-09 13:52:07 -08:00
Ben Straub
1e3b8ed5cf Remove 'bytes' param from git_remote_download 2012-10-24 14:07:07 -07:00
Ben Straub
9762ad993d Renaming: fix example 2012-10-24 13:43:23 -07:00
Ben Straub
7d222e1312 Network progress: rename things
git_indexer_stats and friends -> git_transfer_progress*

Also made git_transfer_progress members more sanely
named.
2012-10-24 13:29:14 -07:00
Ben Straub
7635a1188a Fix example compilation 2012-10-19 19:36:22 -07:00
Ben Straub
d57c47dc07 Add accessor for git_remote's stats field
Also converted the network example to use it.
2012-10-19 19:34:15 -07:00
Carlos Martín Nieto
0a1db746fb examples: add progress output to fetch 2012-08-24 20:29:45 +02:00
Carlos Martín Nieto
bffa852f89 indexer: recognize and mark when all of the packfile has been downloaded
We can't always rely on the network telling us when the download is
finished. Recognize it from the indexer itself.
2012-08-24 19:01:10 +02:00
Carlos Martín Nieto
ae789622e4 examples: fix warnings in network/ 2012-07-30 20:28:16 +02:00
Carlos Martín Nieto
64d01de8a7 remote: start moving the protocol to a common area
For the transition, http is going to keep its own logic until the
git/common code catches up with the implied multi_ack that http
has. This also has the side-effect of making the code cleaner and more
correct regardingt he protocol.
2012-07-30 20:25:10 +02:00
Carlos Martín Nieto
b3aaa7a7c8 Add a struct for network callbacks
Currently only update_tips is used, but it prepares the way for
progress output during download.
2012-07-21 18:44:01 +02:00
Chris Young
a8df98c6fb Updates from comments on OS4 compatibility pull request http://github.com/libgit2/libgit2/pull/766 2012-06-14 18:57:24 +01:00
Chris Young
5c0fd7b976 allow disabling pthreads for testing 2012-06-09 13:20:07 +01:00
Carlos Martín Nieto
7eeec8f22d examples/network: consistently use tabs for indentation 2012-05-24 16:41:53 +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
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
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
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