summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* examples: honor allowed credential types when prompting userPatrick Steinhardt2019-04-161-16/+20
| | | | | | | | | | | | | 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.
* examples: move MSVC compatibility macros into common headerPatrick Steinhardt2019-04-163-9/+5
| | | | | | | 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.
* indexer: use git_indexer_progress throughoutEdward Thomson2019-02-223-6/+6
| | | | | Update internal usage of `git_transfer_progress` to `git_indexer_progreses`.
* examples/add: add explanatory comments and reformatEtienne Samson2019-02-151-23/+37
|
* examples: print available commands if no args are givenPatrick Steinhardt2019-02-151-4/+16
|
* examples: create common lg2 executablePatrick Steinhardt2019-02-1527-294/+173
| | | | | | | | | | | | | | | | | | 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.
* examples: merge common network codePatrick Steinhardt2019-02-1510-150/+109
| | | | | | | | | | | | 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.
* examples: remove unused MakefilePatrick Steinhardt2019-02-151-22/+0
| | | | | This Makefile isn't used anymore and probably won't work anyway. Remove it in favor of the existing CMake build instructions.
* examples: remove test scriptPatrick Steinhardt2019-02-151-95/+0
| | | | | | | | | | In commit 2e2332857 (examples: a test, for rev-list, 2013-03-20), a script was introduced with the intention of testing our rev-list example code. Nobody uses that script, and in fact it doesn't even properly work due to the not-so-recent addition out-of-source builds. Remove the script.
* deprecation: ensure we GIT_EXTERN deprecated funcsEdward Thomson2019-02-141-0/+3
| | | | | | | | | | Although the error functions were deprecated, we did not properly mark them as deprecated. We need to include the `deprecated.h` file in order to ensure that the functions get their export attributes. Similarly, do not define `GIT_DEPRECATE_HARD` within the library, or those functions will also not get their export attributes. Define that only on the tests and examples.
* examples: don't use deprecated typesEdward Thomson2019-01-251-2/+2
|
* errors: remove giterr usage in examplesEdward Thomson2019-01-226-12/+12
|
* Merge pull request #4939 from libgit2/ethomson/git_refEdward Thomson2019-01-192-3/+3
|\ | | | | Move `git_ref_t` to `git_reference_t`
| * references: use new names in internal usageethomson/git_refEdward Thomson2019-01-172-3/+3
| | | | | | | | Update internal usage to use the `git_reference` names for constants.
* | object_type: convert final internal users to new namesethomson/git_objEdward Thomson2019-01-177-13/+13
|/ | | | | Update some missed types that were continuing to use the old `GIT_OBJ` names.
* Merge pull request #4374 from pks-t/pks/pack-file-verifyEdward Thomson2018-08-261-1/+1
|\ | | | | Pack file verification
| * indexer: introduce options struct to `git_indexer_new`Patrick Steinhardt2018-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | We strive to keep an options structure to many functions to be able to extend options in the future without breaking the API. `git_indexer_new` doesn't have one right now, but we want to be able to add an option for enabling strict packfile verification. Add a new `git_indexer_options` structure and adjust callers to use that.
* | Merge pull request #4692 from tiennou/examples/checkoutPatrick Steinhardt2018-07-204-23/+293
|\ \ | | | | | | Add a checkout example
| * | examples: add checkoutEtienne Samson2018-07-171-0/+235
| | |
| * | examples: add a helper for boolean-style optionsEtienne Samson2018-07-072-0/+28
| | |
| * | examples: make the refish resolution work with short OIDsEtienne Samson2018-07-071-3/+4
| | |
| * | examples: move refish resolution function in commonEtienne Samson2018-07-073-23/+29
| |/
* | cmake: enforce C90 standardPatrick Steinhardt2018-07-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | While the aim of libgit2 was to conform to C90 code, we never instructed the compiler to enforce C90 compliance. Thus, quite a few violations were able to get into our code base, which have been removed with the previous commits. As we are now able to build libgit2 with C90 enforced, we can set the C_STANDARD property for our own build targets. Note that we explicitly avoid setting the C standard for our third-party dependencies. At least the zlib target does not build with C90 enforced, and we do not want to fix them by deviating from upstream. Thus we simply enforce no standard for them.
* | cmake: distinguish internal and system include directoriesPatrick Steinhardt2018-07-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While we want to enforce strict C90 mode, this may cause issues with system provided header files which are themselves not strictly conforming. E.g. if a system header has C++ style comments, a compiler in strict C90 mode would produce an error and abort the build. As the user most likely doesn't want to change the system header, this would completely break the build on such systems. One example of this is mbedtls, which provides such header files. The problem can be worked around by distinguishing between system-provided and project-provided include directories. When adding include directories via "-isystem" instead of "-I", the compiler will skip certain checks and print out less warnings. To use system includes, we can simply add the "SYSTEM" flag to CMake's `INCLUDE_DIRECTORIES` and `TARGET_INCLUDE_DIRECTORIES` functions. Note that we have to split the include directories into two variables because of this, as we definitely still want to check for all warnings produced by our own header files.
* | treewide: remove use of C++ style commentsPatrick Steinhardt2018-07-134-13/+17
|/ | | | | | | | | C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-103-3/+3
|
* Merge pull request #4642 from pks-t/pks/cmake-resolve-pkgconfigPatrick Steinhardt2018-05-091-1/+0
|\ | | | | cmake: resolve libraries found by pkg-config
| * cmake: remove now-useless LIBGIT2_LIBDIRS handlingPatrick Steinhardt2018-05-091-1/+0
| | | | | | | | | | | | | | | | | | | | With the recent change of always resolving pkg-config libraries to their full path, we do not have to manage the LIBGIT2_LIBDIRS variable anymore. The only other remaining user of LIBGIT2_LIBDIRS is winhttp, which is a CMake-style library target and can thus be resolved by CMake automatically. Remove the variable to simplify our build system a bit.
* | tests: ls-files: use puts instead of printf and fix typosCarson Howard2018-05-021-4/+4
| |
* | examples: ls-files: print entry path only when entry is foundCarson Howard2018-03-271-5/+4
| |
* | examples: ls-files: update print_paths to print all casesCarson Howard2018-03-271-19/+17
| |
* | test: ls-files: remove dependency on git_arrayCarson Howard2018-03-271-11/+12
| |
* | examples: ls-files: fix build errorCarson Howard2018-03-271-1/+1
| |
* | examples: ls-files: address PR and styleCarson Howard2018-03-271-24/+14
| |
* | examples: ls-files: use git_array_t to handle filesCarson Howard2018-03-271-11/+11
| |
* | examples: ls-files: build file list with arrayCarson Howard2018-03-271-9/+9
| |
* | examples: ls-files: fix compile errorCarson Howard2018-03-271-3/+7
| |
* | examples: ls-files: fix style and refactorCarson Howard2018-03-271-70/+65
| |
* | examples: ls-files: handle --error-unmatchCarson Howard2018-03-271-15/+42
| |
* | examples: ls-files: show current files in indexCarson Howard2018-03-271-20/+109
| |
* | examples: ls-files: list filesCarson Howard2018-03-271-0/+37
|/
* examples: zero out our options memory before useEtienne Samson2018-01-251-0/+2
|
* examples: our/their can be NULLEtienne Samson2018-01-251-2/+4
|
* examples: fix remaining review commentsEtienne Samson2018-01-251-0/+2
|
* examples: move support code into static functionsEtienne Samson2018-01-251-81/+97
|
* examples: hoist the merge analysis back into mainEtienne Samson2018-01-251-58/+39
|