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
3ed4b501
Commit
3ed4b501
authored
Jul 25, 2012
by
Sascha Cunz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remotes: Load/Save for fetch.foo.pushurl
parent
cb020f0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
src/remote.c
+32
-0
src/remote.h
+1
-0
No files found.
src/remote.c
View file @
3ed4b501
...
...
@@ -131,6 +131,26 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
GITERR_CHECK_ALLOC
(
remote
->
url
);
git_buf_clear
(
&
buf
);
if
(
git_buf_printf
(
&
buf
,
"remote.%s.pushurl"
,
name
)
<
0
)
{
error
=
-
1
;
goto
cleanup
;
}
error
=
git_config_get_string
(
&
val
,
config
,
git_buf_cstr
(
&
buf
));
if
(
error
==
GIT_ENOTFOUND
)
error
=
0
;
if
(
error
<
0
)
{
error
=
-
1
;
goto
cleanup
;
}
if
(
val
)
{
remote
->
pushurl
=
git__strdup
(
val
);
GITERR_CHECK_ALLOC
(
remote
->
pushurl
);
}
git_buf_clear
(
&
buf
);
if
(
git_buf_printf
(
&
buf
,
"remote.%s.fetch"
,
name
)
<
0
)
{
error
=
-
1
;
goto
cleanup
;
...
...
@@ -187,6 +207,17 @@ int git_remote_save(const git_remote *remote)
return
-
1
;
}
if
(
remote
->
pushurl
)
{
git_buf_clear
(
&
buf
);
if
(
git_buf_printf
(
&
buf
,
"remote.%s.pushurl"
,
remote
->
name
)
<
0
)
return
-
1
;
if
(
git_config_set_string
(
config
,
git_buf_cstr
(
&
buf
),
remote
->
pushurl
)
<
0
)
{
git_buf_free
(
&
buf
);
return
-
1
;
}
}
if
(
remote
->
fetch
.
src
!=
NULL
&&
remote
->
fetch
.
dst
!=
NULL
)
{
git_buf_clear
(
&
buf
);
git_buf_clear
(
&
value
);
...
...
@@ -429,6 +460,7 @@ void git_remote_free(git_remote *remote)
git__free
(
remote
->
push
.
src
);
git__free
(
remote
->
push
.
dst
);
git__free
(
remote
->
url
);
git__free
(
remote
->
pushurl
);
git__free
(
remote
->
name
);
git__free
(
remote
);
}
...
...
src/remote.h
View file @
3ed4b501
...
...
@@ -14,6 +14,7 @@
struct
git_remote
{
char
*
name
;
char
*
url
;
char
*
pushurl
;
git_vector
refs
;
struct
git_refspec
fetch
;
struct
git_refspec
push
;
...
...
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