22 Commits

Author SHA1 Message Date
Edward Thomson
3f54ba8b61 credential: change git_cred to git_credential
We avoid abbreviations where possible; rename git_cred to
git_credential.

In addition, we have standardized on a trailing `_t` for enum types,
instead of using "type" in the name.  So `git_credtype_t` has become
`git_credential_t` and its members have become `GIT_CREDENTIAL` instead
of `GIT_CREDTYPE`.

Finally, the source and header files have been renamed to `credential`
instead of `cred`.

Keep previous name and values as deprecated, and include the new header
files from the previous ones.
2020-01-26 18:39:41 +00:00
Etienne Samson
025a93577d examples: move "args" to its own header 2019-11-06 11:12:34 +01:00
Etienne Samson
745ccc8ab9 examples: remove duplicate includes from common.c 2019-11-06 11:08:26 +01:00
Etienne Samson
cd5e33fbc2 global: DRY includes of assert.h 2019-11-06 11:08:23 +01:00
Alberto Fanjul
3be09b6c02 Compare buffers in diff example 2019-07-05 14:12:04 +02:00
Patrick Steinhardt
172786ec1b examples: use username provided via URL
The credentials callback may be passed a username in case where
the URL already includes the expected username. As we usually
cannot use a different username in such context, we should use
that one if provided and not ask the user for a diferent
username.
2019-04-16 12:03:20 +02:00
Patrick Steinhardt
611fbe4f9b examples: implement SSH key credentials
Implement SSH key credentials. This allows users to use the SSH
transport with the lg2 example code.
2019-04-16 12:02:20 +02:00
Patrick Steinhardt
d9351c6556 examples: implement SSH key credentials
Implement SSH key credentials. This allows users to use the SSH
transport with the lg2 example code.
2019-04-16 11:58:13 +02:00
Patrick Steinhardt
e9aa84799a examples: support plain username credentials
Implement plain username credential types. These type of
credentials might be asked for e.g. as some kind of
pre-authentication step, before the actual credentials are
passed.
2019-04-16 11:56:57 +02:00
Patrick Steinhardt
635ec366d7 examples: honor allowed credential types when prompting user
Credential callback are being passed a bitset that indicates
which credential types are allowed in the current context. In our
examples code, we completely ignore that field and always return
username/password credentials, which doesn't necessarily make
sense e.g. when only SSH keys are allowed.

Refactor the code and only return username/password credentials
in the case where `USERPASS_PLAINTEXT` credentials are allowed.
Otherwise, return a positive error code to indicate that no
credentials could be acquired.
2019-04-16 11:53:39 +02:00
Patrick Steinhardt
7562422ab9 examples: merge common network code
Right now, we have two sets of "common" code, one containing
general common code and one containing network common code. As we
intend to get rid of the network subdirectory and instead merge
all examples into a single standalone executable, this
distinction doesn't make a lot of sense now. Furthermore, the
common network code is not that big.

Let's get rid of the common network code by merging it into the
general common code.
2019-02-15 12:04:14 +01:00
Edward Thomson
fcc7dcb176 errors: remove giterr usage in examples 2019-01-22 22:30:37 +00:00
Edward Thomson
83151018ef object_type: convert final internal users to new names
Update some missed types that were continuing to use the old `GIT_OBJ`
names.
2019-01-17 11:03:19 +00:00
Etienne Samson
5b7ba78630 examples: add a helper for boolean-style options 2018-07-07 14:52:24 +02:00
Etienne Samson
8e063eb66b examples: make the refish resolution work with short OIDs 2018-07-07 13:10:50 +02:00
Etienne Samson
8a629afedc examples: move refish resolution function in common 2018-07-07 13:10:50 +02:00
Etienne Samson
3fa5e5779a examples: Move xrealloc to common example code 2018-01-25 22:11:19 +01:00
Patrick Steinhardt
5c2a8361d7 examples: diff: parse correct types for line-diffopts 2016-10-10 09:04:42 +02:00
Linquize
d6bbcefce3 describe: add example 2014-10-12 19:25:20 +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
6cb831bd56 Replace copyright topmatter in example files 2013-11-02 05:33:26 -07:00
Russell Belfer
66902d4773 Extract common example helpers and reorg examples
This reorganizes a few of the examples so that the main function
comes first with the argument parsing extracted into a helper
that can come at the end of the file (so the example focuses more
on the use of libgit2 instead of command line support).  This also
creates a shared examples/common.[ch] so that useful helper funcs
can be shared across examples instead of repeated.
2013-10-29 18:30:49 -07:00