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
4bb87087
Commit
4bb87087
authored
Nov 03, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2683 from libgit2/cmn/remote-unify
remote: unify the creation code
parents
873eb899
a68e217f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
21 deletions
+2
-21
src/remote.c
+2
-21
No files found.
src/remote.c
View file @
4bb87087
...
...
@@ -207,34 +207,15 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
int
git_remote_create
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
)
{
git_buf
buf
=
GIT_BUF_INIT
;
git_remote
*
remote
=
NULL
;
int
error
;
if
((
error
=
ensure_remote_name_is_valid
(
name
))
<
0
)
return
error
;
if
((
error
=
ensure_remote_doesnot_exist
(
repo
,
name
))
<
0
)
return
error
;
if
(
git_buf_printf
(
&
buf
,
"+refs/heads/*:refs/remotes/%s/*"
,
name
)
<
0
)
return
-
1
;
if
(
create_internal
(
&
remote
,
repo
,
name
,
url
,
git_buf_cstr
(
&
buf
))
<
0
)
goto
on_error
;
error
=
git_remote_create_with_fetchspec
(
out
,
repo
,
name
,
url
,
git_buf_cstr
(
&
buf
));
git_buf_free
(
&
buf
);
if
(
git_remote_save
(
remote
)
<
0
)
goto
on_error
;
*
out
=
remote
;
return
0
;
on_error:
git_buf_free
(
&
buf
);
git_remote_free
(
remote
);
return
-
1
;
return
error
;
}
int
git_remote_create_with_fetchspec
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
const
char
*
fetch
)
...
...
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