Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
de665a43
Commit
de665a43
authored
Nov 11, 2021
by
Martin Kühl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remote: improve apply_insteadof function signature
parent
93d321ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
src/remote.c
+9
-9
No files found.
src/remote.c
View file @
de665a43
...
...
@@ -30,7 +30,7 @@
static
int
dwim_refspecs
(
git_vector
*
out
,
git_vector
*
refspecs
,
git_vector
*
refs
);
static
int
lookup_remote_prune_config
(
git_remote
*
remote
,
git_config
*
config
,
const
char
*
name
);
char
*
apply_insteadof
(
git_config
*
config
,
const
char
*
url
,
int
direction
,
int
*
matched
);
char
*
apply_insteadof
(
bool
*
matched
,
git_config
*
config
,
const
char
*
url
,
int
direction
);
static
int
add_refspec_to
(
git_vector
*
vector
,
const
char
*
string
,
bool
is_fetch
)
{
...
...
@@ -212,7 +212,7 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
const
git_remote_create_options
dummy_opts
=
GIT_REMOTE_CREATE_OPTIONS_INIT
;
char
*
tmp
;
int
error
=
-
1
;
int
matched
;
bool
matched
;
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
url
);
...
...
@@ -247,8 +247,8 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
goto
on_error
;
if
(
opts
->
repository
&&
!
(
opts
->
flags
&
GIT_REMOTE_CREATE_SKIP_INSTEADOF
))
{
remote
->
url
=
apply_insteadof
(
config_ro
,
canonical_url
.
ptr
,
GIT_DIRECTION_FETCH
,
&
matched
);
tmp
=
apply_insteadof
(
config_ro
,
canonical_url
.
ptr
,
GIT_DIRECTION_PUSH
,
&
matched
);
remote
->
url
=
apply_insteadof
(
&
matched
,
config_ro
,
canonical_url
.
ptr
,
GIT_DIRECTION_FETCH
);
tmp
=
apply_insteadof
(
&
matched
,
config_ro
,
canonical_url
.
ptr
,
GIT_DIRECTION_PUSH
);
if
(
matched
)
{
remote
->
pushurl
=
tmp
;
GIT_ERROR_CHECK_ALLOC
(
remote
->
pushurl
);
...
...
@@ -466,7 +466,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
const
char
*
val
;
char
*
tmp
;
int
error
=
0
;
int
matched
;
bool
matched
;
git_config
*
config
;
struct
refspec_cb_data
data
=
{
NULL
};
bool
optional_setting_found
=
false
,
found
;
...
...
@@ -507,9 +507,9 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
remote
->
download_tags
=
GIT_REMOTE_DOWNLOAD_TAGS_AUTO
;
if
(
found
&&
strlen
(
val
)
>
0
)
{
remote
->
url
=
apply_insteadof
(
config
,
val
,
GIT_DIRECTION_FETCH
,
&
matched
);
remote
->
url
=
apply_insteadof
(
&
matched
,
config
,
val
,
GIT_DIRECTION_FETCH
);
GIT_ERROR_CHECK_ALLOC
(
remote
->
url
);
tmp
=
apply_insteadof
(
config
,
val
,
GIT_DIRECTION_PUSH
,
&
matched
);
tmp
=
apply_insteadof
(
&
matched
,
config
,
val
,
GIT_DIRECTION_PUSH
);
if
(
matched
)
{
remote
->
pushurl
=
tmp
;
GIT_ERROR_CHECK_ALLOC
(
remote
->
pushurl
);
...
...
@@ -535,7 +535,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
if
(
remote
->
pushurl
)
{
git__free
(
remote
->
pushurl
);
}
remote
->
pushurl
=
apply_insteadof
(
config
,
val
,
GIT_DIRECTION_FETCH
,
&
matched
);
remote
->
pushurl
=
apply_insteadof
(
&
matched
,
config
,
val
,
GIT_DIRECTION_FETCH
);
GIT_ERROR_CHECK_ALLOC
(
remote
->
pushurl
);
}
...
...
@@ -2736,7 +2736,7 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
#define SUFFIX_FETCH "insteadof"
#define SUFFIX_PUSH "pushinsteadof"
char
*
apply_insteadof
(
git_config
*
config
,
const
char
*
url
,
int
direction
,
int
*
matched
)
char
*
apply_insteadof
(
bool
*
matched
,
git_config
*
config
,
const
char
*
url
,
int
direction
)
{
size_t
match_length
,
prefix_length
,
suffix_length
;
char
*
replacement
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment