23 Commits

Author SHA1 Message Date
apnadkarni
77ef1a6e14 Update common.h 2022-02-13 14:11:46 +05:30
Aaron Franke
7efddeb737 Fix some typos 2021-02-15 16:01:25 -05:00
Peter Salomonsen
dc2beb7e2d examples: additions and fixes
add example for git commit
fix example for git add
add example for git push
2020-04-02 18:39:37 +02:00
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
cd5e33fbc2 global: DRY includes of assert.h 2019-11-06 11:08:23 +01:00
Etienne Samson
882220bf11 examples: add missing include barriers 2019-11-06 11:08:19 +01:00
Edward Thomson
5774b2b134 Merge pull request #5113 from pks-t/pks/stash-perf
stash: avoid recomputing tree when committing worktree
2019-08-11 23:42:45 +01:00
Patrick Steinhardt
56e7aaf044 Merge pull request #5125 from albfan/wip/albfan/diff_buffers
Compare buffers in diff example
2019-08-01 12:40:51 +02:00
Patrick Steinhardt
88731e3c33 examples: implement git-stash example
Implement a new example that resembles the git-stash(1) command.
Right now, it only provides the apply, list, save and pop
subcommands without any options.

This example is mostly used to test libgit2's stashing
performance on big repositories.
2019-07-20 19:10:57 +02:00
Patrick Steinhardt
8ee3d39afd examples: implement config example
Implement a new example that resembles git-config(1). Right now,
this example can both read and set configuration keys, only.
2019-07-11 08:28:55 +02:00
Patrick Steinhardt
960d2a070f examples: consolidate includes into "common.h"
Consolidate all standard includes and defines into "common.h". This lets
us avoid having to handle platform-specific things in multiple places.
2019-07-05 14:30:48 +02:00
Alberto Fanjul
3be09b6c02 Compare buffers in diff example 2019-07-05 14:12:04 +02:00
Patrick Steinhardt
b106620d03 examples: move MSVC compatibility macros into common header
We currently have two locations in our examples where we define
the same compatibility wrappers for MSVC. Move them into
"common.h" to avoid duplication and make them available to other
examples.
2019-04-16 11:52:30 +02:00
Patrick Steinhardt
ead10785dc examples: create common lg2 executable
Inside of our networking example code, we have a git2 executable
that acts as an entry point to all the different network
examples. As such, it is kind of the same like the normal git(1)
executable in that it simply arbitrates to the respective
subcommands.

Let's extend this approach and merge all examples into a single
standalone lg2 executable. Instead of building an executable
for all the existing examples we have, we now bundle them all
inside of the lg2 one and let them be callable via subcommands.

In the process, we can get rid of duplicated library
initialization, deinitialization and repository discovery code.
Instead of having each subcommand handle these on its own, we
simply do it inside of the single main function now.
2019-02-15 12:06:54 +01: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
Etienne Samson
5b7ba78630 examples: add a helper for boolean-style options 2018-07-07 14:52:24 +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
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