Commit Graph

108 Commits

Author SHA1 Message Date
Matt Burke
5d7cd57f99 Update another call to git_remote_connect 2015-09-08 14:15:29 -04:00
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
Edward Thomson
d202bb7d3b examples: clean up some warnings 2015-06-29 21:48:35 +00: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
cf66c4748c examples: show the sideband progress on clone
This lets us see what the server (or libgit2 locally) is doing, rather
than having to stare at a non-moving screen.
2015-05-13 15:52:12 +02:00
Carlos Martín Nieto
3fec548a98 examples: adjust to the new remote API 2015-05-13 09:46:36 +02:00
Tomas Paladin Volf
785990bead
Restructured to be nicer example
Code restructured to better represent best practice when
using libgit2.
2015-05-02 12:16:22 +02:00
Tomas Paladin Volf
9bff15f4a4 Added call to git_libgit2_shutdown()
Added forgotten call to git_libgit2_shutdown() to the /examples/network/git2.c.
2015-04-30 15:10:28 +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
Edward Thomson
14fec0aea3 example: drop SAFE_CREATE from clone example 2015-02-27 13:50:40 -05:00
Edward Thomson
9af3c4169c clone example: don't divide by zero
Local transports don't have data about the size, avoid dividing by
zero in the callback.
2015-01-10 18:24:27 +00:00
Carlos Martín Nieto
799e22ea0c Rename git_threads_ to git_libgit2_
This describes their purpose better, as we now initialize ssl and some
other global stuff in there. Calling the init function is not something
which has been optional for a while now.
2014-11-08 23:46:39 +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
6affd71f33 git_checkout_opts -> git_checkout_options 2014-03-06 09:44:51 -08:00
Miha
300f44125a - BUGFIX #2133 (@fourplusone) in smart_protocol.c
- added MSVC cmake definitions to disable warnings
- general.c is rewritten so it is ansi-c compatible and compiles ok on microsoft windows
- some MSVC reported warning fixes
2014-02-25 11:56:11 +01:00
Ben Straub
5c8be32559 Fix a few references to changed function signatures 2014-02-05 13:32:45 -08:00
Vicent Martí
6414fd338d Merge pull request #1956 from libgit2/cmn/fetch-default-head
Remote revamp (director's cut)
2013-11-11 06:47:15 -08:00
Carlos Martín Nieto
359dce726d remote: make _ls return the list directly
The callback-based method of listing remote references dates back to the
beginning of the network code's lifetime, when we didn't know any
better.

We need to keep the list around for update_tips() after disconnect() so
let's make use of this to simply give the user a pointer to the array so
they can write straightforward code instead of having to go through a
callback.
2013-11-11 15:35:51 +01:00
Edward Thomson
ad62f2eedc update example to new packfile creation signature 2013-11-07 12:00:43 -06:00
Ben Straub
ea8ce3d17e Fix warnings 2013-11-04 15:50:33 -08:00
Vicent Martí
567649f2ad Merge pull request #1916 from libgit2/simplify-examples
Fix examples to make the important stuff more obvious
2013-11-01 09:38:34 -07: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
Carlos Martín Nieto
a6154f2183 indexer: remove the stream infix
It was there to keep it apart from the one which read in from a file on
disk. This other indexer does not exist anymore, so there is no need for
anything other than git_indexer to refer to it.

While here, rename _add() function to _append() and _finalize() to
_commit(). The former change is cosmetic, while the latter avoids
talking about "finalizing", which OO languages use to mean something
completely different.
2013-10-30 15:00:05 +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
0b33fca03e indexer: fix thin packs
When given an ODB from which to read objects, the indexer will attempt
to inject the missing bases at the end of the pack and update the
header and trailer to reflect the new contents.
2013-10-04 15:26:41 +02:00
Carlos Martín Nieto
0e0cf78773 clone: put the callbacks struct directly in the clone options
There's no need for this to be a pointer to somewhere else.
2013-10-02 14:04: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
Krzysztof Adamski
d6d523486c Removing unneeded code duplication in ls-remote.c 2013-09-01 19:00:16 +02:00
Carlos Martín Nieto
6c1b6b7abc examples: init the threading system 2013-04-23 16:21:47 +02:00
Russell Belfer
9da187e83d Fix clang warnings and improve checks 2013-04-09 11:40:00 -07:00
lionel vitte
e2886f1e7e Fix link issue in network examples 2013-03-20 21:13:43 +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
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
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
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
Ben Straub
3de2256708 Fix warnings in example 2012-12-27 11:12:14 -08:00