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
096d9e94
Commit
096d9e94
authored
Oct 07, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remote: use constants for well-known names
parent
74a24005
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
src/clone.c
+2
-2
src/remote.h
+2
-0
src/repository.c
+2
-1
No files found.
src/clone.c
View file @
096d9e94
...
@@ -51,7 +51,7 @@ static int create_tracking_branch(git_repository *repo, const git_oid *target, c
...
@@ -51,7 +51,7 @@ static int create_tracking_branch(git_repository *repo, const git_oid *target, c
if
(
!
git_buf_printf
(
&
remote
,
"branch.%s.remote"
,
name
)
&&
if
(
!
git_buf_printf
(
&
remote
,
"branch.%s.remote"
,
name
)
&&
!
git_buf_printf
(
&
merge
,
"branch.%s.merge"
,
name
)
&&
!
git_buf_printf
(
&
merge
,
"branch.%s.merge"
,
name
)
&&
!
git_buf_printf
(
&
merge_target
,
GIT_REFS_HEADS_DIR
"%s"
,
name
)
&&
!
git_buf_printf
(
&
merge_target
,
GIT_REFS_HEADS_DIR
"%s"
,
name
)
&&
!
git_config_set_string
(
cfg
,
git_buf_cstr
(
&
remote
),
"origin"
)
&&
!
git_config_set_string
(
cfg
,
git_buf_cstr
(
&
remote
),
GIT_REMOTE_ORIGIN
)
&&
!
git_config_set_string
(
cfg
,
git_buf_cstr
(
&
merge
),
git_buf_cstr
(
&
merge_target
)))
{
!
git_config_set_string
(
cfg
,
git_buf_cstr
(
&
merge
),
git_buf_cstr
(
&
merge_target
)))
{
retcode
=
0
;
retcode
=
0
;
}
}
...
@@ -150,7 +150,7 @@ static int setup_remotes_and_fetch(git_repository *repo,
...
@@ -150,7 +150,7 @@ static int setup_remotes_and_fetch(git_repository *repo,
if
(
!
fetch_stats
)
fetch_stats
=
&
dummy_stats
;
if
(
!
fetch_stats
)
fetch_stats
=
&
dummy_stats
;
/* Create the "origin" remote */
/* Create the "origin" remote */
if
(
!
git_remote_add
(
&
origin
,
repo
,
"origin"
,
origin_url
))
{
if
(
!
git_remote_add
(
&
origin
,
repo
,
GIT_REMOTE_ORIGIN
,
origin_url
))
{
/* Connect and download everything */
/* Connect and download everything */
if
(
!
git_remote_connect
(
origin
,
GIT_DIR_FETCH
))
{
if
(
!
git_remote_connect
(
origin
,
GIT_DIR_FETCH
))
{
if
(
!
git_remote_download
(
origin
,
&
bytes
,
fetch_stats
))
{
if
(
!
git_remote_download
(
origin
,
&
bytes
,
fetch_stats
))
{
...
...
src/remote.h
View file @
096d9e94
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
#include "transport.h"
#include "transport.h"
#include "repository.h"
#include "repository.h"
#define GIT_REMOTE_ORIGIN "origin"
struct
git_remote
{
struct
git_remote
{
char
*
name
;
char
*
name
;
char
*
url
;
char
*
url
;
...
...
src/repository.c
View file @
096d9e94
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "refs.h"
#include "refs.h"
#include "filter.h"
#include "filter.h"
#include "odb.h"
#include "odb.h"
#include "remote.h"
#define GIT_FILE_CONTENT_PREFIX "gitdir:"
#define GIT_FILE_CONTENT_PREFIX "gitdir:"
...
@@ -1095,7 +1096,7 @@ static int repo_init_create_origin(git_repository *repo, const char *url)
...
@@ -1095,7 +1096,7 @@ static int repo_init_create_origin(git_repository *repo, const char *url)
int
error
;
int
error
;
git_remote
*
remote
;
git_remote
*
remote
;
if
(
!
(
error
=
git_remote_add
(
&
remote
,
repo
,
"origin"
,
url
)))
{
if
(
!
(
error
=
git_remote_add
(
&
remote
,
repo
,
GIT_REMOTE_ORIGIN
,
url
)))
{
error
=
git_remote_save
(
remote
);
error
=
git_remote_save
(
remote
);
git_remote_free
(
remote
);
git_remote_free
(
remote
);
}
}
...
...
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