summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in general.cCrayon2021-07-281-1/+1
|
* Remove duplicate line, in example codepunkymaniac2021-03-171-5/+0
|
* Fix some typosAaron Franke2021-02-153-4/+4
|
* revspec: rename git_revparse_mode_t to git_revspec_tethomson/revparseEdward Thomson2021-01-314-8/+8
| | | | | | The information about the type of a revision spec is not information about the parser. Name it accordingly, so that `git_revparse_mode_t` is now `git_revspec_t`. Deprecate the old name.
* examples: log: fix documentation generationPatrick Steinhardt2020-06-081-9/+18
| | | | | | Docurium seems to be confused by our use of `/** comment */;` use in the log example. Let's just switch it around to help Docurium get this right.
* strarray: we should `dispose` instead of `free`Edward Thomson2020-06-014-5/+5
| | | | | | We _dispose_ the contents of objects; we _free_ objects (and their contents). Update `git_strarray_free` to be `git_strarray_dispose`. `git_strarray_free` remains as a deprecated proxy function.
* examples: additions and fixesPeter Salomonsen2020-04-025-1/+147
| | | | | | add example for git commit fix example for git add add example for git push
* credential: change git_cred to git_credentialethomson/credtypeEdward Thomson2020-01-262-8/+8
| | | | | | | | | | | | | | | | 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.
* Merge pull request #5283 from pks-t/pks/example-checkout-remote-branchPatrick Steinhardt2019-12-131-5/+78
|\ | | | | examples: checkout: implement guess heuristic for remote branches
| * examples: checkout: implement guess heuristic for remote branchesPatrick Steinhardt2019-10-251-5/+78
| |
* | Merge pull request #5272 from tiennou/examples/cli-ificationPatrick Steinhardt2019-11-2822-444/+521
|\ \ | | | | | | Various examples shape-ups
| * | examples: buff up rev-list by adding OID supportEtienne Samson2019-11-061-22/+58
| | | | | | | | | | | | This allows the example to be used as a quick revwalk test harness.
| * | examples: normalize decls and usage of options structsEtienne Samson2019-11-0612-89/+86
| | |
| * | examples: add comments to add.cEtienne Samson2019-11-061-0/+2
| | |
| * | examples: modernize add codeEtienne Samson2019-11-061-45/+49
| | |
| * | examples: extract argument conversion helperEtienne Samson2019-11-062-0/+19
| | |
| * | examples: fixup for-each-ref styleEtienne Samson2019-11-061-33/+33
| | |
| * | examples: keep track of whether we processed a "--" argEtienne Samson2019-11-065-10/+23
| | |
| * | examples: move "args" to its own headerEtienne Samson2019-11-064-239/+251
| | |
| * | examples: remove duplicate includes from common.cEtienne Samson2019-11-061-9/+1
| | |
| * | global: DRY includes of assert.hEtienne Samson2019-11-066-6/+4
| | |
| * | examples: add missing include barriersEtienne Samson2019-11-061-0/+4
| | |
| * | examples: add *.h files to IDEsEtienne Samson2019-11-061-1/+1
| |/
* | example: use `git_object_size_t` for object sizeEdward Thomson2019-11-221-1/+1
|/
* Merge pull request #5113 from pks-t/pks/stash-perfEdward Thomson2019-08-113-0/+159
|\ | | | | stash: avoid recomputing tree when committing worktree
| * examples: implement git-stash examplePatrick Steinhardt2019-07-203-0/+159
| | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #5146 from scottfurry/StaticFixesExamplesPatrick Steinhardt2019-08-023-8/+8
|\ \ | | | | | | Adjust printf specifiers in examples code
| * | Adjust printf specifiers in examples codeScott Furry2019-08-013-8/+8
| | | | | | | | | | | | | | | | | | | | | Static analysis of example code found multiple findings of `printf` usage where filling value is members of git_indexer_progress object. Specifier used was for signed int but git_indexer_progress members are typed as unsigned ints. `printf` specifiers were altered to match type.
* | | Merge pull request #5184 from novalis/fix-examplePatrick Steinhardt2019-08-011-1/+1
|\ \ \ | |/ / |/| | Fix example checkout to forbid rather than require --
| * | Fix example checkout to forbid rather than require --David Turner2019-07-241-1/+1
| |/ | | | | | | | | | | Make the example program for checkout follow git syntax, where "--" indicates a file. This was likely just a strcmp return value confusion.
* | Merge pull request #5125 from albfan/wip/albfan/diff_buffersPatrick Steinhardt2019-08-017-61/+147
|\ \ | |/ |/| Compare buffers in diff example
| * examples: consolidate includes into "common.h"Patrick Steinhardt2019-07-055-26/+18
| | | | | | | | | | Consolidate all standard includes and defines into "common.h". This lets us avoid having to handle platform-specific things in multiple places.
| * Compare buffers in diff exampleAlberto Fanjul2019-07-053-35/+129
| |
* | examples: implement config examplePatrick Steinhardt2019-07-113-0/+64
|/ | | | | Implement a new example that resembles git-config(1). Right now, this example can both read and set configuration keys, only.
* Merge pull request #5143 from libgit2/ethomson/warningsPatrick Steinhardt2019-07-057-11/+11
|\ | | | | ci: build with ENABLE_WERROR on Windows
| * examples: avoid warning when iterating over index entriesPatrick Steinhardt2019-07-052-2/+2
| | | | | | | | | | | | | | | | When iterating over index entries, we store the indices in an unsigned int. As the index entrycount is a `size_t` though, this may be a loss of precision which a compiler might rightfully complain about. Use `size_t` instead to fix any warnings.
| * examples: avoid conversion warnings when calculating progressPatrick Steinhardt2019-07-051-3/+3
| | | | | | | | | | | | | | | | | | | | When computing the progress, we perform some arithmetics that are implicitly converting from `size_t` to `int`. In one case we're calclulating a percentage, so we know that it should always be in the range of [0,100] and thus we're fine. In the other case we convert from bytes to kilobytes -- this should be stored in a `size_t` to avoid loss of precision, even though it probably won't matter due to limited download rates.
| * examples: avoid passing signed integer to `memchr`Patrick Steinhardt2019-07-051-1/+1
| | | | | | | | | | | | | | The memchr(3P) function expects a `size_t` as its last parameter, but we do pass it an object size, which is of signed type `git_off_t`. As we can be sure that the result will be non-negative, let's just cast the parameter to a `size_t`.
| * examples: cast away constness for reallocating head arraysPatrick Steinhardt2019-07-052-2/+2
| | | | | | | | | | | | | | | | | | When reallocating commit arrays in `opts_add_commit` and `opts_add_refish`, respectively, we simply pass the const pointer to `xrealloc`. As `xrealloc` expects a non-const pointer, though, this will generate a warning with some compilers. Cast away the constness to silence compilers.
| * examples: ssize_t is signed, not unsignedEdward Thomson2019-06-251-1/+1
| |
| * examples: cast away const-nessEdward Thomson2019-06-251-2/+2
| |
| * examples: don't lose `const`Edward Thomson2019-06-251-1/+1
| |
| * example: use `git_off_t` for the object sizeEdward Thomson2019-06-251-1/+1
| |
* | Resolve static check warnings in example codeScott Furry2019-06-272-1/+2
|/ | | | | | | | | | | | Using cppcheck on libgit2 sources indicated two warnings in example code. merge.c was reported as having a memory leak. Fix applied was to `free()` memory pointed to by `parents`. init.c was reported as having a null pointer dereference on variable arg. Function 'usage' was being called with a null variable. Changed supplied parameter to empty string.
* oid: `is_zero` instead of `iszero`Edward Thomson2019-06-162-3/+3
| | | | | | The only function that is named `issomething` (without underscore) was `git_oid_iszero`. Rename it to `git_oid_is_zero` for consistency with the rest of the library.
* Rename opt init functions to `options_init`Edward Thomson2019-06-141-3/+3
| | | | | | | | | | | | | In libgit2 nomenclature, when we need to verb a direct object, we name a function `git_directobject_verb`. Thus, if we need to init an options structure named `git_foo_options`, then the name of the function that does that should be `git_foo_options_init`. The previous names of `git_foo_init_options` is close - it _sounds_ as if it's initializing the options of a `foo`, but in fact `git_foo_options` is its own noun that should be respected. Deprecate the old names; they'll now call directly to the new ones.
* examples: use username provided via URLPatrick Steinhardt2019-04-161-8/+9
| | | | | | | | 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.
* examples: implement SSH key credentialsPatrick Steinhardt2019-04-161-8/+8
| | | | | Implement SSH key credentials. This allows users to use the SSH transport with the lg2 example code.
* examples: implement SSH key credentialsPatrick Steinhardt2019-04-161-2/+18
| | | | | Implement SSH key credentials. This allows users to use the SSH transport with the lg2 example code.
* examples: support plain username credentialsPatrick Steinhardt2019-04-161-0/+5
| | | | | | | 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.