mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-21 22:16:24 +00:00
Merge pull request #7270 from libgit2/copilot/backport-v19-4
backports for v1.9.4
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
project(libgit2 VERSION "1.9.3" LANGUAGES C)
|
||||
project(libgit2 VERSION "1.9.4" LANGUAGES C)
|
||||
|
||||
# Add find modules to the path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
2
deps/xdiff/CMakeLists.txt
vendored
2
deps/xdiff/CMakeLists.txt
vendored
@@ -6,7 +6,7 @@ add_library(xdiff OBJECT ${SRC_XDIFF})
|
||||
target_include_directories(xdiff SYSTEM PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include"
|
||||
"${PROJECT_SOURCE_DIR}/src/util"
|
||||
"${PROJECT_BINARY_DIR}/src/util"
|
||||
"${PROJECT_BINARY_DIR}/gen_headers"
|
||||
${LIBGIT2_SYSTEM_INCLUDES}
|
||||
${LIBGIT2_DEPENDENCY_INCLUDES})
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
v1.9.4
|
||||
------
|
||||
|
||||
This release includes a few small but important bugfixes.
|
||||
|
||||
* cmake: separate generated headers from translated headers by
|
||||
@ethomson in https://github.com/libgit2/libgit2/pull/7263
|
||||
* Avoid uninitialized variable warnings in gcc by @ethomson in
|
||||
https://github.com/libgit2/libgit2/pull/7258
|
||||
* fix: Recognize relative worktrees extension by @cwill747 in
|
||||
https://github.com/libgit2/libgit2/pull/7254
|
||||
* fix(sha256): thread-safety bug in builtin SHA-256 by @weihanglo in
|
||||
https://github.com/libgit2/libgit2/pull/7266
|
||||
|
||||
v1.9.3
|
||||
------
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ GIT_BEGIN_DECL
|
||||
* The version string for libgit2. This string follows semantic
|
||||
* versioning (v2) guidelines.
|
||||
*/
|
||||
#define LIBGIT2_VERSION "1.9.3"
|
||||
#define LIBGIT2_VERSION "1.9.4"
|
||||
|
||||
/** The major version number for this version of libgit2. */
|
||||
#define LIBGIT2_VERSION_MAJOR 1
|
||||
@@ -30,7 +30,7 @@ GIT_BEGIN_DECL
|
||||
#define LIBGIT2_VERSION_MINOR 9
|
||||
|
||||
/** The revision ("teeny") version number for this version of libgit2. */
|
||||
#define LIBGIT2_VERSION_REVISION 3
|
||||
#define LIBGIT2_VERSION_REVISION 4
|
||||
|
||||
/** The Windows DLL patch number for this version of libgit2. */
|
||||
#define LIBGIT2_VERSION_PATCH 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libgit2",
|
||||
"version": "1.9.3",
|
||||
"version": "1.9.4",
|
||||
"repo": "https://github.com/libgit2/libgit2",
|
||||
"description": " A cross-platform, linkable library implementation of Git that you can use in your application.",
|
||||
"install": "mkdir build && cd build && cmake .. && cmake --build ."
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
set(CLI_INCLUDES
|
||||
"${libgit2_BINARY_DIR}/src/util"
|
||||
"${libgit2_BINARY_DIR}/include"
|
||||
"${libgit2_SOURCE_DIR}/src/util"
|
||||
"${libgit2_SOURCE_DIR}/src/cli"
|
||||
"${libgit2_SOURCE_DIR}/include"
|
||||
"${libgit2_BINARY_DIR}/gen_headers"
|
||||
"${LIBGIT2_DEPENDENCY_INCLUDES}"
|
||||
"${LIBGIT2_SYSTEM_INCLUDES}")
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ GIT_INLINE(const cli_opt_spec *) spec_for_sort(
|
||||
const char *arg)
|
||||
{
|
||||
int is_negated, has_value = 0;
|
||||
const char *value;
|
||||
const char *value = NULL;
|
||||
const cli_opt_spec *spec = NULL;
|
||||
size_t idx = 0;
|
||||
|
||||
|
||||
@@ -7,11 +7,10 @@ include(PkgBuildConfig)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
set(LIBGIT2_INCLUDES
|
||||
"${PROJECT_BINARY_DIR}/src/util"
|
||||
"${PROJECT_BINARY_DIR}/include"
|
||||
"${PROJECT_SOURCE_DIR}/src/libgit2"
|
||||
"${PROJECT_SOURCE_DIR}/src/util"
|
||||
"${PROJECT_SOURCE_DIR}/include")
|
||||
"${PROJECT_SOURCE_DIR}/include"
|
||||
"${PROJECT_BINARY_DIR}/gen_headers")
|
||||
|
||||
# Collect sourcefiles
|
||||
file(GLOB SRC_H
|
||||
@@ -41,7 +40,11 @@ ide_split_sources(libgit2)
|
||||
list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:util> $<TARGET_OBJECTS:libgit2> ${LIBGIT2_DEPENDENCY_OBJECTS})
|
||||
list(APPEND LIBGIT2_INCLUDES ${LIBGIT2_DEPENDENCY_INCLUDES})
|
||||
|
||||
target_include_directories(libgit2 PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES} PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
target_include_directories(libgit2
|
||||
PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES}
|
||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
|
||||
target_include_directories(libgit2 SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
|
||||
|
||||
set(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
|
||||
@@ -55,6 +58,12 @@ set(LIBGIT2_SYSTEM_LIBS ${LIBGIT2_SYSTEM_LIBS} PARENT_SCOPE)
|
||||
# Compile and link libgit2
|
||||
#
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS AND XCODE_VERSION)
|
||||
# This is required for Xcode to actually create the static libgit2 library
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "")
|
||||
list(APPEND LIBGIT2_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.c)
|
||||
endif()
|
||||
|
||||
add_library(libgit2package ${SRC_RC} ${LIBGIT2_OBJECTS})
|
||||
target_link_libraries(libgit2package ${LIBGIT2_SYSTEM_LIBS})
|
||||
target_include_directories(libgit2package SYSTEM PRIVATE ${LIBGIT2_INCLUDES})
|
||||
@@ -94,15 +103,23 @@ endif()
|
||||
|
||||
# support experimental features and functionality
|
||||
|
||||
configure_file(experimental.h.in "${PROJECT_BINARY_DIR}/include/git2/experimental.h")
|
||||
configure_file(experimental.h.in "${PROJECT_BINARY_DIR}/gen_headers/experimental.h")
|
||||
|
||||
# translate filenames in the git2.h so that they match the install directory
|
||||
# translate filenames in the headers so that they match the install directory
|
||||
# (allows for side-by-side installs of libgit2 and libgit2-experimental.)
|
||||
|
||||
file(READ "${PROJECT_SOURCE_DIR}/include/git2.h" LIBGIT2_INCLUDE)
|
||||
string(REGEX REPLACE "#include \"git2\/" "#include \"${LIBGIT2_FILENAME}/" LIBGIT2_INCLUDE "${LIBGIT2_INCLUDE}")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${LIBGIT2_FILENAME}.h.tmp" ${LIBGIT2_INCLUDE})
|
||||
configure_file("${CMAKE_CURRENT_BINARY_DIR}/${LIBGIT2_FILENAME}.h.tmp" "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h" COPYONLY)
|
||||
foreach(HEADER_SOURCE ${SRC_H})
|
||||
file(RELATIVE_PATH HEADER_RELATIVE ${PROJECT_SOURCE_DIR} ${HEADER_SOURCE})
|
||||
string(REGEX REPLACE "^include\/git2" "include/${LIBGIT2_FILENAME}" HEADER_RELATIVE ${HEADER_RELATIVE})
|
||||
|
||||
file(READ "${HEADER_SOURCE}" HEADER_CONTENTS)
|
||||
string(REGEX REPLACE "#include \"git2\/" "#include \"${LIBGIT2_FILENAME}/" HEADER_CONTENTS "${HEADER_CONTENTS}")
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${HEADER_RELATIVE}.tmp" "${HEADER_CONTENTS}")
|
||||
configure_file("${CMAKE_CURRENT_BINARY_DIR}/${HEADER_RELATIVE}.tmp" "${PROJECT_BINARY_DIR}/${HEADER_RELATIVE}" COPYONLY)
|
||||
endforeach()
|
||||
|
||||
configure_file("${PROJECT_BINARY_DIR}/gen_headers/experimental.h" "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}/experimental.h" COPYONLY)
|
||||
|
||||
# cmake package targets
|
||||
|
||||
@@ -133,9 +150,7 @@ install(TARGETS libgit2package
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2/
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
|
||||
install(FILES ${PROJECT_BINARY_DIR}/include/git2/experimental.h
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
|
||||
install(FILES "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h"
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(DIRECTORY "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}"
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
@@ -1225,7 +1225,7 @@ static int canonicalize_directory_path(
|
||||
{
|
||||
const git_index_entry *match, *best = NULL;
|
||||
char *search, *sep;
|
||||
size_t pos, search_len, best_len;
|
||||
size_t pos, search_len, best_len = 0;
|
||||
|
||||
if (!index->ignore_case)
|
||||
return 0;
|
||||
|
||||
@@ -460,7 +460,7 @@ int git_midx_foreach_entry(
|
||||
{
|
||||
git_oid oid;
|
||||
size_t oid_size, i;
|
||||
int error;
|
||||
int error = 0;
|
||||
|
||||
GIT_ASSERT_ARG(idx);
|
||||
|
||||
|
||||
@@ -1865,7 +1865,8 @@ static const char *builtin_extensions[] = {
|
||||
"noop",
|
||||
"objectformat",
|
||||
"worktreeconfig",
|
||||
"preciousobjects"
|
||||
"preciousobjects",
|
||||
"relativeworktrees"
|
||||
};
|
||||
|
||||
static git_vector user_extensions = { 0, git__strcmp_cb };
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
add_library(util OBJECT)
|
||||
|
||||
configure_file(git2_features.h.in git2_features.h)
|
||||
configure_file(git2_features.h.in "${PROJECT_BINARY_DIR}/gen_headers/git2_features.h")
|
||||
|
||||
set(UTIL_INCLUDES
|
||||
"${PROJECT_BINARY_DIR}/src/util"
|
||||
"${PROJECT_BINARY_DIR}/include"
|
||||
"${PROJECT_SOURCE_DIR}/src/util"
|
||||
"${PROJECT_SOURCE_DIR}/include")
|
||||
"${PROJECT_SOURCE_DIR}/include"
|
||||
"${PROJECT_BINARY_DIR}/gen_headers")
|
||||
|
||||
file(GLOB UTIL_SRC *.c *.h allocators/*.c allocators/*.h hash.h)
|
||||
list(SORT UTIL_SRC)
|
||||
|
||||
@@ -83,12 +83,14 @@
|
||||
* Add "length" to the length.
|
||||
* Set Corrupted when overflow has occurred.
|
||||
*/
|
||||
static uint32_t addTemp;
|
||||
#define SHA224_256AddLength(context, length) \
|
||||
(addTemp = (context)->Length_Low, (context)->Corrupted = \
|
||||
(((context)->Length_Low += (length)) < addTemp) && \
|
||||
(++(context)->Length_High == 0) ? shaInputTooLong : \
|
||||
(context)->Corrupted )
|
||||
static int SHA224_256AddLength(SHA256Context *context, unsigned int length)
|
||||
{
|
||||
uint32_t addTemp = context->Length_Low;
|
||||
context->Length_Low += length;
|
||||
if (context->Length_Low < addTemp && ++context->Length_High == 0)
|
||||
context->Corrupted = shaInputTooLong;
|
||||
return context->Corrupted;
|
||||
}
|
||||
|
||||
/* Local Function Prototypes */
|
||||
static int SHA224_256Reset(SHA256Context *context, uint32_t *H0);
|
||||
|
||||
@@ -107,6 +107,7 @@ typedef uint32_t git_hashmap_iter_t;
|
||||
} \
|
||||
GIT_INLINE(int) name##__idx(uint32_t *out, name *h, key_t key) \
|
||||
{ \
|
||||
*out = UINT32_MAX; \
|
||||
if (h->n_buckets) { \
|
||||
uint32_t k, i, last, mask, step = 0; \
|
||||
GIT_ASSERT((h)->flags); \
|
||||
|
||||
@@ -16,7 +16,7 @@ static git_atomic32 init_count;
|
||||
static int init_common(git_runtime_init_fn init_fns[], size_t cnt)
|
||||
{
|
||||
size_t i;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
/* Initialize subsystems that have global state */
|
||||
for (i = 0; i < cnt; i++) {
|
||||
@@ -110,7 +110,7 @@ GIT_INLINE(int) init_unlock(void)
|
||||
|
||||
int git_runtime_init(git_runtime_init_fn init_fns[], size_t cnt)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (init_lock() < 0)
|
||||
return -1;
|
||||
|
||||
@@ -34,11 +34,12 @@ void test_core_opts__extensions_query(void)
|
||||
|
||||
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_EXTENSIONS, &out));
|
||||
|
||||
cl_assert_equal_sz(out.count, 4);
|
||||
cl_assert_equal_sz(out.count, 5);
|
||||
cl_assert_equal_s("noop", out.strings[0]);
|
||||
cl_assert_equal_s("objectformat", out.strings[1]);
|
||||
cl_assert_equal_s("preciousobjects", out.strings[2]);
|
||||
cl_assert_equal_s("worktreeconfig", out.strings[3]);
|
||||
cl_assert_equal_s("relativeworktrees", out.strings[3]);
|
||||
cl_assert_equal_s("worktreeconfig", out.strings[4]);
|
||||
|
||||
git_strarray_dispose(&out);
|
||||
}
|
||||
@@ -51,12 +52,13 @@ void test_core_opts__extensions_add(void)
|
||||
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_EXTENSIONS, in, ARRAY_SIZE(in)));
|
||||
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_EXTENSIONS, &out));
|
||||
|
||||
cl_assert_equal_sz(out.count, 5);
|
||||
cl_assert_equal_sz(out.count, 6);
|
||||
cl_assert_equal_s("foo", out.strings[0]);
|
||||
cl_assert_equal_s("noop", out.strings[1]);
|
||||
cl_assert_equal_s("objectformat", out.strings[2]);
|
||||
cl_assert_equal_s("preciousobjects", out.strings[3]);
|
||||
cl_assert_equal_s("worktreeconfig", out.strings[4]);
|
||||
cl_assert_equal_s("relativeworktrees", out.strings[4]);
|
||||
cl_assert_equal_s("worktreeconfig", out.strings[5]);
|
||||
|
||||
git_strarray_dispose(&out);
|
||||
}
|
||||
@@ -69,12 +71,13 @@ void test_core_opts__extensions_remove(void)
|
||||
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_EXTENSIONS, in, ARRAY_SIZE(in)));
|
||||
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_EXTENSIONS, &out));
|
||||
|
||||
cl_assert_equal_sz(out.count, 5);
|
||||
cl_assert_equal_sz(out.count, 6);
|
||||
cl_assert_equal_s("bar", out.strings[0]);
|
||||
cl_assert_equal_s("baz", out.strings[1]);
|
||||
cl_assert_equal_s("objectformat", out.strings[2]);
|
||||
cl_assert_equal_s("preciousobjects", out.strings[3]);
|
||||
cl_assert_equal_s("worktreeconfig", out.strings[4]);
|
||||
cl_assert_equal_s("relativeworktrees", out.strings[4]);
|
||||
cl_assert_equal_s("worktreeconfig", out.strings[5]);
|
||||
|
||||
git_strarray_dispose(&out);
|
||||
}
|
||||
@@ -87,13 +90,14 @@ void test_core_opts__extensions_uniq(void)
|
||||
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_EXTENSIONS, in, ARRAY_SIZE(in)));
|
||||
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_EXTENSIONS, &out));
|
||||
|
||||
cl_assert_equal_sz(out.count, 6);
|
||||
cl_assert_equal_sz(out.count, 7);
|
||||
cl_assert_equal_s("bar", out.strings[0]);
|
||||
cl_assert_equal_s("foo", out.strings[1]);
|
||||
cl_assert_equal_s("noop", out.strings[2]);
|
||||
cl_assert_equal_s("objectformat", out.strings[3]);
|
||||
cl_assert_equal_s("preciousobjects", out.strings[4]);
|
||||
cl_assert_equal_s("worktreeconfig", out.strings[5]);
|
||||
cl_assert_equal_s("relativeworktrees", out.strings[5]);
|
||||
cl_assert_equal_s("worktreeconfig", out.strings[6]);
|
||||
|
||||
git_strarray_dispose(&out);
|
||||
}
|
||||
|
||||
@@ -80,3 +80,13 @@ void test_repo_extensions__preciousobjects(void)
|
||||
cl_git_pass(git_repository_open(&extended, "empty_bare.git"));
|
||||
git_repository_free(extended);
|
||||
}
|
||||
|
||||
void test_repo_extensions__relativeworktrees(void)
|
||||
{
|
||||
git_repository *extended = NULL;
|
||||
|
||||
cl_repo_set_string(repo, "extensions.relativeWorktrees", "true");
|
||||
|
||||
cl_git_pass(git_repository_open(&extended, "empty_bare.git"));
|
||||
git_repository_free(extended);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user