Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
2510268a
Unverified
Commit
2510268a
authored
Jul 14, 2018
by
Edward Thomson
Committed by
GitHub
Jul 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4700 from pks-t/pks/std-c90
C90 standard compliance
parents
6dfc8bc2
e1a4a8eb
Hide whitespace changes
Inline
Side-by-side
Showing
77 changed files
with
239 additions
and
200 deletions
+239
-200
CMakeLists.txt
+1
-1
examples/CMakeLists.txt
+4
-0
examples/general.c
+7
-5
examples/network/clone.c
+5
-5
examples/network/index-pack.c
+4
-2
examples/network/ls-remote.c
+1
-1
src/CMakeLists.txt
+21
-14
src/common.h
+3
-1
src/khash.h
+3
-1
src/notes.c
+1
-1
src/refspec.c
+1
-1
src/signature.c
+1
-1
src/streams/mbedtls.c
+11
-0
src/trailer.c
+6
-6
src/transports/smart.c
+3
-3
src/win32/posix_w32.c
+1
-1
src/xdiff/xdiffi.c
+3
-1
tests/CMakeLists.txt
+2
-0
tests/checkout/index.c
+1
-1
tests/checkout/tree.c
+1
-1
tests/cherrypick/workdir.c
+1
-1
tests/commit/parse.c
+29
-29
tests/commit/signature.c
+4
-4
tests/commit/write.c
+3
-3
tests/config/write.c
+2
-2
tests/core/filebuf.c
+1
-1
tests/core/futils.c
+1
-1
tests/core/vector.c
+2
-2
tests/date/rfc2822.c
+1
-1
tests/describe/t6120.c
+1
-1
tests/index/conflicts.c
+1
-1
tests/index/names.c
+1
-1
tests/index/nsec.c
+1
-1
tests/index/reuc.c
+1
-1
tests/index/stage.c
+1
-1
tests/merge/files.c
+1
-1
tests/merge/trees/automerge.c
+1
-1
tests/merge/trees/modeconflict.c
+1
-1
tests/merge/trees/renames.c
+1
-1
tests/merge/trees/trivial.c
+1
-1
tests/merge/trees/whitespace.c
+1
-1
tests/merge/workdir/analysis.c
+1
-1
tests/merge/workdir/renames.c
+1
-1
tests/merge/workdir/setup.c
+1
-1
tests/merge/workdir/simple.c
+1
-1
tests/merge/workdir/submodules.c
+1
-1
tests/merge/workdir/trivial.c
+1
-1
tests/network/refspecs.c
+3
-3
tests/object/lookupbypath.c
+1
-1
tests/object/message.c
+2
-2
tests/object/raw/write.c
+2
-2
tests/object/tag/list.c
+17
-15
tests/object/tag/read.c
+6
-6
tests/object/tag/write.c
+7
-7
tests/object/tree/read.c
+3
-3
tests/rebase/abort.c
+1
-1
tests/rebase/inmemory.c
+1
-1
tests/rebase/iterator.c
+1
-1
tests/rebase/merge.c
+1
-1
tests/rebase/setup.c
+1
-1
tests/rebase/submodule.c
+1
-1
tests/refs/delete.c
+2
-2
tests/refs/list.c
+1
-1
tests/refs/normalize.c
+6
-5
tests/refs/overwrite.c
+4
-4
tests/refs/read.c
+8
-8
tests/refs/reflog/reflog.c
+4
-4
tests/refs/rename.c
+10
-10
tests/refs/setter.c
+2
-2
tests/repo/discover.c
+1
-1
tests/revert/bare.c
+1
-1
tests/revert/workdir.c
+1
-1
tests/stash/apply.c
+2
-2
tests/status/status_data.h
+1
-1
tests/status/worktree.c
+2
-2
tests/threads/basic.c
+1
-1
tests/worktree/config.c
+4
-2
No files found.
CMakeLists.txt
View file @
2510268a
...
...
@@ -196,7 +196,7 @@ ELSE ()
ENABLE_WARNINGS
(
extra
)
IF
(
CMAKE_SYSTEM_NAME MATCHES
"(Solaris|SunOS)"
)
SET
(
CMAKE_C_FLAGS
"-
std=c99 -
D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
${
CMAKE_C_FLAGS
}
"
)
SET
(
CMAKE_C_FLAGS
"-D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
${
CMAKE_C_FLAGS
}
"
)
ENDIF
()
SET
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS_DEBUG
}
-D_DEBUG -O0"
)
...
...
examples/CMakeLists.txt
View file @
2510268a
INCLUDE_DIRECTORIES
(
${
LIBGIT2_INCLUDES
}
)
INCLUDE_DIRECTORIES
(
SYSTEM
${
LIBGIT2_SYSTEM_INCLUDES
}
)
FILE
(
GLOB_RECURSE SRC_EXAMPLE_GIT2 network/*.c network/*.h common.?
)
ADD_EXECUTABLE
(
cgit2
${
SRC_EXAMPLE_GIT2
}
)
SET_TARGET_PROPERTIES
(
cgit2 PROPERTIES C_STANDARD 90
)
IF
(
WIN32 OR ANDROID
)
TARGET_LINK_LIBRARIES
(
cgit2 git2
)
ELSE
()
...
...
@@ -14,5 +17,6 @@ FOREACH(src_app ${SRC_EXAMPLE_APPS})
IF
(
NOT
${
app_name
}
STREQUAL
"common"
)
ADD_EXECUTABLE
(
${
app_name
}
${
src_app
}
"common.c"
)
TARGET_LINK_LIBRARIES
(
${
app_name
}
git2
)
SET_TARGET_PROPERTIES
(
${
app_name
}
PROPERTIES C_STANDARD 90
)
ENDIF
()
ENDFOREACH
()
examples/general.c
View file @
2510268a
...
...
@@ -145,11 +145,13 @@ static void oid_parsing(git_oid *oid)
*/
git_oid_fromstr
(
oid
,
hex
);
// Once we've converted the string into the oid value, we can get the raw
// value of the SHA by accessing `oid.id`
// Next we will convert the 20 byte raw SHA1 value to a human readable 40
// char hex value.
/*
* Once we've converted the string into the oid value, we can get the raw
* value of the SHA by accessing `oid.id`
*
* Next we will convert the 20 byte raw SHA1 value to a human readable 40
* char hex value.
*/
printf
(
"
\n
*Raw to Hex*
\n
"
);
out
[
GIT_OID_HEXSZ
]
=
'\0'
;
...
...
examples/network/clone.c
View file @
2510268a
...
...
@@ -48,7 +48,7 @@ static void print_progress(const progress_data *pd)
static
int
sideband_progress
(
const
char
*
str
,
int
len
,
void
*
payload
)
{
(
void
)
payload
;
/
/ unused
(
void
)
payload
;
/
* unused */
printf
(
"remote: %.*s"
,
len
,
str
);
fflush
(
stdout
);
...
...
@@ -82,15 +82,15 @@ int do_clone(git_repository *repo, int argc, char **argv)
const
char
*
path
=
argv
[
2
];
int
error
;
(
void
)
repo
;
/
/ unused
(
void
)
repo
;
/
* unused */
/
/ Validate args
/
* Validate args */
if
(
argc
<
3
)
{
printf
(
"USAGE: %s <url> <path>
\n
"
,
argv
[
0
]);
return
-
1
;
}
/
/ Set up options
/
* Set up options */
checkout_opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
;
checkout_opts
.
progress_cb
=
checkout_progress
;
checkout_opts
.
progress_payload
=
&
pd
;
...
...
@@ -100,7 +100,7 @@ int do_clone(git_repository *repo, int argc, char **argv)
clone_opts
.
fetch_opts
.
callbacks
.
credentials
=
cred_acquire_cb
;
clone_opts
.
fetch_opts
.
callbacks
.
payload
=
&
pd
;
/
/ Do the clone
/
* Do the clone */
error
=
git_clone
(
&
cloned_repo
,
url
,
path
,
&
clone_opts
);
printf
(
"
\n
"
);
if
(
error
!=
0
)
{
...
...
examples/network/index-pack.c
View file @
2510268a
...
...
@@ -19,8 +19,10 @@
#endif
#include "common.h"
// This could be run in the main loop whilst the application waits for
// the indexing to finish in a worker thread
/*
* This could be run in the main loop whilst the application waits for
* the indexing to finish in a worker thread
*/
static
int
index_cb
(
const
git_transfer_progress
*
stats
,
void
*
data
)
{
(
void
)
data
;
...
...
examples/network/ls-remote.c
View file @
2510268a
...
...
@@ -12,7 +12,7 @@ static int use_remote(git_repository *repo, char *name)
size_t
refs_len
,
i
;
git_remote_callbacks
callbacks
=
GIT_REMOTE_CALLBACKS_INIT
;
/
/ Find the remote by name
/
* Find the remote by name */
error
=
git_remote_lookup
(
&
remote
,
repo
,
name
);
if
(
error
<
0
)
{
error
=
git_remote_create_anonymous
(
&
remote
,
repo
,
name
);
...
...
src/CMakeLists.txt
View file @
2510268a
...
...
@@ -16,6 +16,7 @@ SET(LIBGIT2_INCLUDES
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
"
${
libgit2_SOURCE_DIR
}
/src"
"
${
libgit2_SOURCE_DIR
}
/include"
)
SET
(
LIBGIT2_SYSTEM_INCLUDES
""
)
SET
(
LIBGIT2_LIBS
""
)
# Installation paths
...
...
@@ -94,7 +95,7 @@ ADD_FEATURE_INFO(threadsafe THREADSAFE "threadsafe support")
IF
(
WIN32 AND EMBED_SSH_PATH
)
FILE
(
GLOB SRC_SSH
"
${
EMBED_SSH_PATH
}
/src/*.c"
)
LIST
(
APPEND LIBGIT2_INCLUDES
"
${
EMBED_SSH_PATH
}
/include"
)
LIST
(
APPEND LIBGIT2_
SYSTEM_
INCLUDES
"
${
EMBED_SSH_PATH
}
/include"
)
FILE
(
WRITE
"
${
EMBED_SSH_PATH
}
/src/libssh2_config.h"
"#define HAVE_WINCNG
\n
#define LIBSSH2_WINCNG
\n
#include
\"
../win32/libssh2_config.h
\"
"
)
SET
(
GIT_SSH 1
)
ENDIF
()
...
...
@@ -107,7 +108,7 @@ IF (WIN32 AND WINHTTP)
IF
(
MINGW
)
ADD_SUBDIRECTORY
(
"
${
libgit2_SOURCE_DIR
}
/deps/winhttp"
"
${
libgit2_BINARY_DIR
}
/deps/winhttp"
)
LIST
(
APPEND LIBGIT2_LIBS winhttp
)
LIST
(
APPEND LIBGIT2_INCLUDES
"
${
libgit2_SOURCE_DIR
}
/deps/winhttp"
)
LIST
(
APPEND LIBGIT2_
SYSTEM_
INCLUDES
"
${
libgit2_SOURCE_DIR
}
/deps/winhttp"
)
ELSE
()
LIST
(
APPEND LIBGIT2_LIBS
"winhttp"
)
LIST
(
APPEND LIBGIT2_PC_LIBS
"-lwinhttp"
)
...
...
@@ -121,7 +122,7 @@ ELSE ()
ENDIF
()
IF
(
CURL_FOUND
)
SET
(
GIT_CURL 1
)
LIST
(
APPEND LIBGIT2_INCLUDES
${
CURL_INCLUDE_DIRS
}
)
LIST
(
APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
CURL_INCLUDE_DIRS
}
)
LIST
(
APPEND LIBGIT2_LIBS
${
CURL_LIBRARIES
}
)
LIST
(
APPEND LIBGIT2_PC_LIBS
${
CURL_LDFLAGS
}
)
ENDIF
()
...
...
@@ -174,7 +175,7 @@ IF (USE_HTTPS)
ENDIF
()
SET
(
GIT_SECURE_TRANSPORT 1
)
LIST
(
APPEND LIBGIT2_INCLUDES
${
SECURITY_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
SECURITY_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_LIBS
${
COREFOUNDATION_LIBRARIES
}
${
SECURITY_LIBRARIES
}
)
LIST
(
APPEND LIBGIT2_PC_LIBS
${
COREFOUNDATION_LDFLAGS
}
${
SECURITY_LDFLAGS
}
)
ELSEIF
(
HTTPS_BACKEND STREQUAL
"OpenSSL"
)
...
...
@@ -183,7 +184,7 @@ IF (USE_HTTPS)
ENDIF
()
SET
(
GIT_OPENSSL 1
)
LIST
(
APPEND LIBGIT2_INCLUDES
${
OPENSSL_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
OPENSSL_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_LIBS
${
OPENSSL_LIBRARIES
}
)
LIST
(
APPEND LIBGIT2_PC_LIBS
${
OPENSSL_LDFLAGS
}
)
LIST
(
APPEND LIBGIT2_PC_REQUIRES
"openssl"
)
...
...
@@ -230,7 +231,7 @@ IF (USE_HTTPS)
ENDIF
()
SET
(
GIT_MBEDTLS 1
)
LIST
(
APPEND LIBGIT2_INCLUDES
${
MBEDTLS_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
MBEDTLS_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_LIBS
${
MBEDTLS_LIBRARIES
}
)
# mbedTLS has no pkgconfig file, hence we can't require it
# https://github.com/ARMmbed/mbedtls/issues/228
...
...
@@ -285,7 +286,7 @@ ELSEIF (SHA1_BACKEND STREQUAL "mbedTLS")
ADD_FEATURE_INFO(SHA ON "
using mbedTLS
")
SET(GIT_SHA1_MBEDTLS 1)
FILE(GLOB SRC_SHA1 hash/hash_mbedtls.c)
LIST(APPEND LIBGIT2_INCLUDES
${
MBEDTLS_INCLUDE_DIR
}
)
LIST(APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
MBEDTLS_INCLUDE_DIR
}
)
LIST(APPEND LIBGIT2_LIBS
${
MBEDTLS_LIBRARIES
}
)
# mbedTLS has no pkgconfig file, hence we can't require it
# https://github.com/ARMmbed/mbedtls/issues/228
...
...
@@ -298,21 +299,21 @@ ENDIF()
# Include POSIX regex when it is required
IF(WIN32 OR AMIGA OR CMAKE_SYSTEM_NAME MATCHES "
(
Solaris|SunOS
)
")
ADD_SUBDIRECTORY("
${
libgit2_SOURCE_DIR
}
/deps/regex
" "
${
libgit2_BINARY_DIR
}
/deps/regex
")
LIST(APPEND LIBGIT2_INCLUDES "
${
libgit2_SOURCE_DIR
}
/deps/regex
")
LIST(APPEND LIBGIT2_
SYSTEM_
INCLUDES "
${
libgit2_SOURCE_DIR
}
/deps/regex
")
LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:regex>)
ENDIF()
# Optional external dependency: http-parser
FIND_PACKAGE(HTTP_Parser)
IF (USE_EXT_HTTP_PARSER AND HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
LIST(APPEND LIBGIT2_INCLUDES
${
HTTP_PARSER_INCLUDE_DIRS
}
)
LIST(APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
HTTP_PARSER_INCLUDE_DIRS
}
)
LIST(APPEND LIBGIT2_LIBS
${
HTTP_PARSER_LIBRARIES
}
)
LIST(APPEND LIBGIT2_PC_LIBS "
-lhttp_parser
")
ADD_FEATURE_INFO(http-parser ON "
http-parser support
")
ELSE()
MESSAGE(STATUS "
http-parser version 2 was not found or disabled; using bundled 3rd-party sources.
")
ADD_SUBDIRECTORY("
${
libgit2_SOURCE_DIR
}
/deps/http-parser
" "
${
libgit2_BINARY_DIR
}
/deps/http-parser
")
LIST(APPEND LIBGIT2_INCLUDES "
${
libgit2_SOURCE_DIR
}
/deps/http-parser
")
LIST(APPEND LIBGIT2_
SYSTEM_
INCLUDES "
${
libgit2_SOURCE_DIR
}
/deps/http-parser
")
LIST(APPEND LIBGIT2_OBJECTS "
$<TARGET_OBJECTS:http-parser>
")
ADD_FEATURE_INFO(http-parser ON "
http-parser
support
(
bundled
)
")
ENDIF()
...
...
@@ -321,7 +322,7 @@ ENDIF()
IF(NOT USE_BUNDLED_ZLIB)
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
LIST(APPEND LIBGIT2_INCLUDES
${
ZLIB_INCLUDE_DIRS
}
)
LIST(APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
ZLIB_INCLUDE_DIRS
}
)
LIST(APPEND LIBGIT2_LIBS
${
ZLIB_LIBRARIES
}
)
IF(APPLE OR CMAKE_SYSTEM_NAME MATCHES "
FreeBSD
")
LIST(APPEND LIBGIT2_LIBS "
z
")
...
...
@@ -336,7 +337,7 @@ IF(NOT USE_BUNDLED_ZLIB)
ENDIF()
IF(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND)
ADD_SUBDIRECTORY("
${
libgit2_SOURCE_DIR
}
/deps/zlib
" "
${
libgit2_BINARY_DIR
}
/deps/zlib
")
LIST(APPEND LIBGIT2_INCLUDES "
${
libgit2_SOURCE_DIR
}
/deps/zlib
")
LIST(APPEND LIBGIT2_
SYSTEM_
INCLUDES "
${
libgit2_SOURCE_DIR
}
/deps/zlib
")
LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>)
ADD_FEATURE_INFO(zlib ON "
using bundled zlib
")
ENDIF()
...
...
@@ -347,7 +348,7 @@ IF (USE_SSH)
ENDIF()
IF (LIBSSH2_FOUND)
SET(GIT_SSH 1)
LIST(APPEND LIBGIT2_INCLUDES
${
LIBSSH2_INCLUDE_DIRS
}
)
LIST(APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
LIBSSH2_INCLUDE_DIRS
}
)
LIST(APPEND LIBGIT2_LIBS
${
LIBSSH2_LIBRARIES
}
)
LIST(APPEND LIBGIT2_PC_LIBS
${
LIBSSH2_LDFLAGS
}
)
...
...
@@ -376,7 +377,7 @@ IF (USE_ICONV)
ENDIF()
IF (ICONV_FOUND)
SET(GIT_USE_ICONV 1)
LIST(APPEND LIBGIT2_INCLUDES
${
ICONV_INCLUDE_DIR
}
)
LIST(APPEND LIBGIT2_
SYSTEM_
INCLUDES
${
ICONV_INCLUDE_DIR
}
)
LIST(APPEND LIBGIT2_LIBS
${
ICONV_LIBRARIES
}
)
LIST(APPEND LIBGIT2_PC_LIBS
${
ICONV_LIBRARIES
}
)
ENDIF()
...
...
@@ -449,19 +450,24 @@ CONFIGURE_FILE(features.h.in git2/sys/features.h)
SET(LIBGIT2_SOURCES
${
SRC_H
}
${
SRC_GIT2
}
${
SRC_OS
}
${
SRC_SSH
}
${
SRC_SHA1
}
)
ADD_LIBRARY(git2internal OBJECT
${
LIBGIT2_SOURCES
}
)
SET_TARGET_PROPERTIES(git2internal PROPERTIES C_STANDARD 90)
IDE_SPLIT_SOURCES(git2internal)
LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:git2internal>)
IF (
${
CMAKE_VERSION
}
VERSION_LESS 2.8.12)
INCLUDE_DIRECTORIES(
${
LIBGIT2_INCLUDES
}
)
INCLUDE_DIRECTORIES(SYSTEM
${
LIBGIT2_SYSTEM_INCLUDES
}
)
ELSE()
TARGET_INCLUDE_DIRECTORIES(git2internal
PRIVATE
${
LIBGIT2_INCLUDES
}
PUBLIC
${
libgit2_SOURCE_DIR
}
/include)
TARGET_INCLUDE_DIRECTORIES(git2internal
SYSTEM PRIVATE
${
LIBGIT2_SYSTEM_INCLUDES
}
)
ENDIF()
SET(LIBGIT2_OBJECTS
${
LIBGIT2_OBJECTS
}
PARENT_SCOPE)
SET(LIBGIT2_INCLUDES
${
LIBGIT2_INCLUDES
}
PARENT_SCOPE)
SET(LIBGIT2_SYSTEM_INCLUDES
${
LIBGIT2_SYSTEM_INCLUDES
}
PARENT_SCOPE)
SET(LIBGIT2_LIBS
${
LIBGIT2_LIBS
}
PARENT_SCOPE)
IF(XCODE_VERSION)
...
...
@@ -475,6 +481,7 @@ ENDIF()
ADD_LIBRARY(git2
${
WIN_RC
}
${
LIBGIT2_OBJECTS
}
)
TARGET_LINK_LIBRARIES(git2
${
LIBGIT2_LIBS
}
)
SET_TARGET_PROPERTIES(git2 PROPERTIES C_STANDARD 90)
SET_TARGET_PROPERTIES(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
libgit2_BINARY_DIR
}
)
SET_TARGET_PROPERTIES(git2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
libgit2_BINARY_DIR
}
)
SET_TARGET_PROPERTIES(git2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY
${
libgit2_BINARY_DIR
}
)
...
...
src/common.h
View file @
2510268a
...
...
@@ -17,8 +17,10 @@
/** Declare a function as always inlined. */
#if defined(_MSC_VER)
# define GIT_INLINE(type) static __inline type
#elif defined(__GNUC__)
# define GIT_INLINE(type) static __inline__ type
#else
# define GIT_INLINE(type) static
inline
type
# define GIT_INLINE(type) static type
#endif
/** Support for gcc/clang __has_builtin intrinsic */
...
...
src/khash.h
View file @
2510268a
...
...
@@ -146,8 +146,10 @@ typedef unsigned long long khint64_t;
#ifndef kh_inline
#ifdef _MSC_VER
#define kh_inline __inline
#elif defined(__GNUC__)
#define kh_inline __inline__
#else
#define kh_inline
inline
#define kh_inline
#endif
#endif
/* kh_inline */
...
...
src/notes.c
View file @
2510268a
...
...
@@ -285,7 +285,7 @@ static int note_write(
git_oid
oid
;
git_tree
*
tree
=
NULL
;
/
/ TODO: should we apply filters?
/
* TODO: should we apply filters? */
/* create note object */
if
((
error
=
git_blob_create_frombuffer
(
&
oid
,
repo
,
note
,
strlen
(
note
)))
<
0
)
goto
cleanup
;
...
...
src/refspec.c
View file @
2510268a
...
...
@@ -16,7 +16,7 @@
int
git_refspec__parse
(
git_refspec
*
refspec
,
const
char
*
input
,
bool
is_fetch
)
{
/
/ Ported from https://github.com/git/git/blob/f06d47e7e0d9db709ee204ed13a8a7486149f494/remote.c#L518-636
/
* Ported from https://github.com/git/git/blob/f06d47e7e0d9db709ee204ed13a8a7486149f494/remote.c#L518-636 */
size_t
llen
;
int
is_glob
=
0
;
...
...
src/signature.c
View file @
2510268a
...
...
@@ -247,7 +247,7 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
if
((
tz_start
[
0
]
!=
'-'
&&
tz_start
[
0
]
!=
'+'
)
||
git__strtol32
(
&
offset
,
tz_start
+
1
,
&
tz_end
,
10
)
<
0
)
{
/
/malformed timezone, just assume it's zero
/
* malformed timezone, just assume it's zero */
offset
=
0
;
}
...
...
src/streams/mbedtls.c
View file @
2510268a
...
...
@@ -26,12 +26,23 @@
#define GIT_DEFAULT_CERT_LOCATION NULL
#endif
/* Work around C90-conformance issues */
#if defined(_MSC_VER)
# define inline __inline
#elif defined(__GNUC__)
# define inline __inline__
#else
# define inline
#endif
#include <mbedtls/config.h>
#include <mbedtls/ssl.h>
#include <mbedtls/error.h>
#include <mbedtls/entropy.h>
#include <mbedtls/ctr_drbg.h>
#undef inline
mbedtls_ssl_config
*
git__ssl_conf
;
mbedtls_entropy_context
*
mbedtls_entropy
;
...
...
src/trailer.c
View file @
2510268a
...
...
@@ -36,7 +36,7 @@ static const char *next_line(const char *str)
if
(
nl
)
{
return
nl
+
1
;
}
else
{
/
/ return pointer to the NUL terminator:
/
* return pointer to the NUL terminator: */
return
str
+
strlen
(
str
);
}
}
...
...
@@ -310,12 +310,12 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
}
if
(
isalnum
(
*
ptr
)
||
*
ptr
==
'-'
)
{
/
/ legal key character
/
* legal key character */
NEXT
(
S_KEY
);
}
if
(
*
ptr
==
' '
||
*
ptr
==
'\t'
)
{
/
/ optional whitespace before separator
/
* optional whitespace before separator */
*
ptr
=
0
;
NEXT
(
S_KEY_WS
);
}
...
...
@@ -325,7 +325,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
NEXT
(
S_SEP_WS
);
}
/
/ illegal character
/
* illegal character */
GOTO
(
S_IGNORE
);
}
case
S_KEY_WS
:
{
...
...
@@ -341,7 +341,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
NEXT
(
S_SEP_WS
);
}
/
/ illegal character
/
* illegal character */
GOTO
(
S_IGNORE
);
}
case
S_SEP_WS
:
{
...
...
@@ -369,7 +369,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
}
case
S_VALUE_NL
:
{
if
(
*
ptr
==
' '
)
{
/
/ continuation;
/
* continuation; */
NEXT
(
S_VALUE
);
}
...
...
src/transports/smart.c
View file @
2510268a
...
...
@@ -82,7 +82,7 @@ static bool is_malformed_http_header(const char *http_header)
const
char
*
c
;
int
name_len
;
/
/ Disallow \r and \n
/
* Disallow \r and \n */
c
=
strchr
(
http_header
,
'\r'
);
if
(
c
)
return
true
;
...
...
@@ -90,7 +90,7 @@ static bool is_malformed_http_header(const char *http_header)
if
(
c
)
return
true
;
/
/ Require a header name followed by :
/
* Require a header name followed by : */
name_len
=
http_header_name_length
(
http_header
);
if
(
name_len
<
1
)
return
true
;
...
...
@@ -112,7 +112,7 @@ static bool is_forbidden_custom_header(const char *custom_header)
unsigned
long
i
;
int
name_len
=
http_header_name_length
(
custom_header
);
/
/ Disallow headers that we set
/
* Disallow headers that we set */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
forbidden_custom_headers
);
i
++
)
if
(
strncmp
(
forbidden_custom_headers
[
i
],
custom_header
,
name_len
)
==
0
)
return
true
;
...
...
src/win32/posix_w32.c
View file @
2510268a
...
...
@@ -832,7 +832,7 @@ int p_mkstemp(char *tmp_path)
return
-
1
;
#endif
return
p_open
(
tmp_path
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0744
);
/
/-V536
return
p_open
(
tmp_path
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0744
);
/
* -V536 */
}
int
p_access
(
const
char
*
path
,
mode_t
mode
)
...
...
src/xdiff/xdiffi.c
View file @
2510268a
...
...
@@ -33,8 +33,10 @@
/** Declare a function as always inlined. */
#if defined(_MSC_VER)
# define XDL_INLINE(type) static __inline type
#elif defined(__GNUC__)
# define XDL_INLINE(type) static __inline__ type
#else
#
define XDL_INLINE(type) static inline
type
#
define XDG_INLINE(type) static
type
#endif
typedef
struct
s_xdpsplit
{
...
...
tests/CMakeLists.txt
View file @
2510268a
...
...
@@ -32,9 +32,11 @@ SET_SOURCE_FILES_PROPERTIES(
PROPERTIES OBJECT_DEPENDS
${
CMAKE_CURRENT_BINARY_DIR
}
/clar.suite)
INCLUDE_DIRECTORIES(
${
LIBGIT2_INCLUDES
}
)
INCLUDE_DIRECTORIES(SYSTEM
${
LIBGIT2_SYSTEM_INCLUDES
}
)
ADD_EXECUTABLE(libgit2_clar
${
SRC_CLAR
}
${
SRC_TEST
}
${
LIBGIT2_OBJECTS
}
)
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES C_STANDARD 90)
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
libgit2_BINARY_DIR
}
)
IF (
${
CMAKE_VERSION
}
VERSION_LESS 2.8.12)
...
...
tests/checkout/index.c
View file @
2510268a
...
...
@@ -146,7 +146,7 @@ void test_checkout_index__honor_coresymlinks_default(void)
const
char
*
url
=
git_repository_path
(
g_repo
);
cl_assert
(
getcwd
(
cwd
,
sizeof
(
cwd
))
!=
NULL
);
cl_assert_equal_i
(
0
,
p_mkdir
(
"readonly"
,
0555
));
/
/ Read-only directory
cl_assert_equal_i
(
0
,
p_mkdir
(
"readonly"
,
0555
));
/
* Read-only directory */
cl_assert_equal_i
(
0
,
chdir
(
"readonly"
));
cl_git_pass
(
git_repository_init
(
&
repo
,
"../symlink.git"
,
true
));
cl_assert_equal_i
(
0
,
chdir
(
cwd
));
...
...
tests/checkout/tree.c
View file @
2510268a
...
...
@@ -915,7 +915,7 @@ void test_checkout_tree__target_directory_from_bare(void)
void
test_checkout_tree__extremely_long_file_name
(
void
)
{
/
/ A utf-8 string with 83 characters, but 249 bytes.
/
* A utf-8 string with 83 characters, but 249 bytes. */
const
char
*
longname
=
"
\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97
"
;
char
path
[
1024
];
...
...
tests/cherrypick/workdir.c
View file @
2510268a
...
...
@@ -12,7 +12,7 @@
static
git_repository
*
repo
;
static
git_index
*
repo_index
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_cherrypick_workdir__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/commit/parse.c
View file @
2510268a
...
...
@@ -3,7 +3,7 @@
#include "commit.h"
#include "signature.h"
/
/ Fixture setup
/
* Fixture setup */
static
git_repository
*
g_repo
;
void
test_commit_parse__initialize
(
void
)
{
...
...
@@ -15,7 +15,7 @@ void test_commit_parse__cleanup(void)
}
/
/ Header parsing
/
* Header parsing */
typedef
struct
{
const
char
*
line
;
const
char
*
header
;
...
...
@@ -70,7 +70,7 @@ void test_commit_parse__header(void)
}
/
/ Signature parsing
/
* Signature parsing */
typedef
struct
{
const
char
*
string
;
const
char
*
header
;
...
...
@@ -89,27 +89,27 @@ passing_signature_test_case passing_signature_cases[] = {
{
"committer Vicent Marti <tanoku@gmail.com> 123456 +0000
\n
"
,
"committer "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
123456
,
0
},
{
"committer Vicent Marti <tanoku@gmail.com> 123456 +0100
\n
"
,
"committer "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
123456
,
60
},
{
"committer Vicent Marti <tanoku@gmail.com> 123456 -0100
\n
"
,
"committer "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
123456
,
-
60
},
/
/ Parse a signature without an author field
/
* Parse a signature without an author field */
{
"committer <tanoku@gmail.com> 123456 -0100
\n
"
,
"committer "
,
""
,
"tanoku@gmail.com"
,
123456
,
-
60
},
/
/ Parse a signature without an author field
/
* Parse a signature without an author field */
{
"committer <tanoku@gmail.com> 123456 -0100
\n
"
,
"committer "
,
""
,
"tanoku@gmail.com"
,
123456
,
-
60
},
/
/ Parse a signature with an empty author field
/
* Parse a signature with an empty author field */
{
"committer <tanoku@gmail.com> 123456 -0100
\n
"
,
"committer "
,
""
,
"tanoku@gmail.com"
,
123456
,
-
60
},
/
/ Parse a signature with an empty email field
/
* Parse a signature with an empty email field */
{
"committer Vicent Marti <> 123456 -0100
\n
"
,
"committer "
,
"Vicent Marti"
,
""
,
123456
,
-
60
},
/
/ Parse a signature with an empty email field
/
* Parse a signature with an empty email field */
{
"committer Vicent Marti < > 123456 -0100
\n
"
,
"committer "
,
"Vicent Marti"
,
""
,
123456
,
-
60
},
/
/ Parse a signature with empty name and email
/
* Parse a signature with empty name and email */
{
"committer <> 123456 -0100
\n
"
,
"committer "
,
""
,
""
,
123456
,
-
60
},
/
/ Parse a signature with empty name and email
/
* Parse a signature with empty name and email */
{
"committer <> 123456 -0100
\n
"
,
"committer "
,
""
,
""
,
123456
,
-
60
},
/
/ Parse a signature with empty name and email
/
* Parse a signature with empty name and email */
{
"committer < > 123456 -0100
\n
"
,
"committer "
,
""
,
""
,
123456
,
-
60
},
/
/ Parse an obviously invalid signature
/
* Parse an obviously invalid signature */
{
"committer foo<@bar> 123456 -0100
\n
"
,
"committer "
,
"foo"
,
"@bar"
,
123456
,
-
60
},
/
/ Parse an obviously invalid signature
/
* Parse an obviously invalid signature */
{
"committer foo<@bar> 123456 -0100
\n
"
,
"committer "
,
"foo"
,
"@bar"
,
123456
,
-
60
},
/
/ Parse an obviously invalid signature
/
* Parse an obviously invalid signature */
{
"committer <>
\n
"
,
"committer "
,
""
,
""
,
0
,
0
},
{
"committer Vicent Marti <tanoku@gmail.com> 123456 -1500
\n
"
,
"committer "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
123456
,
0
},
{
"committer Vicent Marti <tanoku@gmail.com> 123456 +0163
\n
"
,
"committer "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
123456
,
0
},
...
...
@@ -173,65 +173,65 @@ void test_commit_parse__signature(void)
static
char
*
failing_commit_cases
[]
=
{
/
/ empty commit
/
* empty commit */
""
,
/
/ random garbage
/
* random garbage */
"asd97sa9du902e9a0jdsuusad09as9du098709aweu8987sd
\n
"
,
/
/ broken endlines 1
/
* broken endlines 1 */
"tree f6c0dad3c7b3481caa9d73db21f91964894a945b
\r\n
\
parent 05452d6349abcd67aa396dfb28660d765d8b2a36
\r\n
\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\r\n
\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\r\n
\
\r\n
\
a test commit with broken endlines
\r\n
"
,
/
/ broken endlines 2
/
* broken endlines 2 */
"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\
parent 05452d6349abcd67aa396dfb28660d765d8b2a36\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\
\
another test commit with broken endlines"
,
/
/ starting endlines
/
* starting endlines */
"
\n
tree f6c0dad3c7b3481caa9d73db21f91964894a945b
\n
\
parent 05452d6349abcd67aa396dfb28660d765d8b2a36
\n
\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
\n
\
a test commit with a starting endline
\n
"
,
/
/ corrupted commit 1
/
* corrupted commit 1 */
"tree f6c0dad3c7b3481caa9d73db21f91964894a945b
\n
\
parent 05452d6349abcd67aa396df"
,
/
/ corrupted commit 2
/
* corrupted commit 2 */
"tree f6c0dad3c7b3481caa9d73db21f91964894a945b
\n
\
parent "
,
/
/ corrupted commit 3
/
* corrupted commit 3 */
"tree f6c0dad3c7b3481caa9d73db21f91964894a945b
\n
\
parent "
,
/
/ corrupted commit 4
/
* corrupted commit 4 */
"tree f6c0dad3c7b3481caa9d73db21f91964894a945b
\n
\
par"
,
};
static
char
*
passing_commit_cases
[]
=
{
/
/ simple commit with no message
/
* simple commit with no message */
"tree 1810dff58d8a660512d4832e740f692884338ccd
\n
\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
\n
"
,
/
/ simple commit, no parent
/
* simple commit, no parent */
"tree 1810dff58d8a660512d4832e740f692884338ccd
\n
\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
\n
\
a simple commit which works
\n
"
,
/
/ simple commit, no parent, no newline in message
/
* simple commit, no parent, no newline in message */
"tree 1810dff58d8a660512d4832e740f692884338ccd
\n
\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
\n
\
a simple commit which works"
,
/
/ simple commit, 1 parent
/
* simple commit, 1 parent */
"tree 1810dff58d8a660512d4832e740f692884338ccd
\n
\
parent e90810b8df3e80c413d903f631643c716887138d
\n
\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200
\n
\
...
...
@@ -317,7 +317,7 @@ void test_commit_parse__entire_commit(void)
}
/
/ query the details on a parsed commit
/
* query the details on a parsed commit */
void
test_commit_parse__details0
(
void
)
{
static
const
char
*
commit_ids
[]
=
{
"a4a7dce85cf63874e984719f4fdd239f5145052f"
,
/* 0 */
...
...
@@ -365,7 +365,7 @@ void test_commit_parse__details0(void) {
old_parent
=
parent
;
cl_git_pass
(
git_commit_parent
(
&
parent
,
commit
,
p
));
cl_assert
(
parent
!=
NULL
);
cl_assert
(
git_commit_author
(
parent
)
!=
NULL
);
/
/ is it really a commit?
cl_assert
(
git_commit_author
(
parent
)
!=
NULL
);
/
* is it really a commit? */
}
git_commit_free
(
old_parent
);
git_commit_free
(
parent
);
...
...
tests/commit/signature.c
View file @
2510268a
...
...
@@ -59,7 +59,7 @@ void test_commit_signature__angle_brackets_in_email_are_not_supported(void)
void
test_commit_signature__create_empties
(
void
)
{
// can not create a signature with empty name or email
/* can not create a signature with empty name or email */
cl_git_pass
(
try_build_signature
(
"nulltoken"
,
"emeric.fermas@gmail.com"
,
1234567890
,
60
));
cl_git_fail
(
try_build_signature
(
""
,
"emeric.fermas@gmail.com"
,
1234567890
,
60
));
...
...
@@ -70,19 +70,19 @@ void test_commit_signature__create_empties(void)
void
test_commit_signature__create_one_char
(
void
)
{
// creating a one character signature
/* creating a one character signature */
assert_name_and_email
(
"x"
,
"foo@bar.baz"
,
"x"
,
"foo@bar.baz"
);
}
void
test_commit_signature__create_two_char
(
void
)
{
// creating a two character signature
/* creating a two character signature */
assert_name_and_email
(
"xx"
,
"foo@bar.baz"
,
"xx"
,
"foo@bar.baz"
);
}
void
test_commit_signature__create_zero_char
(
void
)
{
// creating a zero character signature
/* creating a zero character signature */
git_signature
*
sign
;
cl_git_fail
(
git_signature_new
(
&
sign
,
""
,
"x@y.z"
,
1234567890
,
60
));
cl_assert
(
sign
==
NULL
);
...
...
tests/commit/write.c
View file @
2510268a
...
...
@@ -15,7 +15,7 @@ static char *head_old;
static
git_reference
*
head
,
*
branch
;
static
git_commit
*
commit
;
/
/ Fixture setup
/
* Fixture setup */
static
git_repository
*
g_repo
;
void
test_commit_write__initialize
(
void
)
{
...
...
@@ -42,7 +42,7 @@ void test_commit_write__cleanup(void)
}
/
/ write a new commit object from memory to disk
/
* write a new commit object from memory to disk */
void
test_commit_write__from_memory
(
void
)
{
git_oid
tree_id
,
parent_id
,
commit_id
;
...
...
@@ -137,7 +137,7 @@ This is a root commit\n\
git_signature_free
(
committer
);
}
/
/ create a root commit
/
* create a root commit */
void
test_commit_write__root
(
void
)
{
git_oid
tree_id
,
commit_id
;
...
...
tests/config/write.c
View file @
2510268a
...
...
@@ -365,7 +365,7 @@ void test_config_write__add_value_at_specific_level(void)
int64_t
l
,
expected
=
+
9223372036854775803
;
git_buf
buf
=
GIT_BUF_INIT
;
/
/ open config15 as global level config file
/
* open config15 as global level config file */
cl_git_pass
(
git_config_new
(
&
cfg
));
cl_git_pass
(
git_config_add_file_ondisk
(
cfg
,
"config9"
,
GIT_CONFIG_LEVEL_LOCAL
,
NULL
,
0
));
...
...
@@ -381,7 +381,7 @@ void test_config_write__add_value_at_specific_level(void)
git_config_free
(
cfg_specific
);
git_config_free
(
cfg
);
/
/ open config15 as local level config file
/
* open config15 as local level config file */
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config15"
));
cl_git_pass
(
git_config_get_int32
(
&
i
,
cfg
,
"core.int32global"
));
...
...
tests/core/filebuf.c
View file @
2510268a
...
...
@@ -8,7 +8,7 @@ void test_core_filebuf__0(void)
int
fd
;
char
test
[]
=
"test"
,
testlock
[]
=
"test.lock"
;
fd
=
p_creat
(
testlock
,
0744
);
/
/-V536
fd
=
p_creat
(
testlock
,
0744
);
/
* -V536 */
cl_must_pass
(
fd
);
cl_must_pass
(
p_close
(
fd
));
...
...
tests/core/futils.c
View file @
2510268a
#include "clar_libgit2.h"
#include "fileops.h"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_core_futils__initialize
(
void
)
{
cl_must_pass
(
p_mkdir
(
"futils"
,
0777
));
...
...
tests/core/vector.c
View file @
2510268a
...
...
@@ -18,13 +18,13 @@ void test_core_vector__0(void)
void
test_core_vector__1
(
void
)
{
git_vector
x
;
/
/ make initial capacity exact for our insertions.
/
* make initial capacity exact for our insertions. */
git_vector_init
(
&
x
,
3
,
NULL
);
git_vector_insert
(
&
x
,
(
void
*
)
0xabc
);
git_vector_insert
(
&
x
,
(
void
*
)
0xdef
);
git_vector_insert
(
&
x
,
(
void
*
)
0x123
);
git_vector_remove
(
&
x
,
0
);
/
/ used to read past array bounds.
git_vector_remove
(
&
x
,
0
);
/
* used to read past array bounds. */
git_vector_free
(
&
x
);
}
...
...
tests/date/rfc2822.c
View file @
2510268a
...
...
@@ -31,7 +31,7 @@ void test_date_rfc2822__format_rfc2822_negative_offset(void)
void
test_date_rfc2822__format_rfc2822_buffer_too_small
(
void
)
{
/
/ "Wed, 10 Apr 2014 08:21:03 +0000"
/
* "Wed, 10 Apr 2014 08:21:03 +0000" */
git_time
t
=
{
1397031663
+
86400
,
0
};
char
buf
[
GIT_DATE_RFC2822_SZ
-
1
];
...
...
tests/describe/t6120.c
View file @
2510268a
...
...
@@ -2,7 +2,7 @@
#include "describe_helpers.h"
#include "repository.h"
/
/ Ported from https://github.com/git/git/blob/adfc1857bdb090786fd9d22c1acec39371c76048/t/t6120-describe.sh
/
* Ported from https://github.com/git/git/blob/adfc1857bdb090786fd9d22c1acec39371c76048/t/t6120-describe.sh */
static
git_repository
*
repo
;
...
...
tests/index/conflicts.c
View file @
2510268a
...
...
@@ -9,7 +9,7 @@ static git_index *repo_index;
#define TEST_REPO_PATH "mergedrepo"
#define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_index_conflicts__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"mergedrepo"
);
...
...
tests/index/names.c
View file @
2510268a
...
...
@@ -10,7 +10,7 @@ static git_index *repo_index;
#define TEST_REPO_PATH "mergedrepo"
#define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_index_names__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"mergedrepo"
);
...
...
tests/index/nsec.c
View file @
2510268a
...
...
@@ -9,7 +9,7 @@ static git_index *repo_index;
#define TEST_REPO_PATH "nsecs"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_index_nsec__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"nsecs"
);
...
...
tests/index/reuc.c
View file @
2510268a
...
...
@@ -18,7 +18,7 @@ static git_index *repo_index;
#define TWO_OUR_OID "8f3c06cff9a83757cec40c80bc9bf31a2582bde9"
#define TWO_THEIR_OID "887b153b165d32409c70163e0f734c090f12f673"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_index_reuc__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"mergedrepo"
);
...
...
tests/index/stage.c
View file @
2510268a
...
...
@@ -8,7 +8,7 @@ static git_index *repo_index;
#define TEST_REPO_PATH "mergedrepo"
#define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_index_stage__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"mergedrepo"
);
...
...
tests/merge/files.c
View file @
2510268a
...
...
@@ -15,7 +15,7 @@
static
git_repository
*
repo
;
static
git_index
*
repo_index
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_files__initialize
(
void
)
{
git_config
*
cfg
;
...
...
tests/merge/trees/automerge.c
View file @
2510268a
...
...
@@ -55,7 +55,7 @@ static git_repository *repo;
"", \
"5c3b68a71fc4fa5d362fd3875e53137c6a5ab7a5" }
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_trees_automerge__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/merge/trees/modeconflict.c
View file @
2510268a
...
...
@@ -13,7 +13,7 @@ static git_repository *repo;
#define DF_SIDE1_BRANCH "df_side1"
#define DF_SIDE2_BRANCH "df_side2"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_trees_modeconflict__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/merge/trees/renames.c
View file @
2510268a
...
...
@@ -13,7 +13,7 @@ static git_repository *repo;
#define BRANCH_RENAME_OURS "rename_conflict_ours"
#define BRANCH_RENAME_THEIRS "rename_conflict_theirs"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_trees_renames__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/merge/trees/trivial.c
View file @
2510268a
...
...
@@ -13,7 +13,7 @@ static git_repository *repo;
#define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_trees_trivial__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/merge/trees/whitespace.c
View file @
2510268a
...
...
@@ -16,7 +16,7 @@ static git_repository *repo;
#define BRANCH_A_CHANGE "branch_a_change"
#define BRANCH_B_CHANGE "branch_b_change"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_trees_whitespace__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/merge/workdir/analysis.c
View file @
2510268a
...
...
@@ -24,7 +24,7 @@ static git_index *repo_index;
#define NOFASTFORWARD_ID "7cb63eed597130ba4abb87b3e544b85021905520"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_workdir_analysis__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/merge/workdir/renames.c
View file @
2510268a
...
...
@@ -14,7 +14,7 @@ static git_repository *repo;
#define BRANCH_RENAME_OURS "rename_conflict_ours"
#define BRANCH_RENAME_THEIRS "rename_conflict_theirs"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_workdir_renames__initialize
(
void
)
{
git_config
*
cfg
;
...
...
tests/merge/workdir/setup.c
View file @
2510268a
...
...
@@ -31,7 +31,7 @@ static git_index *repo_index;
#define OCTO5_BRANCH "octo5"
#define OCTO5_OID "e4f618a2c3ed0669308735727df5ebf2447f022f"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_workdir_setup__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/merge/workdir/simple.c
View file @
2510268a
...
...
@@ -73,7 +73,7 @@ static git_index *repo_index;
"5c3b68a71fc4fa5d362fd3875e53137c6a5ab7a5" }
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_workdir_simple__initialize
(
void
)
{
git_config
*
cfg
;
...
...
tests/merge/workdir/submodules.c
View file @
2510268a
...
...
@@ -16,7 +16,7 @@ static git_repository *repo;
#define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_workdir_submodules__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/merge/workdir/trivial.c
View file @
2510268a
...
...
@@ -14,7 +14,7 @@ static git_index *repo_index;
#define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_merge_workdir_trivial__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/network/refspecs.c
View file @
2510268a
...
...
@@ -18,7 +18,7 @@ static void assert_refspec(unsigned int direction, const char *input, bool is_ex
void
test_network_refspecs__parsing
(
void
)
{
/
/ Ported from https://github.com/git/git/blob/abd2bde78bd994166900290434a2048e660dabed/t/t5511-refspec.sh
/
* Ported from https://github.com/git/git/blob/abd2bde78bd994166900290434a2048e660dabed/t/t5511-refspec.sh */
assert_refspec
(
GIT_DIRECTION_PUSH
,
""
,
false
);
assert_refspec
(
GIT_DIRECTION_PUSH
,
":"
,
true
);
...
...
@@ -40,8 +40,8 @@ void test_network_refspecs__parsing(void)
* code. They will be caught downstream anyway, but we may want to
* have tighter check later...
*/
/
/assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/master::refs/remotes/frotz/xyzzy", false);
/
/assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/maste :refs/remotes/frotz/xyzzy", false);
/
*assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/master::refs/remotes/frotz/xyzzy", false); */
/
*assert_refspec(GIT_DIRECTION_PUSH, "refs/heads/maste :refs/remotes/frotz/xyzzy", false); */
assert_refspec
(
GIT_DIRECTION_FETCH
,
"refs/heads/*:refs/remotes/frotz/*"
,
true
);
assert_refspec
(
GIT_DIRECTION_FETCH
,
"refs/heads/*:refs/remotes/frotz"
,
false
);
...
...
tests/object/lookupbypath.c
View file @
2510268a
...
...
@@ -42,7 +42,7 @@ void test_object_lookupbypath__errors(void)
{
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_object_lookup_bypath
(
&
g_actualobject
,
(
git_object
*
)
g_root_tree
,
"subdir/subdir_test2.txt"
,
GIT_OBJ_TREE
));
/
/ It's not a tree
"subdir/subdir_test2.txt"
,
GIT_OBJ_TREE
));
/
* It's not a tree */
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_object_lookup_bypath
(
&
g_actualobject
,
(
git_object
*
)
g_root_tree
,
"file/doesnt/exist"
,
GIT_OBJ_ANY
));
...
...
tests/object/message.c
View file @
2510268a
...
...
@@ -14,8 +14,8 @@ static void assert_message_prettifying(char *expected_output, char *input, int s
#define t40 "A quick brown fox jumps over the lazy do"
#define s40 " "
#define sss s40 s40 s40 s40 s40 s40 s40 s40 s40 s40 /
/ # 400
#define ttt t40 t40 t40 t40 t40 t40 t40 t40 t40 t40 /
/ # 400
#define sss s40 s40 s40 s40 s40 s40 s40 s40 s40 s40
/
* # 400 */
#define ttt t40 t40 t40 t40 t40 t40 t40 t40 t40 t40
/
* # 400 */
/* Ported from git.git */
/* see https://github.com/git/git/blob/master/t/t0030-stripspace.sh */
...
...
tests/object/raw/write.c
View file @
2510268a
...
...
@@ -16,7 +16,7 @@ void test_body(object_data *d, git_rawobj *o);
/
/ Helpers
/
* Helpers */
static
void
remove_object_files
(
object_data
*
d
)
{
cl_git_pass
(
p_unlink
(
d
->
file
));
...
...
@@ -57,7 +57,7 @@ static void make_odb_dir(void)
}
/
/ Standard test form
/
* Standard test form */
void
test_body
(
object_data
*
d
,
git_rawobj
*
o
)
{
git_odb
*
db
;
...
...
tests/object/tag/list.c
View file @
2510268a
...
...
@@ -13,7 +13,7 @@ struct pattern_match_t
const
char
*
expected_results
[
MAX_USED_TAGS
];
};
/
/ Helpers
/
* Helpers */
static
void
ensure_tag_pattern_match
(
git_repository
*
repo
,
const
struct
pattern_match_t
*
data
)
{
...
...
@@ -34,7 +34,7 @@ static void ensure_tag_pattern_match(git_repository *repo,
goto
exit
;
}
/
/ we have to be prepared that tags come in any order.
/
* we have to be prepared that tags come in any order. */
for
(
i
=
0
;
i
<
tag_list
.
count
;
i
++
)
{
for
(
j
=
0
;
j
<
data
->
expected_matches
;
j
++
)
...
...
@@ -54,7 +54,7 @@ exit:
cl_git_pass
(
error
);
}
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_object_tag_list__initialize
(
void
)
{
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
...
...
@@ -67,7 +67,7 @@ void test_object_tag_list__cleanup(void)
void
test_object_tag_list__list_all
(
void
)
{
/
/ list all tag names from the repository
/
* list all tag names from the repository */
git_strarray
tag_list
;
cl_git_pass
(
git_tag_list
(
&
tag_list
,
g_repo
));
...
...
@@ -78,37 +78,39 @@ void test_object_tag_list__list_all(void)
}
static
const
struct
pattern_match_t
matches
[]
=
{
/
/ All tags, including a packed one and two namespaced ones.
/
* All tags, including a packed one and two namespaced ones. */
{
""
,
6
,
{
"e90810b"
,
"point_to_blob"
,
"test"
,
"packed-tag"
,
"foo/bar"
,
"foo/foo/bar"
}
},
/
/ beginning with
/
* beginning with */
{
"t*"
,
1
,
{
"test"
}
},
/
/ ending with
/
* ending with */
{
"*b"
,
2
,
{
"e90810b"
,
"point_to_blob"
}
},
/
/ exact match
/
* exact match */
{
"e"
,
0
},
{
"e90810b"
,
1
,
{
"e90810b"
}
},
/
/ either or
/
* either or */
{
"e90810[ab]"
,
1
,
{
"e90810b"
}
},
/
/ glob in the middle
/
* glob in the middle */
{
"foo/*/bar"
,
1
,
{
"foo/foo/bar"
}
},
// The matching of '*' is based on plain string matching analog to the regular expression ".*"
// => a '/' in the tag name has no special meaning.
// Compare to `git tag -l "*bar"`
/*
* The matching of '*' is based on plain string matching analog to the regular expression ".*"
* => a '/' in the tag name has no special meaning.
* Compare to `git tag -l "*bar"`
*/
{
"*bar"
,
2
,
{
"foo/bar"
,
"foo/foo/bar"
}
},
/
/ End of list
/
* End of list */
{
NULL
}
};
void
test_object_tag_list__list_by_pattern
(
void
)
{
/
/ list all tag names from the repository matching a specified pattern
/
* list all tag names from the repository matching a specified pattern */
size_t
i
=
0
;
while
(
matches
[
i
].
pattern
)
ensure_tag_pattern_match
(
g_repo
,
&
matches
[
i
++
]);
...
...
tests/object/tag/read.c
View file @
2510268a
...
...
@@ -13,7 +13,7 @@ static const char *taggerless = "4a23e2e65ad4e31c4c9db7dc746650bfad082679";
static
git_repository
*
g_repo
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_object_tag_read__initialize
(
void
)
{
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
...
...
@@ -27,7 +27,7 @@ void test_object_tag_read__cleanup(void)
void
test_object_tag_read__parse
(
void
)
{
/
/ read and parse a tag from the repository
/
* read and parse a tag from the repository */
git_tag
*
tag1
,
*
tag2
;
git_commit
*
commit
;
git_oid
id1
,
id2
,
id_commit
;
...
...
@@ -58,13 +58,13 @@ void test_object_tag_read__parse(void)
void
test_object_tag_read__parse_without_tagger
(
void
)
{
/
/ read and parse a tag without a tagger field
/
* read and parse a tag without a tagger field */
git_repository
*
bad_tag_repo
;
git_tag
*
bad_tag
;
git_commit
*
commit
;
git_oid
id
,
id_commit
;
/
/ TODO: This is a little messy
/
* TODO: This is a little messy */
cl_git_pass
(
git_repository_open
(
&
bad_tag_repo
,
cl_fixture
(
"bad_tag.git"
)));
git_oid_fromstr
(
&
id
,
bad_tag_id
);
...
...
@@ -90,13 +90,13 @@ void test_object_tag_read__parse_without_tagger(void)
void
test_object_tag_read__parse_without_message
(
void
)
{
/
/ read and parse a tag without a message field
/
* read and parse a tag without a message field */
git_repository
*
short_tag_repo
;
git_tag
*
short_tag
;
git_commit
*
commit
;
git_oid
id
,
id_commit
;
/
/ TODO: This is a little messy
/
* TODO: This is a little messy */
cl_git_pass
(
git_repository_open
(
&
short_tag_repo
,
cl_fixture
(
"short_tag.git"
)));
git_oid_fromstr
(
&
id
,
short_tag_id
);
...
...
tests/object/tag/write.c
View file @
2510268a
...
...
@@ -9,7 +9,7 @@ static const char *tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
static
git_repository
*
g_repo
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_object_tag_write__initialize
(
void
)
{
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
...
...
@@ -22,7 +22,7 @@ void test_object_tag_write__cleanup(void)
void
test_object_tag_write__basic
(
void
)
{
// write a tag to the repository and read it again
/* write a tag to the repository and read it again */
git_tag
*
tag
;
git_oid
target_id
,
tag_id
;
git_signature
*
tagger
;
...
...
@@ -67,7 +67,7 @@ void test_object_tag_write__basic(void)
void
test_object_tag_write__overwrite
(
void
)
{
// Attempt to write a tag bearing the same name than an already existing tag
/* Attempt to write a tag bearing the same name than an already existing tag */
git_oid
target_id
,
tag_id
;
git_signature
*
tagger
;
git_object
*
target
;
...
...
@@ -93,7 +93,7 @@ void test_object_tag_write__overwrite(void)
void
test_object_tag_write__replace
(
void
)
{
// Replace an already existing tag
/* Replace an already existing tag */
git_oid
target_id
,
tag_id
,
old_tag_id
;
git_signature
*
tagger
;
git_reference
*
ref_tag
;
...
...
@@ -130,7 +130,7 @@ void test_object_tag_write__replace(void)
void
test_object_tag_write__lightweight
(
void
)
{
// write a lightweight tag to the repository and read it again
/* write a lightweight tag to the repository and read it again */
git_oid
target_id
,
object_id
;
git_reference
*
ref_tag
;
git_object
*
target
;
...
...
@@ -159,7 +159,7 @@ void test_object_tag_write__lightweight(void)
void
test_object_tag_write__lightweight_over_existing
(
void
)
{
// Attempt to write a lightweight tag bearing the same name than an already existing tag
/* Attempt to write a lightweight tag bearing the same name than an already existing tag */
git_oid
target_id
,
object_id
,
existing_object_id
;
git_object
*
target
;
...
...
@@ -181,7 +181,7 @@ void test_object_tag_write__lightweight_over_existing(void)
void
test_object_tag_write__delete
(
void
)
{
// Delete an already existing tag
/* Delete an already existing tag */
git_reference
*
ref_tag
;
cl_git_pass
(
git_tag_delete
(
g_repo
,
"e90810b"
));
...
...
tests/object/tree/read.c
View file @
2510268a
...
...
@@ -6,7 +6,7 @@ static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
static
git_repository
*
g_repo
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_object_tree_read__initialize
(
void
)
{
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
...
...
@@ -21,7 +21,7 @@ void test_object_tree_read__cleanup(void)
void
test_object_tree_read__loaded
(
void
)
{
// acces randomly the entries on a loaded tree
/* acces randomly the entries on a loaded tree */
git_oid
id
;
git_tree
*
tree
;
...
...
@@ -42,7 +42,7 @@ void test_object_tree_read__loaded(void)
void
test_object_tree_read__two
(
void
)
{
// read a tree from the repository
/* read a tree from the repository */
git_oid
id
;
git_tree
*
tree
;
const
git_tree_entry
*
entry
;
...
...
tests/rebase/abort.c
View file @
2510268a
...
...
@@ -8,7 +8,7 @@
static
git_repository
*
repo
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_rebase_abort__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"rebase"
);
...
...
tests/rebase/inmemory.c
View file @
2510268a
...
...
@@ -7,7 +7,7 @@
static
git_repository
*
repo
;
static
git_signature
*
signature
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_rebase_inmemory__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"rebase"
);
...
...
tests/rebase/iterator.c
View file @
2510268a
...
...
@@ -8,7 +8,7 @@ static git_repository *repo;
static
git_index
*
_index
;
static
git_signature
*
signature
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_rebase_iterator__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"rebase"
);
...
...
tests/rebase/merge.c
View file @
2510268a
...
...
@@ -19,7 +19,7 @@ static void set_core_autocrlf_to(git_repository *repo, bool value)
git_config_free
(
cfg
);
}
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_rebase_merge__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"rebase"
);
...
...
tests/rebase/setup.c
View file @
2510268a
...
...
@@ -8,7 +8,7 @@ static git_repository *repo;
static
git_index
*
_index
;
static
git_signature
*
signature
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_rebase_setup__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"rebase"
);
...
...
tests/rebase/submodule.c
View file @
2510268a
...
...
@@ -10,7 +10,7 @@
static
git_repository
*
repo
;
static
git_signature
*
signature
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_rebase_submodule__initialize
(
void
)
{
git_index
*
index
;
...
...
tests/refs/delete.c
View file @
2510268a
...
...
@@ -27,7 +27,7 @@ void test_refs_delete__cleanup(void)
void
test_refs_delete__packed_loose
(
void
)
{
// deleting a ref which is both packed and loose should remove both tracks in the filesystem
/* deleting a ref which is both packed and loose should remove both tracks in the filesystem */
git_reference
*
looked_up_ref
,
*
another_looked_up_ref
;
git_buf
temp_path
=
GIT_BUF_INIT
;
...
...
@@ -57,7 +57,7 @@ void test_refs_delete__packed_loose(void)
void
test_refs_delete__packed_only
(
void
)
{
// can delete a just packed reference
/* can delete a just packed reference */
git_reference
*
ref
;
git_refdb
*
refdb
;
git_oid
id
;
...
...
tests/refs/list.c
View file @
2510268a
...
...
@@ -22,7 +22,7 @@ void test_refs_list__cleanup(void)
void
test_refs_list__all
(
void
)
{
// try to list all the references in our test repo
/* try to list all the references in our test repo */
git_strarray
ref_list
;
cl_git_pass
(
git_reference_list
(
&
ref_list
,
g_repo
));
...
...
tests/refs/normalize.c
View file @
2510268a
...
...
@@ -4,7 +4,7 @@
#include "git2/reflog.h"
#include "reflog.h"
/
/ Helpers
/
* Helpers */
static
void
ensure_refname_normalized
(
unsigned
int
flags
,
const
char
*
input_refname
,
...
...
@@ -149,7 +149,7 @@ void test_refs_normalize__symbolic(void)
void
test_refs_normalize__jgit_suite
(
void
)
{
/
/ tests borrowed from JGit
/
* tests borrowed from JGit */
/* EmptyString */
ensure_refname_invalid
(
...
...
@@ -316,9 +316,10 @@ void test_refs_normalize__jgit_suite(void)
ensure_refname_normalized
(
GIT_REF_FORMAT_ALLOW_ONELEVEL
,
"refs/heads/}"
,
"refs/heads/}"
);
// This is valid on UNIX, but not on Windows
// hence we make in invalid due to non-portability
//
/*
* This is valid on UNIX, but not on Windows
* hence we make in invalid due to non-portability
*/
ensure_refname_invalid
(
GIT_REF_FORMAT_ALLOW_ONELEVEL
,
"refs/heads/
\\
"
);
...
...
tests/refs/overwrite.c
View file @
2510268a
...
...
@@ -23,7 +23,7 @@ void test_refs_overwrite__cleanup(void)
void
test_refs_overwrite__symbolic
(
void
)
{
// Overwrite an existing symbolic reference
/* Overwrite an existing symbolic reference */
git_reference
*
ref
,
*
branch_ref
;
/* The target needds to exist and we need to check the name has changed */
...
...
@@ -53,7 +53,7 @@ void test_refs_overwrite__symbolic(void)
void
test_refs_overwrite__object_id
(
void
)
{
// Overwrite an existing object id reference
/* Overwrite an existing object id reference */
git_reference
*
ref
;
git_oid
id
;
...
...
@@ -85,7 +85,7 @@ void test_refs_overwrite__object_id(void)
void
test_refs_overwrite__object_id_with_symbolic
(
void
)
{
// Overwrite an existing object id reference with a symbolic one
/* Overwrite an existing object id reference with a symbolic one */
git_reference
*
ref
;
git_oid
id
;
...
...
@@ -110,7 +110,7 @@ void test_refs_overwrite__object_id_with_symbolic(void)
void
test_refs_overwrite__symbolic_with_object_id
(
void
)
{
// Overwrite an existing symbolic reference with an object id one
/* Overwrite an existing symbolic reference with an object id one */
git_reference
*
ref
;
git_oid
id
;
...
...
tests/refs/read.c
View file @
2510268a
...
...
@@ -28,7 +28,7 @@ void test_refs_read__cleanup(void)
void
test_refs_read__loose_tag
(
void
)
{
// lookup a loose tag reference
/* lookup a loose tag reference */
git_reference
*
reference
;
git_object
*
object
;
git_buf
ref_name_from_tag_name
=
GIT_BUF_INIT
;
...
...
@@ -54,7 +54,7 @@ void test_refs_read__loose_tag(void)
void
test_refs_read__nonexisting_tag
(
void
)
{
// lookup a loose tag reference that doesn't exist
/* lookup a loose tag reference that doesn't exist */
git_reference
*
reference
;
cl_git_fail
(
git_reference_lookup
(
&
reference
,
g_repo
,
non_existing_tag_ref_name
));
...
...
@@ -65,7 +65,7 @@ void test_refs_read__nonexisting_tag(void)
void
test_refs_read__symbolic
(
void
)
{
// lookup a symbolic reference
/* lookup a symbolic reference */
git_reference
*
reference
,
*
resolved_ref
;
git_object
*
object
;
git_oid
id
;
...
...
@@ -93,7 +93,7 @@ void test_refs_read__symbolic(void)
void
test_refs_read__nested_symbolic
(
void
)
{
// lookup a nested symbolic reference
/* lookup a nested symbolic reference */
git_reference
*
reference
,
*
resolved_ref
;
git_object
*
object
;
git_oid
id
;
...
...
@@ -121,7 +121,7 @@ void test_refs_read__nested_symbolic(void)
void
test_refs_read__head_then_master
(
void
)
{
// lookup the HEAD and resolve the master branch
/* lookup the HEAD and resolve the master branch */
git_reference
*
reference
,
*
resolved_ref
,
*
comp_base_ref
;
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
head_tracker_sym_ref_name
));
...
...
@@ -145,7 +145,7 @@ void test_refs_read__head_then_master(void)
void
test_refs_read__master_then_head
(
void
)
{
// lookup the master branch and then the HEAD
/* lookup the master branch and then the HEAD */
git_reference
*
reference
,
*
master_ref
,
*
resolved_ref
;
cl_git_pass
(
git_reference_lookup
(
&
master_ref
,
g_repo
,
current_head_target
));
...
...
@@ -162,7 +162,7 @@ void test_refs_read__master_then_head(void)
void
test_refs_read__packed
(
void
)
{
// lookup a packed reference
/* lookup a packed reference */
git_reference
*
reference
;
git_object
*
object
;
...
...
@@ -182,7 +182,7 @@ void test_refs_read__packed(void)
void
test_refs_read__loose_first
(
void
)
{
// assure that a loose reference is looked up before a packed reference
/* assure that a loose reference is looked up before a packed reference */
git_reference
*
reference
;
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
packed_head_name
));
...
...
tests/refs/reflog/reflog.c
View file @
2510268a
...
...
@@ -11,7 +11,7 @@ static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe454775
static
git_repository
*
g_repo
;
/
/ helpers
/
* helpers */
static
void
assert_signature
(
const
git_signature
*
expected
,
const
git_signature
*
actual
)
{
cl_assert
(
actual
);
...
...
@@ -22,15 +22,15 @@ static void assert_signature(const git_signature *expected, const git_signature
}
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_refs_reflog_reflog__initialize
(
void
)
{
g_repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
g_repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
}
void
test_refs_reflog_reflog__cleanup
(
void
)
{
cl_git_sandbox_cleanup
();
cl_git_sandbox_cleanup
();
}
static
void
assert_appends
(
const
git_signature
*
committer
,
const
git_oid
*
oid
)
...
...
tests/refs/rename.c
View file @
2510268a
...
...
@@ -34,7 +34,7 @@ void test_refs_rename__cleanup(void)
void
test_refs_rename__loose
(
void
)
{
/
/ rename a loose reference
/
* rename a loose reference */
git_reference
*
looked_up_ref
,
*
new_ref
,
*
another_looked_up_ref
;
git_buf
temp_path
=
GIT_BUF_INIT
;
const
char
*
new_name
=
"refs/tags/Nemo/knows/refs.kung-fu"
;
...
...
@@ -76,7 +76,7 @@ void test_refs_rename__loose(void)
void
test_refs_rename__packed
(
void
)
{
/
/ rename a packed reference (should make it loose)
/
* rename a packed reference (should make it loose) */
git_reference
*
looked_up_ref
,
*
new_ref
,
*
another_looked_up_ref
;
git_buf
temp_path
=
GIT_BUF_INIT
;
const
char
*
brand_new_name
=
"refs/heads/brand_new_name"
;
...
...
@@ -118,7 +118,7 @@ void test_refs_rename__packed(void)
void
test_refs_rename__packed_doesnt_pack_others
(
void
)
{
/
/ renaming a packed reference does not pack another reference which happens to be in both loose and pack state
/
* renaming a packed reference does not pack another reference which happens to be in both loose and pack state */
git_reference
*
looked_up_ref
,
*
another_looked_up_ref
,
*
renamed_ref
;
git_buf
temp_path
=
GIT_BUF_INIT
;
const
char
*
brand_new_name
=
"refs/heads/brand_new_name"
;
...
...
@@ -160,7 +160,7 @@ void test_refs_rename__packed_doesnt_pack_others(void)
void
test_refs_rename__name_collision
(
void
)
{
/
/ can not rename a reference with the name of an existing reference
/
* can not rename a reference with the name of an existing reference */
git_reference
*
looked_up_ref
,
*
renamed_ref
;
/* An existing reference... */
...
...
@@ -179,7 +179,7 @@ void test_refs_rename__name_collision(void)
void
test_refs_rename__invalid_name
(
void
)
{
/
/ can not rename a reference with an invalid name
/
* can not rename a reference with an invalid name */
git_reference
*
looked_up_ref
,
*
renamed_ref
;
/* An existing oid reference... */
...
...
@@ -205,7 +205,7 @@ void test_refs_rename__invalid_name(void)
void
test_refs_rename__force_loose_packed
(
void
)
{
/
/ can force-rename a packed reference with the name of an existing loose and packed reference
/
* can force-rename a packed reference with the name of an existing loose and packed reference */
git_reference
*
looked_up_ref
,
*
renamed_ref
;
git_oid
oid
;
...
...
@@ -230,7 +230,7 @@ void test_refs_rename__force_loose_packed(void)
void
test_refs_rename__force_loose
(
void
)
{
/
/ can force-rename a loose reference with the name of an existing loose reference
/
* can force-rename a loose reference with the name of an existing loose reference */
git_reference
*
looked_up_ref
,
*
renamed_ref
;
git_oid
oid
;
...
...
@@ -258,7 +258,7 @@ void test_refs_rename__force_loose(void)
void
test_refs_rename__overwrite
(
void
)
{
/
/ can not overwrite name of existing reference
/
* can not overwrite name of existing reference */
git_reference
*
ref
,
*
ref_one
,
*
ref_one_new
,
*
ref_two
;
git_refdb
*
refdb
;
git_oid
id
;
...
...
@@ -292,7 +292,7 @@ void test_refs_rename__overwrite(void)
void
test_refs_rename__prefix
(
void
)
{
/
/ can be renamed to a new name prefixed with the old name
/
* can be renamed to a new name prefixed with the old name */
git_reference
*
ref
,
*
ref_two
,
*
looked_up_ref
,
*
renamed_ref
;
git_oid
id
;
...
...
@@ -325,7 +325,7 @@ void test_refs_rename__prefix(void)
void
test_refs_rename__move_up
(
void
)
{
/
/ can move a reference to a upper reference hierarchy
/
* can move a reference to a upper reference hierarchy */
git_reference
*
ref
,
*
ref_two
,
*
looked_up_ref
,
*
renamed_ref
;
git_oid
id
;
...
...
tests/refs/setter.c
View file @
2510268a
...
...
@@ -65,7 +65,7 @@ void test_refs_setter__update_symbolic(void)
void
test_refs_setter__cant_update_direct_with_symbolic
(
void
)
{
/
/ Overwrite an existing object id reference with a symbolic one
/
* Overwrite an existing object id reference with a symbolic one */
git_reference
*
ref
,
*
new
;
git_oid
id
;
...
...
@@ -80,7 +80,7 @@ void test_refs_setter__cant_update_direct_with_symbolic(void)
void
test_refs_setter__cant_update_symbolic_with_direct
(
void
)
{
/
/ Overwrite an existing symbolic reference with an object id one
/
* Overwrite an existing symbolic reference with an object id one */
git_reference
*
ref
,
*
new
;
git_oid
id
;
...
...
tests/repo/discover.c
View file @
2510268a
...
...
@@ -58,7 +58,7 @@ static void write_file(const char *path, const char *content)
cl_git_pass
(
error
);
}
/
/no check is performed on ceiling_dirs length, so be sure it's long enough
/
*no check is performed on ceiling_dirs length, so be sure it's long enough */
static
void
append_ceiling_dir
(
git_buf
*
ceiling_dirs
,
const
char
*
path
)
{
git_buf
pretty_path
=
GIT_BUF_INIT
;
...
...
tests/revert/bare.c
View file @
2510268a
...
...
@@ -11,7 +11,7 @@
static
git_repository
*
repo
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_revert_bare__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
TEST_REPO_PATH
);
...
...
tests/revert/workdir.c
View file @
2510268a
...
...
@@ -12,7 +12,7 @@
static
git_repository
*
repo
;
static
git_index
*
repo_index
;
/
/ Fixture setup and teardown
/
* Fixture setup and teardown */
void
test_revert_workdir__initialize
(
void
)
{
git_config
*
cfg
;
...
...
tests/stash/apply.c
View file @
2510268a
...
...
@@ -422,7 +422,7 @@ void test_stash_apply__uses_reflog_like_indices_1(void)
cl_git_pass
(
git_stash_save
(
&
oid
,
repo
,
signature
,
NULL
,
GIT_STASH_INCLUDE_UNTRACKED
));
assert_status
(
repo
,
"untracked"
,
GIT_ENOTFOUND
);
/
/ stash@{1} is the oldest (first) stash we made
/
* stash@{1} is the oldest (first) stash we made */
cl_git_pass
(
git_stash_apply
(
repo
,
1
,
NULL
));
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
...
...
@@ -441,7 +441,7 @@ void test_stash_apply__uses_reflog_like_indices_2(void)
cl_git_pass
(
git_stash_save
(
&
oid
,
repo
,
signature
,
NULL
,
GIT_STASH_INCLUDE_UNTRACKED
));
assert_status
(
repo
,
"untracked"
,
GIT_ENOTFOUND
);
/
/ stash@{0} is the newest stash we made immediately above
/
* stash@{0} is the newest stash we made immediately above */
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
NULL
));
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
...
...
tests/status/status_data.h
View file @
2510268a
#include "status_helpers.h"
/
/ A utf-8 string with 83 characters, but 249 bytes.
/
* A utf-8 string with 83 characters, but 249 bytes. */
static
const
char
*
longname
=
"
\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97\xe5\x8f\x97
"
;
...
...
tests/status/worktree.c
View file @
2510268a
...
...
@@ -260,7 +260,7 @@ void test_status_worktree__within_subdir(void)
pathsArray
.
strings
=
paths
;
opts
.
pathspec
=
pathsArray
;
/
/ We committed zzz_new_dir/new_file above. It shouldn't be reported.
/
* We committed zzz_new_dir/new_file above. It shouldn't be reported. */
cl_git_pass
(
git_status_foreach_ext
(
repo
,
&
opts
,
cb_status__normal
,
&
counts
)
);
...
...
@@ -957,7 +957,7 @@ void test_status_worktree__long_filenames(void)
git_status_options
opts
=
GIT_STATUS_OPTIONS_INIT
;
status_entry_counts
counts
=
{
0
};
/
/ Create directory with amazingly long filename
/
* Create directory with amazingly long filename */
sprintf
(
path
,
"empty_standard_repo/%s"
,
longname
);
cl_git_pass
(
git_futils_mkdir_r
(
path
,
0777
));
sprintf
(
path
,
"empty_standard_repo/%s/foo"
,
longname
);
...
...
tests/threads/basic.c
View file @
2510268a
...
...
@@ -19,7 +19,7 @@ void test_threads_basic__cleanup(void)
void
test_threads_basic__cache
(
void
)
{
/
/ run several threads polling the cache at the same time
/
* run several threads polling the cache at the same time */
cl_assert
(
1
==
1
);
}
...
...
tests/worktree/config.c
View file @
2510268a
...
...
@@ -36,8 +36,10 @@ void test_worktree_config__set(void)
cl_git_pass
(
git_config_set_int32
(
cfg
,
"core.dummy"
,
5
));
git_config_free
(
cfg
);
// reopen to verify configuration has been set in the
// common dir
/*
* reopen to verify configuration has been set in the
* common dir
*/
cl_git_pass
(
git_repository_config
(
&
cfg
,
fixture
.
repo
));
cl_git_pass
(
git_config_get_int32
(
&
val
,
cfg
,
"core.dummy"
));
cl_assert_equal_i
(
val
,
5
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment