examples


Log

Author Commit Date CI Message
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
Linquize fb190bbb 2013-11-12T19:44:13 Fix warnings
Vicent Martí 6414fd33 2013-11-11T06:47:15 Merge pull request #1956 from libgit2/cmn/fetch-default-head Remote revamp (director's cut)
Carlos Martín Nieto 359dce72 2013-11-02T00:05:32 remote: make _ls return the list directly The callback-based method of listing remote references dates back to the beginning of the network code's lifetime, when we didn't know any better. We need to keep the list around for update_tips() after disconnect() so let's make use of this to simply give the user a pointer to the array so they can write straightforward code instead of having to go through a callback.
Edward Thomson ad62f2ee 2013-11-07T12:00:43 update example to new packfile creation signature
Ben Straub b4794925 2013-11-04T15:54:11 blame sample: usage comment
Ben Straub ea8ce3d1 2013-11-04T15:50:33 Fix warnings
Ben Straub e6b85be7 2013-11-04T15:48:35 Reorganize and doc-commentify blame sample.
Ben Straub b7bb086b 2013-11-04T15:25:26 Standardize layout of blame sample
Russell Belfer fb6b0e01 2013-11-04T10:44:59 Merge pull request #1317 from libgit2/blame Blame Canada
Vicent Martí a605bbd9 2013-11-04T10:14:22 Merge pull request #1934 from libgit2/relicense-examples Relicense examples under CC0
Vicent Martí 5a0b8803 2013-11-04T08:05:55 Merge pull request #1929 from libgit2/rb/misc-diff-fixes Fix some observed problems with incorrect diffs
Carlos Martín Nieto becb13c0 2013-11-03T13:46:07 examples: doc update Update the explanation to reflect our use of git_status_list_new() and make the breaks in rocco more meaningful. Clarify why GIT_STATUS_CURRENT and index_to_workdir don't always imply each other. Fixes #1740.
Ben Straub 6cb831bd 2013-11-02T05:33:26 Replace copyright topmatter in example files
Ben Straub dcfdb977 2013-11-01T10:51:12 Relicense examples under CC0
Russell Belfer 4bf630b6 2013-10-31T14:36:52 Make diff and status perform soft index reload This changes `git_index_read` to have two modes - a hard index reload that always resets the index to match the on-disk data (which was the old behavior) and a soft index reload that uses the timestamp / file size information and only replaces the index data if the file on disk has been modified. This then updates the git_status code to do a soft reload unless the new GIT_STATUS_OPT_NO_REFRESH flag is passed in. This also changes the behavior of the git_diff functions that use the index so that when an index is not explicitly passed in (i.e. when the functions call git_repository_index for you), they will also do a soft reload for you. This intentionally breaks the file signature of git_index_read because there has been some confusion about the behavior previously and it seems like all existing uses of the API should probably be examined to select the desired behavior.
Vicent Martí 567649f2 2013-11-01T09:38:34 Merge pull request #1916 from libgit2/simplify-examples Fix examples to make the important stuff more obvious
Vicent Martí ac5e507c 2013-11-01T09:31:52 Merge pull request #1918 from libgit2/cmn/indexer-naming indexer: remove the stream infix
Ben Straub 4f62d559 2013-11-01T05:39:21 Fix typos
Carlos Martín Nieto c44820c6 2013-10-31T23:42:50 A few formatting changes for rocco I'm not too happy about manually inserting < and > but those get output as html tags otherwise.
Russell Belfer 76120863 2013-10-31T14:48:41 Update examples/README.md
Ben Straub 85c6730c 2013-10-31T14:35:32 Format comments for use with docco
Linquize 864e7271 2013-10-31T20:58:00 Use gmtime() instead of gmtime_t() The latter is not available on Windows
Ben Straub dbdb22b3 2013-10-30T13:20:08 Clean up showindex sample
Ben Straub b9d02460 2013-10-30T13:07:58 Reorganize rev-parse example
Ben Straub 784b3abb 2013-10-30T12:34:03 rev-list.c example: use common utils, reorganize
Ben Straub 9d83d368 2013-10-30T07:21:36 cat-file.c example: deploy helpers, reorg
Ben Straub dbfd2833 2013-10-30T07:21:12 add.c: proper frontmatter
Carlos Martín Nieto a6154f21 2013-10-30T15:00:05 indexer: remove the stream infix It was there to keep it apart from the one which read in from a file on disk. This other indexer does not exist anymore, so there is no need for anything other than git_indexer to refer to it. While here, rename _add() function to _append() and _finalize() to _commit(). The former change is cosmetic, while the latter avoids talking about "finalizing", which OO languages use to mean something completely different.
Ben Straub 7cc3c9bf 2013-10-30T06:09:08 init.c example: deploy more helpers
Ben Straub e568bedf 2013-10-30T06:08:54 add.c example: deploy helpers, reorg
Ben Straub a8422f92 2013-10-30T05:38:12 init example: deploy helpers, reorg
Russell Belfer 66902d47 2013-10-29T18:30:49 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.
Ben Straub 42c8f8f8 2013-10-28T11:04:58 Merge remote-tracking branch 'libgit2/development' into blame
Vicent Martí 5c50f22a 2013-10-28T09:25:44 Merge pull request #1891 from libgit2/cmn/fix-thin-packs Add support for thin packs
Carlos Martín Nieto ab46b1d8 2013-10-23T15:08:18 indexer: include the delta stats The user is unable to derive the number of deltas in the pack, as that would require them to capture the stats exactly in the moment between download and final processing, which is abstracted away in the fetch. Capture these numbers for the user and expose them in the progress struct. The clone and fetch examples now also present this information to the user.
Carlos Martín Nieto ebbd48f0 2013-10-23T14:22:44 examples: show used local objects in fetch Show how many local objects were used to fix the thin pack in our fetch example.
Russell Belfer 3b5f7954 2013-10-21T13:42:42 Create git_diff_line and extend git_diff_hunk Instead of having functions with so very many parameters to pass hunk and line data, this takes the existing git_diff_hunk struct and extends it with more hunk data, plus adds a git_diff_line. Those structs are used to pass back hunk and line data instead of the old APIs that took tons of parameters. Some work that was previously only being done for git_diff_patch creation (scanning the diff content for exact line counts) is now done for all callbacks, but the performance difference should not be noticable.
Russell Belfer 10672e3e 2013-10-15T15:10:07 Diff API cleanup This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
Russell Belfer 3ff1d123 2013-10-11T14:51:54 Rename diff objects and split patch.h This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
Ben Straub 607fe733 2013-10-10T14:30:31 Fix post-line-range iteration
Ben Straub c1ca2b67 2013-10-10T14:30:05 Include signatures in blame hunks
Ben Straub ebd67243 2013-10-10T13:56:45 Only show lines that had blame run on them
Ben Straub d2e7532f 2013-10-10T13:56:28 Be more flexible with argument order and format
Ben Straub 0a23d205 2013-10-09T16:18:32 Ignore more built examples
Ben Straub 43a07b86 2013-10-09T16:16:43 Simplify loading blob