Skip to content

Commit de665a4

Browse files
committed
remote: improve apply_insteadof function signature
1 parent 93d321a commit de665a4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/remote.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
static int dwim_refspecs(git_vector *out, git_vector *refspecs, git_vector *refs);
3232
static int lookup_remote_prune_config(git_remote *remote, git_config *config, const char *name);
33-
char *apply_insteadof(git_config *config, const char *url, int direction, int *matched);
33+
char *apply_insteadof(bool *matched, git_config *config, const char *url, int direction);
3434

3535
static int add_refspec_to(git_vector *vector, const char *string, bool is_fetch)
3636
{
@@ -212,7 +212,7 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
212212
const git_remote_create_options dummy_opts = GIT_REMOTE_CREATE_OPTIONS_INIT;
213213
char *tmp;
214214
int error = -1;
215-
int matched;
215+
bool matched;
216216

217217
GIT_ASSERT_ARG(out);
218218
GIT_ASSERT_ARG(url);
@@ -247,8 +247,8 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
247247
goto on_error;
248248

249249
if (opts->repository && !(opts->flags & GIT_REMOTE_CREATE_SKIP_INSTEADOF)) {
250-
remote->url = apply_insteadof(config_ro, canonical_url.ptr, GIT_DIRECTION_FETCH, &matched);
251-
tmp = apply_insteadof(config_ro, canonical_url.ptr, GIT_DIRECTION_PUSH, &matched);
250+
remote->url = apply_insteadof(&matched, config_ro, canonical_url.ptr, GIT_DIRECTION_FETCH);
251+
tmp = apply_insteadof(&matched, config_ro, canonical_url.ptr, GIT_DIRECTION_PUSH);
252252
if (matched) {
253253
remote->pushurl = tmp;
254254
GIT_ERROR_CHECK_ALLOC(remote->pushurl);
@@ -466,7 +466,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
466466
const char *val;
467467
char *tmp;
468468
int error = 0;
469-
int matched;
469+
bool matched;
470470
git_config *config;
471471
struct refspec_cb_data data = { NULL };
472472
bool optional_setting_found = false, found;
@@ -507,9 +507,9 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
507507
remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO;
508508

509509
if (found && strlen(val) > 0) {
510-
remote->url = apply_insteadof(config, val, GIT_DIRECTION_FETCH, &matched);
510+
remote->url = apply_insteadof(&matched, config, val, GIT_DIRECTION_FETCH);
511511
GIT_ERROR_CHECK_ALLOC(remote->url);
512-
tmp = apply_insteadof(config, val, GIT_DIRECTION_PUSH, &matched);
512+
tmp = apply_insteadof(&matched, config, val, GIT_DIRECTION_PUSH);
513513
if (matched) {
514514
remote->pushurl = tmp;
515515
GIT_ERROR_CHECK_ALLOC(remote->pushurl);
@@ -535,7 +535,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
535535
if (remote->pushurl) {
536536
git__free(remote->pushurl);
537537
}
538-
remote->pushurl = apply_insteadof(config, val, GIT_DIRECTION_FETCH, &matched);
538+
remote->pushurl = apply_insteadof(&matched, config, val, GIT_DIRECTION_FETCH);
539539
GIT_ERROR_CHECK_ALLOC(remote->pushurl);
540540
}
541541

@@ -2736,7 +2736,7 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
27362736
#define SUFFIX_FETCH "insteadof"
27372737
#define SUFFIX_PUSH "pushinsteadof"
27382738

2739-
char *apply_insteadof(git_config *config, const char *url, int direction, int *matched)
2739+
char *apply_insteadof(bool *matched, git_config *config, const char *url, int direction)
27402740
{
27412741
size_t match_length, prefix_length, suffix_length;
27422742
char *replacement = NULL;

0 commit comments

Comments
 (0)