libgit2/examples
Russell Belfer 4bf630b6ba 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.
2013-11-01 10:20:51 -07:00
..
network Merge pull request #1916 from libgit2/simplify-examples 2013-11-01 09:38:34 -07:00
test examples: a test, for rev-list 2013-04-06 20:51:16 -07:00
.gitignore examples: rev-list 2013-04-06 20:51:16 -07:00
add.c add.c: proper frontmatter 2013-10-30 07:21:12 -07:00
cat-file.c Fix typos 2013-11-01 05:39:21 -07:00
CMakeLists.txt Extract common example helpers and reorg examples 2013-10-29 18:30:49 -07:00
common.c Extract common example helpers and reorg examples 2013-10-29 18:30:49 -07:00
common.h Extract common example helpers and reorg examples 2013-10-29 18:30:49 -07:00
diff.c A few formatting changes for rocco 2013-11-01 09:08:22 +01:00
general.c refs: remove the OID/SYMBOLIC filtering 2013-05-11 11:20:38 +02:00
init.c Format comments for use with docco 2013-10-31 14:35:32 -07:00
log.c Merge pull request #1916 from libgit2/simplify-examples 2013-11-01 09:38:34 -07:00
Makefile Extract common example helpers and reorg examples 2013-10-29 18:30:49 -07:00
README.md Update examples/README.md 2013-10-31 14:48:41 -07:00
rev-list.c rev-list.c example: use common utils, reorganize 2013-10-30 12:34:03 -07:00
rev-parse.c Format comments for use with docco 2013-10-31 14:35:32 -07:00
showindex.c Make diff and status perform soft index reload 2013-11-01 10:20:51 -07:00
status.c Format comments for use with docco 2013-10-31 14:35:32 -07:00

libgit2 examples

These examples are a mixture of basic emulation of core Git command line functions and simple snippets demonstrating libgit2 API usage (for use with Docurium). As a whole, they are not vetted carefully for bugs, error handling, and cross-platform compatibility in the same manner as the rest of the code in libgit2, so copy with caution.

That being said, you are welcome to copy code from these examples as desired when using libgit2.

For annotated HTML versions, see the "Examples" section of:

http://libgit2.github.com/libgit2

such as:

http://libgit2.github.com/libgit2/ex/HEAD/general.html