diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2018-07-14 14:00:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-14 14:00:26 +0100 |
commit | 2510268a269cd79e5cfa68ce8f56e540131f3b6d (patch) | |
tree | a59136e3ed9d7664441457b3842096b9df078686 | |
parent | 6dfc8bc2499db78eae4e29dd121c75121f0e8baf (diff) | |
parent | e1a4a8ebfc5f5f138cb200f620eac73913cbe0f6 (diff) | |
download | libgit2-2510268a269cd79e5cfa68ce8f56e540131f3b6d.tar.gz |
Merge pull request #4700 from pks-t/pks/std-c90
C90 standard compliance
77 files changed, 239 insertions, 200 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d411751cd..fd846666f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ca7515e5d..49edaec0f 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,7 +1,10 @@ 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() diff --git a/examples/general.c b/examples/general.c index 0780d3d49..15b415a98 100644 --- a/examples/general.c +++ b/examples/general.c @@ -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'; diff --git a/examples/network/clone.c b/examples/network/clone.c index 540000bfd..ce4b6aedf 100644 --- a/examples/network/clone.c +++ b/examples/network/clone.c @@ -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) { diff --git a/examples/network/index-pack.c b/examples/network/index-pack.c index 314f21160..e9261027c 100644 --- a/examples/network/index-pack.c +++ b/examples/network/index-pack.c @@ -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; diff --git a/examples/network/ls-remote.c b/examples/network/ls-remote.c index 9329da5d9..fb258acbe 100644 --- a/examples/network/ls-remote.c +++ b/examples/network/ls-remote.c @@ -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); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2deed5f87..be733cc76 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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}) diff --git a/src/common.h b/src/common.h index 44063be12..cb980c107 100644 --- a/src/common.h +++ b/src/common.h @@ -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 */ diff --git a/src/khash.h b/src/khash.h index 71eb583d5..40e2d1848 100644 --- a/src/khash.h +++ b/src/khash.h @@ -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 */ diff --git a/src/notes.c b/src/notes.c index b4c01226f..ebab0cdd3 100644 --- a/src/notes.c +++ b/src/notes.c @@ -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; diff --git a/src/refspec.c b/src/refspec.c index aa6682bad..f429776fb 100644 --- a/src/refspec.c +++ b/src/refspec.c @@ -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; diff --git a/src/signature.c b/src/signature.c index cd6852326..286d0a618 100644 --- a/src/signature.c +++ b/src/signature.c @@ -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; } diff --git a/src/streams/mbedtls.c b/src/streams/mbedtls.c index 0a49a36a6..7cecb2ade 100644 --- a/src/streams/mbedtls.c +++ b/src/streams/mbedtls.c @@ -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; diff --git a/src/trailer.c b/src/trailer.c index 24c8847f6..dc8d1abcb 100644 --- a/src/trailer.c +++ b/src/trailer.c @@ -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); } diff --git a/src/transports/smart.c b/src/transports/smart.c index 619a81ff8..69c129b5e 100644 --- a/src/transports/smart.c +++ b/src/transports/smart.c @@ -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; diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index f51e1e546..8617e45e9 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -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) diff --git a/src/xdiff/xdiffi.c b/src/xdiff/xdiffi.c index 3a71ef678..97db05466 100644 --- a/src/xdiff/xdiffi.c +++ b/src/xdiff/xdiffi.c @@ -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 { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 82bf6d0d7..d75114b5c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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) diff --git a/tests/checkout/index.c b/tests/checkout/index.c index a649d8512..69252e3d9 100644 --- a/tests/checkout/index.c +++ b/tests/checkout/index.c @@ -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)); diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index a78bf82df..a69574bf3 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -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]; diff --git a/tests/cherrypick/workdir.c b/tests/cherrypick/workdir.c index d83f54b51..e43bb0807 100644 --- a/tests/cherrypick/workdir.c +++ b/tests/cherrypick/workdir.c @@ -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); diff --git a/tests/commit/parse.c b/tests/commit/parse.c index e61589dfd..47ec6ddbf 100644 --- a/tests/commit/parse.c +++ b/tests/commit/parse.c @@ -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 */ "\ntree 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); diff --git a/tests/commit/signature.c b/tests/commit/signature.c index 286079fa2..78ddbbef3 100644 --- a/tests/commit/signature.c +++ b/tests/commit/signature.c @@ -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); diff --git a/tests/commit/write.c b/tests/commit/write.c index 7b0af8cc0..2ba74ca9b 100644 --- a/tests/commit/write.c +++ b/tests/commit/write.c @@ -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; diff --git a/tests/config/write.c b/tests/config/write.c index cffa54e4d..521dcb0ae 100644 --- a/tests/config/write.c +++ b/tests/config/write.c @@ -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")); diff --git a/tests/core/filebuf.c b/tests/core/filebuf.c index 51d8a0146..8d1952f57 100644 --- a/tests/core/filebuf.c +++ b/tests/core/filebuf.c @@ -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)); diff --git a/tests/core/futils.c b/tests/core/futils.c index c69c210ee..fce4848f5 100644 --- a/tests/core/futils.c +++ b/tests/core/futils.c @@ -1,7 +1,7 @@ #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)); diff --git a/tests/core/vector.c b/tests/core/vector.c index c2e5d3f34..4e6f6fc7f 100644 --- a/tests/core/vector.c +++ b/tests/core/vector.c @@ -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); } diff --git a/tests/date/rfc2822.c b/tests/date/rfc2822.c index eda475ac9..d98c1f05e 100644 --- a/tests/date/rfc2822.c +++ b/tests/date/rfc2822.c @@ -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]; diff --git a/tests/describe/t6120.c b/tests/describe/t6120.c index 6df397ec6..65e8582aa 100644 --- a/tests/describe/t6120.c +++ b/tests/describe/t6120.c @@ -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; diff --git a/tests/index/conflicts.c b/tests/index/conflicts.c index cabef888c..367d5b5bc 100644 --- a/tests/index/conflicts.c +++ b/tests/index/conflicts.c @@ -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"); diff --git a/tests/index/names.c b/tests/index/names.c index 5fa4b4e72..11d2c416a 100644 --- a/tests/index/names.c +++ b/tests/index/names.c @@ -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"); diff --git a/tests/index/nsec.c b/tests/index/nsec.c index a20e3ead8..dee1509e1 100644 --- a/tests/index/nsec.c +++ b/tests/index/nsec.c @@ -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"); diff --git a/tests/index/reuc.c b/tests/index/reuc.c index 134f499af..1489ed13e 100644 --- a/tests/index/reuc.c +++ b/tests/index/reuc.c @@ -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"); diff --git a/tests/index/stage.c b/tests/index/stage.c index 58dc1fb5e..cdfe3a811 100644 --- a/tests/index/stage.c +++ b/tests/index/stage.c @@ -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"); diff --git a/tests/merge/files.c b/tests/merge/files.c index 6f5a1fd9c..27c96363f 100644 --- a/tests/merge/files.c +++ b/tests/merge/files.c @@ -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; diff --git a/tests/merge/trees/automerge.c b/tests/merge/trees/automerge.c index 67f2cf786..e16b829ee 100644 --- a/tests/merge/trees/automerge.c +++ b/tests/merge/trees/automerge.c @@ -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); diff --git a/tests/merge/trees/modeconflict.c b/tests/merge/trees/modeconflict.c index d858b8f66..e85e340b9 100644 --- a/tests/merge/trees/modeconflict.c +++ b/tests/merge/trees/modeconflict.c @@ -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); diff --git a/tests/merge/trees/renames.c b/tests/merge/trees/renames.c index 853bf2fa0..fbcfd2d3b 100644 --- a/tests/merge/trees/renames.c +++ b/tests/merge/trees/renames.c @@ -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); diff --git a/tests/merge/trees/trivial.c b/tests/merge/trees/trivial.c index c7f8d2423..4a8255624 100644 --- a/tests/merge/trees/trivial.c +++ b/tests/merge/trees/trivial.c @@ -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); diff --git a/tests/merge/trees/whitespace.c b/tests/merge/trees/whitespace.c index b99583cb3..fdb11253b 100644 --- a/tests/merge/trees/whitespace.c +++ b/tests/merge/trees/whitespace.c @@ -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); diff --git a/tests/merge/workdir/analysis.c b/tests/merge/workdir/analysis.c index 84885c4fa..f87fc58b0 100644 --- a/tests/merge/workdir/analysis.c +++ b/tests/merge/workdir/analysis.c @@ -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); diff --git a/tests/merge/workdir/renames.c b/tests/merge/workdir/renames.c index fabcda2a8..a8ee59a44 100644 --- a/tests/merge/workdir/renames.c +++ b/tests/merge/workdir/renames.c @@ -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; diff --git a/tests/merge/workdir/setup.c b/tests/merge/workdir/setup.c index 92524e2ed..3a8f9d987 100644 --- a/tests/merge/workdir/setup.c +++ b/tests/merge/workdir/setup.c @@ -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); diff --git a/tests/merge/workdir/simple.c b/tests/merge/workdir/simple.c index 32b20623f..cff1a5765 100644 --- a/tests/merge/workdir/simple.c +++ b/tests/merge/workdir/simple.c @@ -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; diff --git a/tests/merge/workdir/submodules.c b/tests/merge/workdir/submodules.c index c4cc188a8..35280e61e 100644 --- a/tests/merge/workdir/submodules.c +++ b/tests/merge/workdir/submodules.c @@ -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); diff --git a/tests/merge/workdir/trivial.c b/tests/merge/workdir/trivial.c index 85cce493a..39d1ddc9b 100644 --- a/tests/merge/workdir/trivial.c +++ b/tests/merge/workdir/trivial.c @@ -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); diff --git a/tests/network/refspecs.c b/tests/network/refspecs.c index 15d36245b..1a65fd246 100644 --- a/tests/network/refspecs.c +++ b/tests/network/refspecs.c @@ -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); diff --git a/tests/object/lookupbypath.c b/tests/object/lookupbypath.c index 13cd6a128..15e79f6ec 100644 --- a/tests/object/lookupbypath.c +++ b/tests/object/lookupbypath.c @@ -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)); diff --git a/tests/object/message.c b/tests/object/message.c index 519ce5f31..bc005340b 100644 --- a/tests/object/message.c +++ b/tests/object/message.c @@ -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 */ diff --git a/tests/object/raw/write.c b/tests/object/raw/write.c index 273f08f2c..c7270e26a 100644 --- a/tests/object/raw/write.c +++ b/tests/object/raw/write.c @@ -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; diff --git a/tests/object/tag/list.c b/tests/object/tag/list.c index 6d5a24347..b8d507fe7 100644 --- a/tests/object/tag/list.c +++ b/tests/object/tag/list.c @@ -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++]); diff --git a/tests/object/tag/read.c b/tests/object/tag/read.c index 8f28afd54..e28056ec7 100644 --- a/tests/object/tag/read.c +++ b/tests/object/tag/read.c @@ -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); diff --git a/tests/object/tag/write.c b/tests/object/tag/write.c index 68e4b6c61..4c5080185 100644 --- a/tests/object/tag/write.c +++ b/tests/object/tag/write.c @@ -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")); diff --git a/tests/object/tree/read.c b/tests/object/tree/read.c index 59a809bf1..1d3a9133d 100644 --- a/tests/object/tree/read.c +++ b/tests/object/tree/read.c @@ -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; diff --git a/tests/rebase/abort.c b/tests/rebase/abort.c index d8891fb1d..a83c529ce 100644 --- a/tests/rebase/abort.c +++ b/tests/rebase/abort.c @@ -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"); diff --git a/tests/rebase/inmemory.c b/tests/rebase/inmemory.c index 367d6b3ac..040a81b1b 100644 --- a/tests/rebase/inmemory.c +++ b/tests/rebase/inmemory.c @@ -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"); diff --git a/tests/rebase/iterator.c b/tests/rebase/iterator.c index db57b0a83..49a601243 100644 --- a/tests/rebase/iterator.c +++ b/tests/rebase/iterator.c @@ -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"); diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c index 7b2d6876c..830593707 100644 --- a/tests/rebase/merge.c +++ b/tests/rebase/merge.c @@ -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"); diff --git a/tests/rebase/setup.c b/tests/rebase/setup.c index b07a83af6..f00294574 100644 --- a/tests/rebase/setup.c +++ b/tests/rebase/setup.c @@ -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"); diff --git a/tests/rebase/submodule.c b/tests/rebase/submodule.c index f71b94f7f..5aa9ceb37 100644 --- a/tests/rebase/submodule.c +++ b/tests/rebase/submodule.c @@ -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; diff --git a/tests/refs/delete.c b/tests/refs/delete.c index 8cad31686..4cc78aa9c 100644 --- a/tests/refs/delete.c +++ b/tests/refs/delete.c @@ -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; diff --git a/tests/refs/list.c b/tests/refs/list.c index 97461fd69..3e8c82c94 100644 --- a/tests/refs/list.c +++ b/tests/refs/list.c @@ -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)); diff --git a/tests/refs/normalize.c b/tests/refs/normalize.c index f9c525edc..c692eda77 100644 --- a/tests/refs/normalize.c +++ b/tests/refs/normalize.c @@ -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/\\"); diff --git a/tests/refs/overwrite.c b/tests/refs/overwrite.c index 5aea2a764..2e499b75e 100644 --- a/tests/refs/overwrite.c +++ b/tests/refs/overwrite.c @@ -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; diff --git a/tests/refs/read.c b/tests/refs/read.c index c00b016ee..3c7a0a1bf 100644 --- a/tests/refs/read.c +++ b/tests/refs/read.c @@ -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)); diff --git a/tests/refs/reflog/reflog.c b/tests/refs/reflog/reflog.c index a4484631a..ec251da08 100644 --- a/tests/refs/reflog/reflog.c +++ b/tests/refs/reflog/reflog.c @@ -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) diff --git a/tests/refs/rename.c b/tests/refs/rename.c index e3e51485e..6ec8f65ea 100644 --- a/tests/refs/rename.c +++ b/tests/refs/rename.c @@ -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; diff --git a/tests/refs/setter.c b/tests/refs/setter.c index 2b42ff253..03c214618 100644 --- a/tests/refs/setter.c +++ b/tests/refs/setter.c @@ -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; diff --git a/tests/repo/discover.c b/tests/repo/discover.c index b13c97bd9..cc61c7125 100644 --- a/tests/repo/discover.c +++ b/tests/repo/discover.c @@ -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; diff --git a/tests/revert/bare.c b/tests/revert/bare.c index 206c86d70..fda2b82b0 100644 --- a/tests/revert/bare.c +++ b/tests/revert/bare.c @@ -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); diff --git a/tests/revert/workdir.c b/tests/revert/workdir.c index 86047350a..53bb0e439 100644 --- a/tests/revert/workdir.c +++ b/tests/revert/workdir.c @@ -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; diff --git a/tests/stash/apply.c b/tests/stash/apply.c index 986eba0f3..16cb14000 100644 --- a/tests/stash/apply.c +++ b/tests/stash/apply.c @@ -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); diff --git a/tests/status/status_data.h b/tests/status/status_data.h index 8ad4235fd..09b9827f2 100644 --- a/tests/status/status_data.h +++ b/tests/status/status_data.h @@ -1,6 +1,6 @@ #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"; diff --git a/tests/status/worktree.c b/tests/status/worktree.c index bb9f8ec97..7abc703db 100644 --- a/tests/status/worktree.c +++ b/tests/status/worktree.c @@ -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); diff --git a/tests/threads/basic.c b/tests/threads/basic.c index af6049090..9ce740cf9 100644 --- a/tests/threads/basic.c +++ b/tests/threads/basic.c @@ -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); } diff --git a/tests/worktree/config.c b/tests/worktree/config.c index 3ab317bb5..81dcfe1fa 100644 --- a/tests/worktree/config.c +++ b/tests/worktree/config.c @@ -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); |