examples


Log

Author Commit Date CI Message
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.
Jacques Germishuys 48e60ae7 2014-04-21T11:23:29 Don't redefine the same callback types, their signatures may change
Russell Belfer d543d59c 2014-03-28T10:42:38 Add some funny options for debugging status This allows you to use a --repeat option to run status over and over and see how the output changes as you make local directory changes without reopening the git_repository object each time. Also, adds a flag to explicitly list the submodules before status.
Vicent Marti a2d18a02 2014-04-01T13:47:52 Merge pull request #2228 from mekishizufu/example_short_id Use git_object_short_id in examples
Vicent Marti 9325460a 2014-04-01T13:47:44 Merge pull request #2206 from libgit2/cmn/inmemory-swap-order Rename in-memory remote to anonymous and swap url and fetch order
Carlos Martín Nieto fd536d29 2014-03-26T11:15:57 remote: rename inmemory to anonymous and swap url and fetch order The order in this function is the opposite to what create_with_fetchspec() has, so change this one, as url-then-refspec is what git does. As we need to break compilation and the swap doesn't do that, let's take this opportunity to rename in-memory remotes to anonymous as that's really what sets them apart.
Jiri Pospisil 6ad59ef1 2014-04-01T12:16:40 examples: Use git_object_short_id
Russell Belfer a15c7802 2014-03-25T09:14:48 Make submodules externally refcounted `git_submodule` objects were already refcounted internally in case the submodule name was different from the path at which it was stored. This makes that refcounting externally used as well, so `git_submodule_lookup` and `git_submodule_add_setup` return an object that requires a `git_submodule_free` when done.
Vicent Marti 041cd4a2 2014-03-07T19:02:58 Merge pull request #2028 from libgit2/options-names Rename options structures
Russell Belfer 5a6de908 2014-03-07T09:13:43 Merge pull request #2153 from mekishizufu/tag_example Add a tag example
Ben Straub 6affd71f 2014-01-03T17:38:34 git_checkout_opts -> git_checkout_options
Sun He 6246de93 2014-03-06T11:16:36 Merge completed: resolve the conflict with the upstream
Jiri Pospisil feebe615 2014-03-05T20:26:13 Move all variable declarations to the top of the block
Jiri Pospisil a53b8584 2014-03-03T23:56:43 Add tag example
Sun He 8384a50a 2014-03-05T20:33:20 fix the output format of diff
Sun He 45d2e8dc 2014-03-05T20:13:34 Add the --shortstat flag to examples/diff.c
Brian Gesiak 0d3c8a9d 2014-03-05T13:06:31 examples/diff: Add minimal, patience diff options. - Add minimal, patience diff options to diff example. libgit2 `diff_xdiff.git_xdiff_init` already supports these flags, so no additional change is necessary. - Remove minimal and patience flag addition from project list.
Miha Ravšelj b43f35fd 2014-03-03T14:59:50 - examples CMakeLists.txt reverted to previous state
Miha 6874cafd 2014-03-03T12:08:17 cmake examples change so that general.c is off by default
Miha 0330469f 2014-03-03T11:42:25 - general.c reverted to original( before pr state )
Miha b5212858 2014-03-03T11:40:22 Merge remote-tracking branch 'remotes/upstream/development' into development
Russell Belfer d8839992 2014-02-27T14:01:16 Fix warnings and code style issues
Miha 300f4412 2014-02-25T11:56:11 - 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
Juan Rubén 899bd19a 2014-02-24T21:20:57 Document enumerator and rewording
Juan Rubén c7c83394 2014-02-21T00:22:07 Add option to limit blame to first parent
rocky-luo 8086b78b 2014-02-09T21:08:42 replace 'out' with 'patch',replace the literal tabs with '\t'.
rocky-luo 4f5a3f40 2014-02-08T20:10:19 add example for diff with --numstat
Ben Straub 5c8be325 2014-02-05T13:32:45 Fix a few references to changed function signatures
Vicent Marti 93954245 2014-01-27T09:39:36 Merge pull request #2075 from libgit2/cmn/leftover-oid Leftover OID -> ID changes
Vicent Marti c90ea3de 2014-01-27T09:34:52 Merge pull request #2078 from linquize/msvc MSVC doesn't like modern code neither
Linquize 1664aaaa 2013-11-05T23:39:05 Make blame example compile on MSVC
Linquize fbc5661e 2014-01-27T20:51:46 MSVC doesn't like modern code neither
Carlos Martín Nieto d541170c 2014-01-24T11:36:41 index: rename an entry's id to 'id' This was not converted when we converted the rest, so do it now.
Ben Straub 83e1efbf 2013-11-14T14:10:32 Update files that reference tests-clar