Skip to content

Commit 7c9f77b

Browse files
authored
Merge branch 'libgit2:main' into fix/apple-static-lib
2 parents 3eb3981 + e2e3f3e commit 7c9f77b

File tree

11 files changed

+176
-5
lines changed

11 files changed

+176
-5
lines changed

deps/ntlmclient/crypt_openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static inline void HMAC_CTX_free(HMAC_CTX *ctx)
4444

4545
#endif
4646

47-
#if OPENSSL_VERSION_NUMBER >= 0x10100000L || defined(CRYPT_OPENSSL_DYNAMIC)
47+
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && !LIBRESSL_VERSION_NUMBER) || defined(CRYPT_OPENSSL_DYNAMIC)
4848

4949
static inline void HMAC_CTX_cleanup(HMAC_CTX *ctx)
5050
{

include/git2/status.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ typedef struct {
250250
* working directory and index; defaults to HEAD.
251251
*/
252252
git_tree *baseline;
253+
254+
/**
255+
* Threshold above which similar files will be considered renames.
256+
* This is equivalent to the -M option. Defaults to 50.
257+
*/
258+
uint16_t rename_threshold;
253259
} git_status_options;
254260

255261
#define GIT_STATUS_OPTIONS_VERSION 1

src/config_file.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,14 +724,25 @@ static const struct {
724724
static int parse_conditional_include(config_file_parse_data *parse_data, const char *section, const char *file)
725725
{
726726
char *condition;
727-
size_t i;
727+
size_t section_len, i;
728728
int error = 0, matches;
729729

730730
if (!parse_data->repo || !file)
731731
return 0;
732732

733-
condition = git__substrdup(section + strlen("includeIf."),
734-
strlen(section) - strlen("includeIf.") - strlen(".path"));
733+
section_len = strlen(section);
734+
735+
/*
736+
* We checked that the string starts with `includeIf.` and ends
737+
* in `.path` to get here. Make sure it consists of more.
738+
*/
739+
if (section_len < CONST_STRLEN("includeIf.") + CONST_STRLEN(".path"))
740+
return 0;
741+
742+
condition = git__substrdup(section + CONST_STRLEN("includeIf."),
743+
section_len - CONST_STRLEN("includeIf.") - CONST_STRLEN(".path"));
744+
745+
GIT_ERROR_CHECK_ALLOC(condition);
735746

736747
for (i = 0; i < ARRAY_SIZE(conditions); i++) {
737748
if (git__prefixcmp(condition, conditions[i].prefix))

src/diff_tform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int apply_splits_and_deletes(
375375
size_t i;
376376
git_diff_delta *delta;
377377

378-
if (git_vector_init(&onto, expected_size, git_diff_delta__cmp) < 0)
378+
if (git_vector_init(&onto, expected_size, diff->deltas._cmp) < 0)
379379
return -1;
380380

381381
/* build new delta list without TO_DELETE and splitting TO_SPLIT */

src/status.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ int git_status_list_new(
336336
GIT_DIFF_FIND_RENAMES_FROM_REWRITES |
337337
GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY;
338338

339+
if (opts != NULL && opts->rename_threshold != 0)
340+
findopt.rename_threshold = opts->rename_threshold;
341+
339342
if (show != GIT_STATUS_SHOW_WORKDIR_ONLY) {
340343
if ((error = git_diff_tree_to_index(
341344
&status->head2idx, repo, head, index, &diffopt)) < 0)

tests/config/conditionals.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,28 @@ void test_config_conditionals__onbranch(void)
148148
assert_condition_includes("onbranch", "dir*", false);
149149
assert_condition_includes("onbranch", "dir/*", false);
150150
}
151+
152+
void test_config_conditionals__empty(void)
153+
{
154+
git_buf value = GIT_BUF_INIT;
155+
git_str buf = GIT_STR_INIT;
156+
git_config *cfg;
157+
158+
cl_git_pass(git_str_puts(&buf, "[includeIf]\n"));
159+
cl_git_pass(git_str_puts(&buf, "path = other\n"));
160+
161+
cl_git_mkfile("empty_standard_repo/.git/config", buf.ptr);
162+
cl_git_mkfile("empty_standard_repo/.git/other", "[foo]\nbar=baz\n");
163+
_repo = cl_git_sandbox_reopen();
164+
165+
git_str_dispose(&buf);
166+
167+
cl_git_pass(git_repository_config(&cfg, _repo));
168+
169+
cl_git_fail_with(GIT_ENOTFOUND,
170+
git_config_get_string_buf(&value, cfg, "foo.bar"));
171+
172+
git_str_dispose(&buf);
173+
git_buf_dispose(&value);
174+
git_config_free(cfg);
175+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x��KN�0DY��GD��#!��C���K�=�8pz���Z�[ԫ��{`g�4:3`N����?����E�� �Bp�8��=w��L�, �`u��bΜh���#�V�S���ᣬop��}��%��s�m�ǃ�c���}���2nNK���Do�%x�E'��I�׃�kO]�J]A��0 �ƃ Z�ʟ���Ɔ_[
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
41a766bb079e18ff6a24571831bd751168799a02

0 commit comments

Comments
 (0)