Skip to content

Commit 37e9278

Browse files
author
Edward Thomson
authored
Merge pull request libgit2#3834 from pks-t/pks/cleanups
Cleanups
2 parents 6944fd3 + fe345c7 commit 37e9278

File tree

6 files changed

+6
-99
lines changed

6 files changed

+6
-99
lines changed

src/clone.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,6 @@ int git_clone_init_options(git_clone_options *opts, unsigned int version)
461461
return 0;
462462
}
463463

464-
static const char *repository_base(git_repository *repo)
465-
{
466-
if (git_repository_is_bare(repo))
467-
return git_repository_path(repo);
468-
469-
return git_repository_workdir(repo);
470-
}
471-
472464
static bool can_link(const char *src, const char *dst, int link)
473465
{
474466
#ifdef GIT_WIN32

src/diff_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static git_diff_driver global_drivers[3] = {
5959
{ DIFF_DRIVER_TEXT, GIT_DIFF_FORCE_TEXT, 0 },
6060
};
6161

62-
git_diff_driver_registry *git_diff_driver_registry_new()
62+
git_diff_driver_registry *git_diff_driver_registry_new(void)
6363
{
6464
git_diff_driver_registry *reg =
6565
git__calloc(1, sizeof(git_diff_driver_registry));

src/remote.c

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -547,53 +547,6 @@ static int lookup_remote_prune_config(git_remote *remote, git_config *config, co
547547
return error;
548548
}
549549

550-
static int update_config_refspec(const git_remote *remote, git_config *config, int direction)
551-
{
552-
git_buf name = GIT_BUF_INIT;
553-
unsigned int push;
554-
const char *dir;
555-
size_t i;
556-
int error = 0;
557-
const char *cname;
558-
559-
push = direction == GIT_DIRECTION_PUSH;
560-
dir = push ? "push" : "fetch";
561-
562-
if (git_buf_printf(&name, "remote.%s.%s", remote->name, dir) < 0)
563-
return -1;
564-
cname = git_buf_cstr(&name);
565-
566-
/* Clear out the existing config */
567-
while (!error)
568-
error = git_config_delete_multivar(config, cname, ".*");
569-
570-
if (error != GIT_ENOTFOUND)
571-
return error;
572-
573-
for (i = 0; i < remote->refspecs.length; i++) {
574-
git_refspec *spec = git_vector_get(&remote->refspecs, i);
575-
576-
if (spec->push != push)
577-
continue;
578-
579-
// "$^" is a unmatcheable regexp: it will not match anything at all, so
580-
// all values will be considered new and we will not replace any
581-
// present value.
582-
if ((error = git_config_set_multivar(
583-
config, cname, "$^", spec->string)) < 0) {
584-
goto cleanup;
585-
}
586-
}
587-
588-
giterr_clear();
589-
error = 0;
590-
591-
cleanup:
592-
git_buf_free(&name);
593-
594-
return error;
595-
}
596-
597550
const char *git_remote_name(const git_remote *remote)
598551
{
599552
assert(remote);
@@ -2103,34 +2056,6 @@ int git_remote_add_push(git_repository *repo, const char *remote, const char *re
21032056
return write_add_refspec(repo, remote, refspec, false);
21042057
}
21052058

2106-
static int set_refspecs(git_remote *remote, git_strarray *array, int push)
2107-
{
2108-
git_vector *vec = &remote->refspecs;
2109-
git_refspec *spec;
2110-
size_t i;
2111-
2112-
/* Start by removing any refspecs of the same type */
2113-
for (i = 0; i < vec->length; i++) {
2114-
spec = git_vector_get(vec, i);
2115-
if (spec->push != push)
2116-
continue;
2117-
2118-
git_refspec__free(spec);
2119-
git__free(spec);
2120-
git_vector_remove(vec, i);
2121-
i--;
2122-
}
2123-
2124-
/* And now we add the new ones */
2125-
2126-
for (i = 0; i < array->count; i++) {
2127-
if (add_refspec(remote, array->strings[i], !push) < 0)
2128-
return -1;
2129-
}
2130-
2131-
return 0;
2132-
}
2133-
21342059
static int copy_refspecs(git_strarray *array, const git_remote *remote, unsigned int push)
21352060
{
21362061
size_t i;

src/settings.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void git_libgit2_version(int *major, int *minor, int *rev)
2323
*rev = LIBGIT2_VER_REVISION;
2424
}
2525

26-
int git_libgit2_features()
26+
int git_libgit2_features(void)
2727
{
2828
return 0
2929
#ifdef GIT_THREADS
@@ -73,12 +73,12 @@ static int config_level_to_sysdir(int config_level)
7373
extern char *git__user_agent;
7474
extern char *git__ssl_ciphers;
7575

76-
const char *git_libgit2__user_agent()
76+
const char *git_libgit2__user_agent(void)
7777
{
7878
return git__user_agent;
7979
}
8080

81-
const char *git_libgit2__ssl_ciphers()
81+
const char *git_libgit2__ssl_ciphers(void)
8282
{
8383
return git__ssl_ciphers;
8484
}

tests/clar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ clar_test_init(int argc, char **argv)
409409
}
410410

411411
int
412-
clar_test_run()
412+
clar_test_run(void)
413413
{
414414
if (_clar.argc > 1)
415415
clar_parse_args(_clar.argc, _clar.argv);
@@ -424,7 +424,7 @@ clar_test_run()
424424
}
425425

426426
void
427-
clar_test_shutdown()
427+
clar_test_shutdown(void)
428428
{
429429
clar_print_shutdown(
430430
_clar.tests_ran,

tests/network/remote/rename.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ void test_network_remote_rename__cleanup(void)
1616
cl_git_sandbox_cleanup();
1717
}
1818

19-
static int dont_call_me_cb(const char *fetch_refspec, void *payload)
20-
{
21-
GIT_UNUSED(fetch_refspec);
22-
GIT_UNUSED(payload);
23-
24-
cl_assert(false);
25-
26-
return -1;
27-
}
28-
2919
void test_network_remote_rename__renaming_a_remote_moves_related_configuration_section(void)
3020
{
3121
git_strarray problems = {0};

0 commit comments

Comments
 (0)