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
12595ab8
Commit
12595ab8
authored
Jul 12, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revparse: deploy git_reference_remote_tracking_from_branch()
parent
84f18e35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
26 deletions
+6
-26
src/revparse.c
+6
-26
No files found.
src/revparse.c
View file @
12595ab8
...
...
@@ -249,32 +249,12 @@ static int walk_ref_history(git_object **out, git_repository *repo, const char *
date_error
=
git__date_parse
(
&
timestamp
,
git_buf_cstr
(
&
datebuf
));
/* @{u} or @{upstream} -> upstream branch, for a tracking branch. This is stored in the config. */
if
(
!
git__prefixcmp
(
git_reference_name
(
disambiguated
),
GIT_REFS_HEADS_DIR
)
&&
(
!
strcmp
(
reflogspec
,
"@{u}"
)
||
!
strcmp
(
reflogspec
,
"@{upstream}"
)))
{
git_config
*
cfg
;
if
(
!
git_repository_config
(
&
cfg
,
repo
))
{
/* Is the ref a tracking branch? */
const
char
*
remote
;
git_buf_clear
(
&
buf
);
git_buf_printf
(
&
buf
,
"branch.%s.remote"
,
git_reference_name
(
disambiguated
)
+
strlen
(
GIT_REFS_HEADS_DIR
));
if
(
!
git_config_get_string
(
&
remote
,
cfg
,
git_buf_cstr
(
&
buf
)))
{
/* Yes. Find the first merge target name. */
const
char
*
mergetarget
;
git_buf_clear
(
&
buf
);
git_buf_printf
(
&
buf
,
"branch.%s.merge"
,
git_reference_name
(
disambiguated
)
+
strlen
(
GIT_REFS_HEADS_DIR
));
if
(
!
git_config_get_string
(
&
mergetarget
,
cfg
,
git_buf_cstr
(
&
buf
))
&&
!
git__prefixcmp
(
mergetarget
,
"refs/heads/"
))
{
/* Success. Look up the target and fetch the object. */
git_buf_clear
(
&
buf
);
git_buf_printf
(
&
buf
,
"refs/remotes/%s/%s"
,
remote
,
mergetarget
+
11
);
retcode
=
revparse_lookup_fully_qualifed_ref
(
out
,
repo
,
git_buf_cstr
(
&
buf
));
}
}
git_config_free
(
cfg
);
if
(
!
strcmp
(
reflogspec
,
"@{u}"
)
||
!
strcmp
(
reflogspec
,
"@{upstream}"
))
{
git_reference
*
tracking
;
if
(
!
(
retcode
=
git_reference_remote_tracking_from_branch
(
&
tracking
,
disambiguated
)))
{
retcode
=
revparse_lookup_fully_qualifed_ref
(
out
,
repo
,
git_reference_name
(
tracking
));
git_reference_free
(
tracking
);
}
}
...
...
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