examples


Log

Author Commit Date CI Message
Patrick Steinhardt ecf4f33a 2018-02-08T11:14:48 Convert usage of `git_buf_free` to new `git_buf_dispose`
Patrick Steinhardt f9cf9a04 2018-05-09T14:51:57 Merge pull request #4642 from pks-t/pks/cmake-resolve-pkgconfig cmake: resolve libraries found by pkg-config
Patrick Steinhardt 8ab470f5 2018-04-27T15:31:43 cmake: remove now-useless LIBGIT2_LIBDIRS handling 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.
Carson Howard 8aa437ef 2018-05-02T07:55:26 tests: ls-files: use puts instead of printf and fix typos
Carson Howard d7394c36 2018-03-27T07:21:02 examples: ls-files: print entry path only when entry is found
Carson Howard 29ca3f33 2018-01-06T11:26:41 examples: ls-files: update print_paths to print all cases
Carson Howard 7d079413 2017-12-19T15:29:40 test: ls-files: remove dependency on git_array
Carson Howard ee144650 2017-11-13T21:03:21 examples: ls-files: fix build error
Carson Howard e8661169 2017-11-13T20:52:31 examples: ls-files: address PR and style
Carson Howard 3f64a9db 2017-10-25T19:19:17 examples: ls-files: use git_array_t to handle files
Carson Howard 37cbc3ea 2017-10-23T09:54:39 examples: ls-files: build file list with array
Carson Howard d2f99e0a 2017-10-22T21:23:40 examples: ls-files: fix compile error
Carson Howard cd39273d 2017-10-22T20:43:22 examples: ls-files: fix style and refactor
Carson Howard 52d83dde 2017-10-17T21:10:54 examples: ls-files: handle --error-unmatch
Carson Howard 991fc088 2017-10-16T21:33:46 examples: ls-files: show current files in index
Carson Howard 30e919c4 2017-10-16T16:46:19 examples: ls-files: list files
Etienne Samson 33f44db9 2018-01-25T22:17:39 examples: zero out our options memory before use
Etienne Samson fb79d7d1 2018-01-17T02:34:32 examples: our/their can be NULL
Etienne Samson cc845595 2018-01-17T02:25:36 examples: fix remaining review comments
Etienne Samson 5ce4f19b 2018-01-17T02:25:36 examples: move support code into static functions
Etienne Samson 503b30d5 2018-01-17T02:25:36 examples: hoist the merge analysis back into main
Etienne Samson 60c6547c 2018-01-17T02:25:36 examples: minor review fixups
Etienne Samson 59ea2c58 2018-01-17T02:25:36 examples: add merge
Etienne Samson bb9353cf 2018-01-17T02:25:36 examples: Dead code & warnings
Etienne Samson 3fa5e577 2018-01-17T02:25:36 examples: Move xrealloc to common example code
Etienne Samson b6720018 2018-01-17T02:25:36 examples: Switch to the nifty argv helpers from common
Patrick Steinhardt bf15dbf6 2017-11-06T12:47:40 examples: network: fix Win32 linking errors due to getline The getline(3) function call is not part of ISO C and, most importantly, it is not implemented on Microsoft Windows platforms. As our networking example code makes use of getline, this breaks builds on MSVC and MinGW. As this code wasn't built prior to the previous commit, this was never noticed. Fix the error by instead implementing a `readline` function, which simply reads the password from stdin until it reads a newline character.
Carlos Martín Nieto 9e3fb594 2017-10-29T15:32:18 Merge pull request #4373 from cjhoward92/examples/log-show-log-size example-log: add support for --log-size
Patrick Steinhardt 9b12eb6f 2017-10-20T15:05:26 examples: remove Makefile Back in the days when libgit2 was still young, libgit2 was using plain Makefiles as build infrastructure. We later changed that to instead use the CMake build system to make cross-platform development easier. In the process, we forgot to remove the Makefile from our examples directory, which is fixed by this commit here. Furthermore, remove the accompanying .gitignore file, which ignores build outputs. As we do out-of-tree builds only nowadays, no output is generated in that directory anymore.
Carson Howard 12a888d5 2017-10-13T07:18:54 examples: log: pass options pointer to print_commit Cleaned up the PR to address styling issues.
Carson Howard 1436b0e1 2017-10-11T21:47:58 example-log: add support for --log-size
Douglas Swanson f4770e47 2017-01-01T09:28:39 Fix Issue #4047 Check return codes and free objects
Patrick Steinhardt 8e31cc25 2017-06-28T12:51:14 cmake: keep track of libraries and includes via lists Later on, we will move detection of required libraries, library directories as well as include directories into a separate CMakeLists.txt file inside of the source directory. Obviously, we want to avoid duplication here regarding these parameters. To prepare for the split, put the parameters into three variables LIBGIT2_LIBS, LIBGIT2_LIBDIRS and LIBGIT2_INCLUDES, tracking the required libraries, linking directory as well as include directories. These variables can later be exported into the parent scope from inside of the source build instructions, making them readily available for the other subdirectories.
Patrick Steinhardt f0ca00e0 2017-05-03T12:25:48 examples: network: refactor credentials callback The credentials callback reads the username and password via scanf into fixed-length arrays. While these are simply examples and as such not as interesting, the unchecked return value of scanf causes GCC to emit warnings. So while we're busy to shut up GCC, we also fix the possible overflow of scanf by using getline instead.
Patrick Steinhardt f9ea8c6a 2017-01-12T22:02:14 examples: general: fix memory leaks
Patrick Steinhardt ed2b1c7e 2017-01-12T22:01:45 examples: general: display config only if it was found
Patrick Steinhardt 5aa10107 2017-01-12T22:01:23 examples: general: narrow down scope of loop variables
Patrick Steinhardt 8572e225 2017-01-12T22:00:53 examples: general: clean up committer/author variables
Force.Charlie-I 3fdba15c 2017-01-09T14:09:57 fix examples/network/clone.c: heap-buffer-overflow Format of a length of string to the correct format is:%.*s
Douglas Swanson 832278bf 2016-12-29T07:43:03 Fix issue #4046 Seg fault in config_files()
Patrick Steinhardt fc293919 2016-08-16T11:43:10 examples: add: fix type casting warning
Patrick Steinhardt 5c2a8361 2016-08-16T11:01:09 examples: diff: parse correct types for line-diffopts
Patrick Steinhardt 7314da10 2016-08-16T10:55:28 examples: fix warnings in network/fetch.c
Patrick Steinhardt e2d1b7ec 2016-08-16T10:46:35 examples: general: fix remaining warnings
Patrick Steinhardt 662eee15 2016-08-16T10:09:52 examples: general: convert C99 comments to C90 comments
Patrick Steinhardt c313e3d9 2016-09-01T12:44:08 examples: general: extract function demonstrating OID parsing
Patrick Steinhardt 29d9afc0 2016-08-16T10:06:17 examples: general: extract function demonstrating ODB
Patrick Steinhardt b009adad 2016-08-16T09:59:28 examples: general: extract function demonstrating commit writing
Patrick Steinhardt 15960454 2016-08-16T09:36:31 examples: general: extract functions demonstrating object parsing
Patrick Steinhardt 8b93ccdf 2016-08-16T09:35:08 examples: general: extract function demonstrating revwalking
Patrick Steinhardt c079e3c8 2016-08-16T09:32:15 examples: general: extract function demonstrating index walking
Patrick Steinhardt f9a7973d 2016-08-16T09:29:14 examples: general: extract function demonstrating reference listings
Patrick Steinhardt 986913f4 2016-08-16T09:25:06 examples: general: extract function demonstrating config files
Patrick Steinhardt 176d58ba 2016-08-16T09:17:12 examples: general: use tabs instead of spaces
Carlos Martín Nieto 07bd3e57 2015-05-07T12:57:56 proxy: ask the user for credentials if necessary
Patrick McKenna 698e0c27 2016-03-07T16:34:30 Update link to Pro Git's Git internals chapter.
Eun 8b8f1f91 2015-10-07T14:01:05 fix return
Matt Burke 5d7cd57f 2015-09-08T14:15:29 Update another call to git_remote_connect
Carlos Martín Nieto 97c0a85f 2015-07-13T11:23:07 Merge pull request #3306 from libgit2/cmn/fetch-ex-fetch examples: modernise the fetch example
Matthew Plough 768f8be3 2015-06-30T19:00:41 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.
Carlos Martín Nieto 6c7e86e1 2015-07-12T19:41:01 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.
Edward Thomson d202bb7d 2015-06-29T21:48:35 examples: clean up some warnings
Carlos Martín Nieto c2418f46 2015-06-25T12:48:44 Rename FALLBACK to UNSPECIFIED Fallback describes the mechanism, while unspecified explains what the user is thinking.
Carlos Martín Nieto 7d6dacdc 2015-05-09T10:42:00 examples: adjust to submodule status API change
Ariel O. Barria 9334c86f 2015-06-03T14:54:26 print_usage functions is defined but not used Use the previously created function to display a message when the arguments are not valid. ticket 3095
Carlos Martín Nieto ae5b9362 2015-05-17T15:11:45 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.
Carlos Martín Nieto cf66c474 2015-05-06T12:26:05 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.
Carlos Martín Nieto 3fec548a 2015-04-23T06:01:13 examples: adjust to the new remote API
Tomas Paladin Volf 785990be 2015-05-02T12:16:22 Restructured to be nicer example Code restructured to better represent best practice when using libgit2.
Tomas Paladin Volf 9bff15f4 2015-04-30T15:10:28 Added call to git_libgit2_shutdown() Added forgotten call to git_libgit2_shutdown() to the /examples/network/git2.c.
Patrick Steinhardt c843736d 2015-04-07T14:43:04 describe example: enable building by default.
Patrick Steinhardt 0a2f99fd 2015-01-26T15:36:34 examples: add remote example.
Edward Thomson 72ca65d5 2015-03-03T10:07:36 Merge pull request #2808 from libgit2/cmn/repo-ident Remove the signature from ref-modifying functions
Carlos Martín Nieto 659cf202 2015-01-07T12:23:05 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.
Carlos Martín Nieto fe477951 2015-03-03T14:35:10 Merge pull request #2885 from JIghtuse/master describe example: function to add commits to opts
Edward Thomson 14fec0ae 2015-02-14T12:10:00 example: drop `SAFE_CREATE` from clone example
Boris Egorov 23d1dbe9 2015-02-06T11:43:12 describe example: function to add commits to opts Add safe function to (a,rea)llocate memory which terminate example on memory allocation failure. Move code to allocate commits to its own function.
Boris Egorov 2107dac3 2015-02-04T15:14:18 for-each-ref example: init/shutdown libgit2 in main I don't get how it was working without git_libgit2_init() call. I run it and libgit2 throws assertion somewhere in its internals. Now it works. Updated commit with shutdown at the end.
Boris Egorov 36e13399 2015-01-25T22:34:46 describe example: fix memory allocation size We need to allocate memory for sizeof(char *) * ncommits, not just for ncommits. Issue detected by GCC's AddressSanitizer.
Edward Thomson 9af3c416 2015-01-10T18:05:01 clone example: don't divide by zero Local transports don't have data about the size, avoid dividing by zero in the callback.
Will Stamper b874629b 2014-12-04T21:06:59 Spelling fixes
Vicent Marti 2e1e0f10 2014-11-21T17:24:55 blame: Do not assume blob contents are NULL-terminated
Carlos Martín Nieto 799e22ea 2014-10-23T17:34:41 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.
Carlos Martín Nieto 209425ce 2014-11-08T13:25:51 remote: rename _load() to _lookup() This brings it in line with the rest of the lookup functions.
Linquize d6bbcefc 2014-10-12T15:52:53 describe: add example
Carlos Martín Nieto 3f894205 2014-06-06T15:01:45 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.
Vicent Marti 14556cbf 2014-09-17T17:13:25 Merge pull request #2567 from cirosantilli/factor-41 Factor 40 and 41 constants from source.
Ciro Santilli 3b2cb2c9 2014-09-16T11:49:25 Factor 40 and 41 constants from source.
Linquize 2c22193b 2014-09-16T08:56:33 Fix typo
Linquize bd465f9c 2014-09-01T23:36:12 Fix warning
Eoin Coffey 33bf1b1a 2014-05-28T09:40:08 examples/log.c: invert filtering impl and conditional
Eoin Coffey 26cce321 2014-05-23T12:59:19 Add support for --grep
Eoin Coffey 161e6dc1 2014-05-23T12:27:16 Add --committer option, and break out helper function
Eoin Coffey 97fc71ab 2014-05-22T16:01:45 Add support for --author flag in example log implementation
Edward Thomson ead9c591 2014-05-21T17:25:00 Include windows.h on win32 for Sleep
Jeff King 56ec2256 2014-05-08T01:06:38 examples: add a basic for-each-ref example This is quite close to running "git for-each-ref" except: 1. It does not take any formatting or selection options at all. 2. The output is not sorted. I wrote it to look at debugging some issues with ref iteration, but there's no reason it can't live on as an example command.
Linquize d0420fc6 2014-05-01T22:39:35 Make examples/status.c compile on Windows
Vicent Marti 8443ed6c 2014-04-25T02:10:19 Merge pull request #2284 from jacquesg/push-progress-callback Fire progress and update tips callbacks also for pushes.
Russell Belfer 8d09efa2 2014-04-22T12:33:27 Use git_diff_get_stats in example/diff + refactor This takes the `--stat` and related example options in the example diff.c program and converts them to use the `git_diff_get_stats` API which nicely formats stats for you. I went to add bar-graph scaling to the stats formatter and noticed that the `git_diff_stats` structure was holding on to all of the `git_patch` objects. Unfortunately, each of these objects keeps the full text of the diff in memory, so this is very expensive. I ended up modifying `git_diff_stats` to keep just the data that it needs to keep and allowed it to release the patches. Then, I added width scaling to the output on top of that. In making the diff example program match 'git diff' output, I ended up removing an newline from the sumamry output which I then had to compensate for in the email formatting to match the expectations. Lastly, I went through and refactored the tests to use a couple of helper functions and reduce the overall amount of code there.
Russell Belfer 12e422a0 2014-04-21T16:08:05 Some doc and examples/diff.c changes I was playing with "git diff-index" and wanted to be able to emulate that behavior a little more closely with the diff example. Also, I wanted to play with running `git_diff_tree_to_workdir` directly even though core Git doesn't exactly have the equivalent, so I added a command line option for that and tweaked some other things in the example code. This changes a minor output thing in that the "raw" print helper function will no longer add ellipses (...) if the OID is not actually abbreviated.