examples


Log

Author Commit Date CI Message
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
Ben Straub 2ccc84d2 2013-10-09T16:07:36 Allow null bytes in blob
Ben Straub cb45dafa 2013-10-09T16:07:17 Initialize threading, fix broken strncmp
Ben Straub 370d1d16 2013-10-09T14:41:44 Un-remove init example
Carlos Martín Nieto 0b33fca0 2013-10-02T13:39:35 indexer: fix thin packs When given an ODB from which to read objects, the indexer will attempt to inject the missing bases at the end of the pack and update the header and trailer to reflect the new contents.
Ben Straub fc1f7d4f 2013-10-03T06:20:20 Merge branch 'development' into blame Conflicts: include/git2.h
Carlos Martín Nieto 0e0cf787 2013-10-02T14:04:44 clone: put the callbacks struct directly in the clone options There's no need for this to be a pointer to somewhere else.
Carlos Martín Nieto e3c131c5 2013-09-16T05:02:25 remote: move the credentials callback to the struct Move this one as well, letting us have a single way of setting the callbacks for the remote, and removing fields from the clone options.
Carlos Martín Nieto d31402a3 2013-09-16T04:20:05 remote: put the _download() callback with the others The text progress and update_tips callbacks are already part of the struct, which was meant to unify the callback setup, but the download one was left out.
Ben Straub de8fe729 2013-09-29T10:46:41 Fix typo
Ben Straub 41dd999d 2013-09-25T14:47:32 Merge branch 'development' into blame
Russell Belfer 37f9e409 2013-09-13T21:43:00 Some tests with ident and crlf filters Fixed the filter order to match core Git, too. This test demonstrates an interesting behavior of core Git (which is totally reasonable and which libgit2 matches, although mostly by coincidence). If you use the ident filter and commit a file with a garbage ident in it, like '$Id: this is just garbage$' and then immediately do a 'git checkout-index' with the new file, Git will not consider the file out of date and will not overwrite the file with an updated $Id$. Libgit2 has the same behavior. If you remove the file and then do a checkout-index, it will be replaced with a filtered version that has injected the OID correctly.
Carlos Martín Nieto 605da51a 2013-09-17T09:50:30 No such thing as an orphan branch Unfortunately git-core uses the term "unborn branch" and "orphan branch" interchangeably. However, "orphan" is only really there for the checkout command, which has the `--orphan` option so it doesn't actually create the branch. Branches never have parents, so the distinction of a branch with no parents is odd to begin with. Crucially, the error messages deal with unborn branches, so let's use that.
Ben Straub 4c7fdb4d 2013-09-16T16:27:10 Add blame example
Russell Belfer 0c52b204 2013-09-09T11:07:17 Make work if built with threading enabled
Krzysztof Adamski b2395a82 2013-09-04T18:49:10 Only use callbacks when -n or -v in add example.
Krzysztof Adamski 04fd2665 2013-09-04T18:44:12 Move statement after declarations in add example.
Krzysztof Adamski 9a0e42c6 2013-09-04T18:43:14 Remove unnececery arguments priting in add example.
Krzysztof Adamski 813937ce 2013-09-04T18:42:47 Better usage info in add example.
Krzysztof Adamski 24d23220 2013-09-04T18:34:03 Add -u option to add example.
Krzysztof Adamski e8fa14d3 2013-09-03T19:11:50 Supported options information in add example.
Krzysztof Adamski 62020aa8 2013-09-02T02:01:40 Adding add example.
Russell Belfer 60ee53df 2013-09-03T15:14:04 Split examples CMakeLists.txt Also, this converts the examples/CMakeLists.txt from explicitly listing to just globbing for all the individual C files.
Krzysztof Adamski 255836dd 2013-09-01T18:35:39 Adding credentials callback to ls-remote and fetch too.
Krzysztof Adamski d6d52348 2013-09-01T18:30:11 Removing unneeded code duplication in ls-remote.c
Russell Belfer 0ea41445 2013-08-16T15:03:15 Improve isolation of new test from user environs
Russell Belfer 944c1589 2013-08-16T14:49:38 Add example like "git init"
Brendan Macmillan c3ae0473 2013-07-27T05:31:28 Fix -n bug; default to all ancestors
Russell Belfer bc6f0839 2013-07-05T15:22:21 Add a bunch more features to log example
Russell Belfer a8b5f116 2013-07-03T17:00:50 Fix example/log.c pathspec handling of merges This fixes the way the example log program decides if a merge commit should be shown when a pathspec is given. Also makes it easier to use the pathspec API to just check "does a tree match anything in the pathspec" without allocating a match list.
Russell Belfer 733c4f3a 2013-07-03T15:12:14 more examples/log.c bug fixing
Russell Belfer 5a169711 2013-07-03T15:08:54 fix bug with order args and no revision
Russell Belfer 2b3bd8ec 2013-07-03T14:53:39 Fix example/log.c minor diffs with git log
Russell Belfer f44c4fa1 2013-07-01T15:41:32 Add basic commit formatting to log output
Russell Belfer 8ba0ff69 2013-06-25T15:39:44 rev-parse example
Russell Belfer d0628e2f 2013-06-25T15:39:13 More progress on log example
Russell Belfer 0d44d3dc 2013-06-24T23:21:23 Extending log example code This adds more command line processing to the example version of log. In particular, this adds the funky command line processing that allows an arbitrary series of revisions followed by an arbitrary number of paths and/or glob patterns. The actual logging part still isn't implemented.
Russell Belfer d39fff36 2013-06-23T20:33:57 Basic framework for log command
Russell Belfer 92808557 2013-06-20T15:10:42 Fix comment and copyright in example
Russell Belfer f18f772a 2013-06-20T14:27:14 Add example implementation of long format status
Russell Belfer 22b6b82f 2013-06-20T12:16:06 Add status flags to force output sort order Files in status will, be default, be sorted according to the case insensitivity of the filesystem that we're running on. However, in some cases, this is not desirable. Even on case insensitive file systems, 'git status' at the command line will generally use a case sensitive sort (like 'ls'). Some GUIs prefer to display a list of file case insensitively even on case-sensitive platforms. This adds two new flags: GIT_STATUS_OPT_SORT_CASE_SENSITIVELY and GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY that will override the default sort order of the status output and give the user control. This includes tests for exercising these new options and makes the examples/status.c program emulate core Git and always use a case sensitive sort.
Russell Belfer cf300bb9 2013-06-20T11:39:31 Initial implementation of status example
Russell Belfer 5c8f37a3 2013-05-17T17:33:03 Extend diff example Add --raw output format and (some) options to invoke rename/copy detection on the diff.
Russell Belfer 8d784001 2013-05-16T10:43:10 Make examples/diff.c compile vs threadsafe library
Russell Belfer 58206c9a 2013-05-16T10:38:27 Add cat-file example and increase const use in API This adds an example implementation that emulates git cat-file. It is a convenient and relatively simple example of getting data out of a repository. Implementing this also revealed that there are a number of APIs that are still not using const pointers to objects that really ought to be. The main cause of this is that `git_vector_bsearch` may need to call `git_vector_sort` before doing the search, so a const pointer to the vector is not allowed. However, for tree objects, with a little care, we can ensure that the vector of tree entries is always sorted and allow lookups to take a const pointer. Also, the missing const in commit objects just looks like an oversight.
nulltoken 1fed6b07 2013-05-13T21:57:37 Fix trailing whitespaces
Carlos Martín Nieto 2b562c3a 2013-05-04T16:32:58 refs: remove the OID/SYMBOLIC filtering Nobody should ever be using anything other than ALL at this level, so remove the option altogether. As part of this, git_reference_foreach_glob is now implemented in the frontend using an iterator. Backends will later regain the ability of doing the glob filtering in the backend.
Carlos Martín Nieto 6c1b6b7a 2013-04-23T16:21:47 examples: init the threading system
Vicent Marti 32ef1d1c 2013-04-16T00:17:40 Fix examples
Vicent Marti d064c747 2013-04-15T23:18:24 Merge remote-tracking branch 'ben/unified-revparse' into development
Ben Straub 20156653 2013-04-15T13:29:40 Clean up minor details
Ben Straub 5961d5ea 2013-04-15T12:10:18 Clean up example code.
Ben Straub 299a224b 2013-04-15T12:00:04 Change git_revparse to output git_object pointers This will probably prevent many lookup/free operations in calling code.
Vicent Marti 0d3ccf0b 2013-04-10T16:41:05 examples: Don't print weird characters
Russell Belfer 9da187e8 2013-04-09T11:40:00 Fix clang warnings and improve checks
Ben Straub ec7e240b 2013-04-09T05:07:12 Add rev-list example to makefiles
Ben Straub 1aa21fe3 2013-04-09T05:03:51 Deprecate git_revparse_single and _rangelike
Vicent Marti d9ecaf8c 2013-04-07T07:22:38 Merge remote-tracking branch 'gnprice/revwalk' into development
Greg Price 2e233285 2013-03-20T09:39:20 examples: a test, for rev-list This test file could probably be improved by a framework like the one in git.git:t/, or by using a language like Python instead of shell. The other examples would benefit from tests too. Probably best to settle on a framework to write them in, then add more tests. Signed-off-by: Greg Price <price@mit.edu>
Greg Price 8f7f5e55 2013-03-31T14:56:32 examples: rev-list This demonstrates parts of the interface for specifying revisions that Git users are familiar with from 'git rev-list', 'git log', and other Git commands. A similar query interface is used in out-of-core command-line programs that browse a Git repo (like 'tig'), and may be useful for an 'advanced search' interface in GUI or web applications. In this version, we parse all the query modifiers we can support with the existing logic in revwalk: basic include/exclude commits, and the ordering flags. More logic will be required to support '--grep', '--author', the pickaxe '-S', etc. Signed-off-by: Greg Price <price@mit.edu>
Ben Straub f8591e51 2013-04-04T11:44:50 General example: run against testrepo.git Fixes #1455
lionel vitte e2886f1e 2013-03-20T21:13:43 Fix link issue in network examples
Russell Belfer 7bd53bf3 2013-03-02T13:52:38 Simplify diff example using revparse When the examples/diff.c was written, there was not yet a revparse API. Now we can use it to make command line parsing way better with less code. Yay!
Martin Woodward 5c46937b 2013-02-26T09:00:37 Give props to Martin Pool Martin Pool was the original author of the code referenced in the clone example. Make note that he's given his permission and also give him the proper credit.
Russell Belfer a7ed7460 2013-02-15T15:58:13 Add rudimentary error checks and reformat comments There were a number of functions assigning their return value to `error` without much explanation. I added in some rudimentary error checking to help flesh out the example. Also, I reformatted all of the comments down to 80 cols (and in some cases, slightly updated the wording).
Russell Belfer 9c258af0 2013-02-12T10:13:56 Merge pull request #1316 from ben/clone-cancel Allow network operations to cancel
Carlos Scheidegger ef41ab88 2013-02-06T17:37:51 removed other references to api.html
Ben Straub fe95ac1b 2013-02-05T10:59:58 Allow progress callback to cancel fetch This works by having the indexer watch the return code of the callback, so will only take effect on object boundaries.
Ben Straub 7602cb7c 2013-01-31T10:44:57 Add user-from-url param to auth callback
Edward Thomson c27e2112 2013-01-23T17:38:00 update examples to work on windows
Sebastian Bauer 75a0a800 2013-01-23T07:47:40 Don't clear the opt instance in the diff example. The version field is overwritten otherwise. The opt instance is already initialized properly.
Sebastian Bauer cea994b9 2013-01-10T12:39:17 Don't call pthread_exit() in the callback. Compilers that are not aware that pthread_exit() does not return issue a warning when compiling the present code. This change exchanges the call to pthread_exit() with a simple return statement. According to the pthread specification this is equivalent.
Vicent Martí cd5ca5b9 2013-01-02T13:50:41 Merge pull request #1152 from ben/clone-api-structification Segregate in-memory and persisted remotes
Ben Straub 730df6d0 2013-01-02T13:43:54 Include checkout options inline
Ben Straub 0642c143 2013-01-02T12:44:47 Move `url` to last place in parameter list
Russell Belfer dbc4aa07 2012-12-28T22:00:24 Update showindex example I find the showindex example to be pretty useful on occasion, but there were are couple of output tweaks I wanted, plus I wanted the ability to specify a path to an actual index file instead of having to open the whole repository. This makes those changes and expands the example slightly.
Ben Straub 3de22567 2012-12-27T11:12:14 Fix warnings in example
Ben Straub 69d1bd91 2012-12-21T15:30:46 Fix examples
Ben Straub 29f27599 2012-12-20T10:51:09 Rename remote creation APIs git_remote_add -> git_remote_create git_remote_new -> git_remote_create_inmemory
Ben Straub 316bca69 2012-12-19T17:07:12 Fix clone sample
Russell Belfer 56c72b75 2012-12-17T11:00:53 Fix diff constructor name order confusion The diff constructor functions had some confusing names, where the "old" side of the diff was coming after the "new" side. This reverses the order in the function name to make it less confusing. Specifically... * git_diff_index_to_tree becomes git_diff_tree_to_index * git_diff_workdir_to_index becomes git_diff_index_to_workdir * git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
Ben Straub cc3e9b5a 2012-12-16T10:50:10 Make building samples more friendly
Ben Straub b9e7e2b4 2012-12-14T13:46:45 Move non-options back out of options struct
Ben Straub 0015b587 2012-12-14T13:18:06 Deploy git_clone_options to network sample
Ben Straub 2b10a2b0 2012-12-13T11:47:14 Enable authenticated clones in network sample
Ben Straub 24393ea6 2012-12-13T09:14:56 Stop premature remote freeing when cloning
Ben Straub 34c8c754 2012-12-13T08:54:23 Fix network example
Ben Straub 9267ff58 2012-11-29T20:01:24 Deploy GIT_REMOTE_CALLBACKS_INIT