diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 16 | ||||
-rw-r--r-- | CONVENTIONS | 4 | ||||
-rw-r--r-- | Makefile.embed | 6 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | examples/general.c | 2 | ||||
-rw-r--r-- | src/mwindow.c | 2 |
7 files changed, 26 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml index b9a08dc59..11c85bbc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ language: erlang # Settings to try env: - OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release" - - OPTIONS="-DBUILD_CLAR=ON" + - OPTIONS="-DBUILD_CLAR=ON -DBUILD_EXAMPLES=ON" # Make sure CMake is installed install: diff --git a/CMakeLists.txt b/CMakeLists.txt index bfbabc0a5..165baba78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.") OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON) OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF) OPTION (BUILD_CLAR "Build Tests using the Clar suite" ON) +OPTION (BUILD_EXAMPLES "Build library usage example apps" OFF) OPTION (TAGS "Generate tags" OFF) OPTION (PROFILE "Generate profiling information" OFF) @@ -183,3 +184,18 @@ IF (TAGS) DEPENDS tags ) ENDIF () + +IF (BUILD_EXAMPLES) + FILE(GLOB_RECURSE EXAMPLE_SRC examples/network/*.c) + ADD_EXECUTABLE(cgit2 ${EXAMPLE_SRC}) + TARGET_LINK_LIBRARIES(cgit2 git2 pthread) + + ADD_EXECUTABLE(git-diff examples/diff.c) + TARGET_LINK_LIBRARIES(git-diff git2) + + ADD_EXECUTABLE(git-general examples/general.c) + TARGET_LINK_LIBRARIES(git-general git2) + + ADD_EXECUTABLE(git-showindex examples/showindex.c) + TARGET_LINK_LIBRARIES(git-showindex git2) +ENDIF () diff --git a/CONVENTIONS b/CONVENTIONS index 575cdc563..f082d8e6c 100644 --- a/CONVENTIONS +++ b/CONVENTIONS @@ -49,7 +49,7 @@ Functions should prefer to return a 'int' to indicate success or failure and supply any output through the first argument (or first few arguments if multiple outputs are supplied). -int status codes are 0 for GIT_SUCCESS and < 0 for an error. +int status codes are 0 for GIT_OK and < 0 for an error. This permits common POSIX result testing: ---- @@ -58,7 +58,7 @@ This permits common POSIX result testing: ---- Functions returning a pointer may return NULL instead of an int -if there is only one type of failure (ENOMEM). +if there is only one type of failure (GIT_ENOMEM). Functions returning a pointer may also return NULL if the common case needed by the application is strictly success/failure and a diff --git a/Makefile.embed b/Makefile.embed index fb6b01bee..65f13b9b6 100644 --- a/Makefile.embed +++ b/Makefile.embed @@ -6,10 +6,10 @@ LIBNAME=libgit2.a INCLUDES= -I. -Isrc -Iinclude -Ideps/http-parser -Ideps/zlib -DEFINES= $(INCLUDES) -DNO_VIZ -DSTDC -DNO_GZIP -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -CFLAGS= -g $(DEFINES) -Wall -Wextra -fPIC -O2 +DEFINES= $(INCLUDES) -DNO_VIZ -DSTDC -DNO_GZIP -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $(EXTRA_DEFINES) +CFLAGS= -g $(DEFINES) -Wall -Wextra -fPIC -O2 $(EXTRA_CFLAGS) -SRCS = $(wildcard src/*.c) $(wildcard src/transports/*.c) $(wildcard src/unix/*.c) $(wildcard deps/http-parser/*.c) $(wildcard deps/zlib/*.c) +SRCS = $(wildcard src/*.c) $(wildcard src/transports/*.c) $(wildcard src/unix/*.c) $(wildcard src/xdiff/*.c) $(wildcard deps/http-parser/*.c) $(wildcard deps/zlib/*.c) OBJS = $(patsubst %.c,%.o,$(SRCS)) %.c.o: @@ -124,7 +124,9 @@ How Can I Contribute? ================================== Fork libgit2/libgit2 on GitHub, add your improvement, push it to a branch -in your fork named for the topic, send a pull request. +in your fork named for the topic, send a pull request. If you change the +API or make other large changes, make a note of it in docs/RelNotes/ in a +file named after the next release. You can also file bugs or feature requests under the libgit2 project on GitHub, or join us on the mailing list by sending an email to: diff --git a/examples/general.c b/examples/general.c index 4585a4af5..5269785f2 100644 --- a/examples/general.c +++ b/examples/general.c @@ -392,7 +392,7 @@ int main (int argc, char** argv) // Here we will implement something like `git for-each-ref` simply listing out all available // references and the object SHA they resolve to. git_strarray ref_list; - git_reference_listall(&ref_list, repo, GIT_REF_LISTALL); + git_reference_list(&ref_list, repo, GIT_REF_LISTALL); const char *refname; git_reference *ref; diff --git a/src/mwindow.c b/src/mwindow.c index b59c4d2f7..57adabd48 100644 --- a/src/mwindow.c +++ b/src/mwindow.c @@ -89,7 +89,6 @@ void git_mwindow_scan_lru( { git_mwindow *w, *w_l; - puts("LRU"); for (w_l = NULL, w = mwf->windows; w; w = w->next) { if (!w->inuse_cnt) { /* @@ -247,7 +246,6 @@ unsigned char *git_mwindow_open( if (left) *left = (unsigned int)(w->window_map.len - offset); - fflush(stdout); return (unsigned char *) w->window_map.data + offset; } |