Skip to content

Commit b7a1e2b

Browse files
committed
added in latest libgit2
1 parent b958260 commit b7a1e2b

212 files changed

Lines changed: 17095 additions & 4678 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/commit.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ const git_oid* GitCommit::Id() {
6767
}
6868

6969
const char* GitCommit::MessageShort() {
70-
return git_commit_message_short(this->commit);
70+
return "";
71+
//return git_commit_message_short(this->commit);
7172
}
7273

7374
const char* GitCommit::Message() {

src/oid.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ void GitOid::SetValue(git_oid oid) {
4343
}
4444

4545
int GitOid::Mkstr(const char* id) {
46-
return git_oid_mkstr(&this->oid, id);
46+
return git_oid_fromstr(&this->oid, id);
4747
}
4848

4949
void GitOid::Mkraw(const unsigned char* raw) {
50-
git_oid_mkraw(&this->oid, raw);
50+
git_oid_fromraw(&this->oid, raw);
5151
}
5252

5353
void GitOid::Fmt(char* buffer) {

src/sig.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ void GitSig::SetValue(git_signature* sig) {
4444
}
4545

4646
void GitSig::New(const char *name, const char *email, time_t time, int offset) {
47-
this->sig = git_signature_new(name, email, time, offset);
47+
git_signature_new(&this->sig, name, email, time, offset);
48+
//this->sig = git_signature_new(name, email, time, offset);
4849
}
4950

5051
git_signature* GitSig::Dup() {

vendor/libgit2/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.c eol=lf
2+
*.h eol=lf

vendor/libgit2/.gitignore

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/apidocs
32
/trash-*.exe
43
/libgit2.pc
@@ -13,10 +12,13 @@
1312
.waf*
1413
build/
1514
tests/tmp/
16-
msvc/Debug/
17-
msvc/Release/
18-
*.suo
19-
*.user
20-
*.sdf
15+
msvc/Debug/
16+
msvc/Release/
17+
*.sln
18+
*.suo
19+
*.vc*proj*
20+
*.sdf
2121
*.opensdf
22+
CMake*
23+
*.cmake
2224
.DS_Store

vendor/libgit2/CMakeLists.txt

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# > mkdir build && cd build
55
# > cmake .. [-DSETTINGS=VALUE]
66
# > cmake --build .
7-
#
7+
#
88
# Testing:
99
# > ctest -V
1010
#
@@ -22,37 +22,19 @@ STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1"
2222
SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_REV}")
2323

2424
# Find required dependencies
25-
INCLUDE_DIRECTORIES(deps/zlib src include)
26-
27-
# Try finding openssl
28-
FIND_PACKAGE(OpenSSL)
29-
IF (OPENSSL_CRYPTO_LIBRARIES)
30-
SET(SHA1_TYPE "openssl" CACHE STRING "Which SHA1 implementation to use: builtin, ppc, openssl")
31-
ELSEIF ()
32-
SET(SHA1_TYPE "builtin" CACHE STRING "Which SHA1 implementation to use: builtin, ppc")
33-
ENDIF ()
34-
35-
INCLUDE(FindPkgConfig)
36-
37-
# Show SQLite3 settings in GUI (if they won't be found out)
38-
SET(SQLITE3_INCLUDE_DIRS "" CACHE PATH "SQLite include directory")
39-
SET(SQLITE3_LIBRARIES "" CACHE FILEPATH "SQLite library")
40-
41-
# Are SQLite3 variables already set up? (poor Windows/no pkg-config/no sqlite3.pc)
42-
IF (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)
43-
SET(SQLITE3_FOUND 1)
44-
ENDIF ()
45-
46-
# Try to find SQLite3 via pkg-config
47-
IF (PKG_CONFIG_FOUND AND NOT SQLITE3_FOUND)
48-
pkg_check_modules(SQLITE3 sqlite3)
49-
ENDIF ()
25+
INCLUDE_DIRECTORIES(src include)
26+
IF (NOT WIN32)
27+
FIND_PACKAGE(ZLIB)
28+
ENDIF()
5029

51-
# Compile SQLite backend if SQLite3 is available
52-
IF (SQLITE3_FOUND)
53-
ADD_DEFINITIONS(-DGIT2_SQLITE_BACKEND)
54-
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIRS})
55-
ENDIF ()
30+
IF (ZLIB_FOUND)
31+
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
32+
LINK_LIBRARIES(${ZLIB_LIBRARIES})
33+
ELSE (ZLIB_FOUND)
34+
INCLUDE_DIRECTORIES(deps/zlib)
35+
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
36+
FILE(GLOB SRC_ZLIB deps/zlib/*.c)
37+
ENDIF()
5638

5739
# Installation paths
5840
SET(INSTALL_BIN bin CACHE PATH "Where to install binaries to.")
@@ -63,10 +45,27 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.")
6345
OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
6446
OPTION (BUILD_TESTS "Build Tests" ON)
6547
OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF)
48+
OPTION (STDCALL "Buildl libgit2 with the __stdcall convention (Windows)" ON)
49+
50+
# Platform specific compilation flags
51+
IF (MSVC)
52+
SET(CMAKE_C_FLAGS "/W4 /WX /nologo /Zi")
53+
IF (STDCALL)
54+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz")
55+
ENDIF ()
56+
# TODO: bring back /RTC1 /RTCc
57+
SET(CMAKE_C_FLAGS_DEBUG "/Od /DEBUG /MTd")
58+
SET(CMAKE_C_FLAGS_RELEASE "/MT /O2")
59+
ELSE ()
60+
SET(CMAKE_C_FLAGS "-O2 -g -Wall -Wextra")
61+
IF (NOT MINGW) # MinGW always does PIC and complains if we tell it to
62+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
63+
ENDIF ()
64+
ENDIF()
6665

67-
# Build Release by default
66+
# Build Debug by default
6867
IF (NOT CMAKE_BUILD_TYPE)
69-
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
68+
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
7069
ENDIF ()
7170

7271
IF (THREADSAFE)
@@ -77,57 +76,59 @@ IF (THREADSAFE)
7776
ADD_DEFINITIONS(-DGIT_THREADS)
7877
ENDIF()
7978

79+
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
80+
8081
# Collect sourcefiles
81-
FILE(GLOB SRC src/*.c src/backends/*.c)
82-
FILE(GLOB SRC_ZLIB deps/zlib/*.c)
83-
FILE(GLOB SRC_SHA1 src/block-sha1/*.c)
84-
FILE(GLOB SRC_PLAT src/unix/*.c)
8582
FILE(GLOB SRC_H include/git2/*.h)
8683

8784
# On Windows use specific platform sources
8885
IF (WIN32 AND NOT CYGWIN)
8986
ADD_DEFINITIONS(-DWIN32 -D_DEBUG -D_LIB)
90-
FILE(GLOB SRC_PLAT src/win32/*.c)
87+
FILE(GLOB SRC src/*.c src/win32/*.c)
88+
ELSE()
89+
FILE(GLOB SRC src/*.c src/unix/*.c)
9190
ENDIF ()
9291

93-
# Specify sha1 implementation
94-
IF (SHA1_TYPE STREQUAL "ppc")
95-
ADD_DEFINITIONS(-DPPC_SHA1)
96-
FILE(GLOB SRC_SHA1 src/ppc/*.c)
97-
ELSEIF (SHA1_TYPE STREQUAL "openssl")
98-
ADD_DEFINITIONS(-DOPENSSL_SHA1)
99-
SET (SRC_SHA1)
100-
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
101-
SET (LIB_SHA1 ${OPENSSL_CRYPTO_LIBRARIES})
92+
# Compile and link libgit2
93+
ADD_LIBRARY(git2 ${SRC} ${SRC_ZLIB})
94+
95+
IF (WIN32)
96+
TARGET_LINK_LIBRARIES(git2 ws2_32)
97+
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
98+
TARGET_LINK_LIBRARIES(git2 socket nsl)
10299
ENDIF ()
103100

104-
# Compile and link libgit2
105-
ADD_LIBRARY(git2 ${SRC} ${SRC_PLAT} ${SRC_SHA1} ${SRC_ZLIB})
106-
TARGET_LINK_LIBRARIES(git2 ${LIB_SHA1} ${CMAKE_THREAD_LIBS_INIT} ${SQLITE3_LIBRARIES})
101+
TARGET_LINK_LIBRARIES(git2 ${CMAKE_THREAD_LIBS_INIT})
107102
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
108103
SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR})
104+
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY)
109105

110106
# Install
111-
INSTALL(TARGETS git2
107+
INSTALL(TARGETS git2
112108
RUNTIME DESTINATION ${INSTALL_BIN}
113109
LIBRARY DESTINATION ${INSTALL_LIB}
114110
ARCHIVE DESTINATION ${INSTALL_LIB}
115111
)
112+
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc DESTINATION ${INSTALL_LIB}/pkgconfig )
116113
INSTALL(DIRECTORY include/git2 DESTINATION ${INSTALL_INC} )
117114
INSTALL(FILES include/git2.h DESTINATION ${INSTALL_INC} )
118115

119116
# Tests
120117
IF (BUILD_TESTS)
121-
SET(TEST_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
118+
SET(TEST_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
122119
ADD_DEFINITIONS(-DTEST_RESOURCES=\"${TEST_RESOURCES}\")
123-
124-
ENABLE_TESTING()
125-
INCLUDE_DIRECTORIES(tests)
126120
121+
INCLUDE_DIRECTORIES(tests)
127122
FILE(GLOB SRC_TEST tests/t??-*.c)
128123
129-
ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_PLAT} ${SRC_SHA1} ${SRC_TEST} ${SRC_ZLIB})
130-
TARGET_LINK_LIBRARIES(libgit2_test ${LIB_SHA1} ${CMAKE_THREAD_LIBS_INIT} ${SQLITE3_LIBRARIES})
124+
ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_TEST} ${SRC_ZLIB})
125+
TARGET_LINK_LIBRARIES(libgit2_test ${CMAKE_THREAD_LIBS_INIT})
126+
IF (WIN32)
127+
TARGET_LINK_LIBRARIES(libgit2_test ws2_32)
128+
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
129+
TARGET_LINK_LIBRARIES(libgit2_test socket nsl)
130+
ENDIF ()
131131
132+
ENABLE_TESTING()
132133
ADD_TEST(libgit2_test libgit2_test)
133134
ENDIF ()

vendor/libgit2/COPYING

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ patent must be licensed for everyone's free use or not licensed at all.
7171

7272
The precise terms and conditions for copying, distribution and
7373
modification follow.
74-
74+
7575
GNU GENERAL PUBLIC LICENSE
7676
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
7777

@@ -126,7 +126,7 @@ above, provided that you also meet all of these conditions:
126126
License. (Exception: if the Program itself is interactive but
127127
does not normally print such an announcement, your work based on
128128
the Program is not required to print an announcement.)
129-
129+
130130
These requirements apply to the modified work as a whole. If
131131
identifiable sections of that work are not derived from the Program,
132132
and can be reasonably considered independent and separate works in
@@ -184,7 +184,7 @@ access to copy from a designated place, then offering equivalent
184184
access to copy the source code from the same place counts as
185185
distribution of the source code, even though third parties are not
186186
compelled to copy the source along with the object code.
187-
187+
188188
4. You may not copy, modify, sublicense, or distribute the Program
189189
except as expressly provided under this License. Any attempt
190190
otherwise to copy, modify, sublicense or distribute the Program is
@@ -241,7 +241,7 @@ impose that choice.
241241

242242
This section is intended to make thoroughly clear what is believed to
243243
be a consequence of the rest of this License.
244-
244+
245245
8. If the distribution and/or use of the Program is restricted in
246246
certain countries either by patents or by copyrighted interfaces, the
247247
original copyright holder who places the Program under this License
@@ -294,7 +294,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
294294
POSSIBILITY OF SUCH DAMAGES.
295295

296296
END OF TERMS AND CONDITIONS
297-
297+
298298
How to Apply These Terms to Your New Programs
299299

300300
If you develop a new program, and you want it to be of the greatest

vendor/libgit2/Makefile.embed

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
rm=rm -f
2+
CC=cc
3+
AR=ar cq
4+
RANLIB=ranlib
5+
LIBNAME=libgit2.a
6+
7+
INCLUDES= -I. -Isrc -Iinclude -Ideps/zlib
8+
9+
DEFINES= $(INCLUDES) -DNO_VIZ -DSTDC -DNO_GZIP -D_FILE_OFFSET_BITS=64
10+
CFLAGS= -g $(DEFINES) -Wall -Wextra -fPIC -O2
11+
12+
SRCS = $(wildcard src/*.c) $(wildcard src/unix/*.c) $(wildcard deps/zlib/*.c)
13+
OBJS = $(patsubst %.c,%.o,$(SRCS))
14+
15+
%.c.o:
16+
$(CC) $(CFLAGS) -c $*.c
17+
18+
all: $(LIBNAME)
19+
20+
$(LIBNAME): $(OBJS)
21+
$(rm) $@
22+
$(AR) $@ $(OBJS)
23+
$(RANLIB) $@
24+
25+
clean:
26+
$(rm) $(OBJS) $(LIBNAME)

0 commit comments

Comments
 (0)