summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.editorconfig1
-rw-r--r--.travis.yml4
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/tree.c43
-rw-r--r--src/tree.h12
5 files changed, 10 insertions, 59 deletions
diff --git a/.editorconfig b/.editorconfig
index be59274e8..d4b419012 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -12,3 +12,4 @@ insert_final_newline = true
[*.md]
indent_style = space
indent_size = 4
+trim_trailing_whitespace = false
diff --git a/.travis.yml b/.travis.yml
index 686041bfa..61edba135 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -58,12 +58,12 @@ matrix:
- compiler: gcc
env:
MBEDTLS=1
- OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release -DUSE_HTTPS=mbedTLS -DMBEDTLS_ROOT_DIR=../deps/mbedtls"
+ OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release -DUSE_HTTPS=mbedTLS -DSHA1_BACKEND=mbedTLS -DMBEDTLS_ROOT_DIR=../deps/mbedtls"
os: linux
- compiler: gcc
env:
MBEDTLS=1
- OPTIONS="-DTHREADSAFE=OFF -DBUILD_EXAMPLES=ON -DUSE_HTTPS=mbedTLS -DMBEDTLS_ROOT_DIR=../deps/mbedtls"
+ OPTIONS="-DTHREADSAFE=OFF -DBUILD_EXAMPLES=ON -DUSE_HTTPS=mbedTLS -DSHA1_BACKEND=mbedTLS -DMBEDTLS_ROOT_DIR=../deps/mbedtls"
os: linux
allow_failures:
- env: COVERITY=1
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2b82bb325..2deed5f87 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -284,8 +284,13 @@ ELSEIF(SHA1_BACKEND STREQUAL "CommonCrypto")
ELSEIF (SHA1_BACKEND STREQUAL "mbedTLS")
ADD_FEATURE_INFO(SHA ON "using mbedTLS")
SET(GIT_SHA1_MBEDTLS 1)
- FILE(GLOB SRC_SHA1 src/hash/hash_mbedtls.c)
- LIST(APPEND LIBGIT2_PC_REQUIRES "mbedtls")
+ FILE(GLOB SRC_SHA1 hash/hash_mbedtls.c)
+ LIST(APPEND LIBGIT2_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
+ # For now, pass its link flags as our own
+ LIST(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES})
ELSE()
MESSAGE(FATAL_ERROR "Asked for unknown SHA1 backend ${SHA1_BACKEND}")
ENDIF()
diff --git a/src/tree.c b/src/tree.c
index 2d7c91cdf..be0f528c2 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -74,14 +74,6 @@ int git_tree_entry_cmp(const git_tree_entry *e1, const git_tree_entry *e2)
return entry_sort_cmp(e1, e2);
}
-int git_tree_entry_icmp(const git_tree_entry *e1, const git_tree_entry *e2)
-{
- return git_path_cmp(
- e1->filename, e1->filename_len, git_tree_entry__is_tree(e1),
- e2->filename, e2->filename_len, git_tree_entry__is_tree(e2),
- git__strncasecmp);
-}
-
/**
* Allocate a new self-contained entry, with enough space after it to
* store the filename and the id.
@@ -342,41 +334,6 @@ const git_tree_entry *git_tree_entry_byid(
return NULL;
}
-int git_tree__prefix_position(const git_tree *tree, const char *path)
-{
- struct tree_key_search ksearch;
- size_t at_pos, path_len;
-
- if (!path)
- return 0;
-
- path_len = strlen(path);
- TREE_ENTRY_CHECK_NAMELEN(path_len);
-
- ksearch.filename = path;
- ksearch.filename_len = (uint16_t)path_len;
-
- /* Find tree entry with appropriate prefix */
- git_array_search(
- &at_pos, tree->entries, &homing_search_cmp, &ksearch);
-
- for (; at_pos < tree->entries.size; ++at_pos) {
- const git_tree_entry *entry = git_array_get(tree->entries, at_pos);
- if (homing_search_cmp(&ksearch, entry) < 0)
- break;
- }
-
- for (; at_pos > 0; --at_pos) {
- const git_tree_entry *entry =
- git_array_get(tree->entries, at_pos - 1);
-
- if (homing_search_cmp(&ksearch, entry) > 0)
- break;
- }
-
- return (int)at_pos;
-}
-
size_t git_tree_entrycount(const git_tree *tree)
{
assert(tree);
diff --git a/src/tree.h b/src/tree.h
index 00f4b06eb..fbee5efe1 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -39,22 +39,10 @@ GIT_INLINE(bool) git_tree_entry__is_tree(const struct git_tree_entry *e)
return (S_ISDIR(e->attr) && !S_ISGITLINK(e->attr));
}
-extern int git_tree_entry_icmp(const git_tree_entry *e1, const git_tree_entry *e2);
-
void git_tree__free(void *tree);
int git_tree__parse(void *tree, git_odb_object *obj);
/**
- * Lookup the first position in the tree with a given prefix.
- *
- * @param tree a previously loaded tree.
- * @param prefix the beginning of a path to find in the tree.
- * @return index of the first item at or after the given prefix.
- */
-int git_tree__prefix_position(const git_tree *tree, const char *prefix);
-
-
-/**
* Write a tree to the given repository
*/
int git_tree__write_index(