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
5915d700
Commit
5915d700
authored
Nov 17, 2014
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branch: consider an empty upstream remote config as not found
parent
8aa70737
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
src/branch.c
+6
-0
tests/refs/branches/upstream.c
+16
-0
No files found.
src/branch.c
View file @
5915d700
...
...
@@ -400,6 +400,12 @@ int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *r
if
((
error
=
retrieve_upstream_configuration
(
&
str
,
cfg
,
refname
,
"branch.%s.remote"
))
<
0
)
goto
cleanup
;
if
(
!*
str
)
{
giterr_set
(
GITERR_REFERENCE
,
"branch '%s' does not have an upstream remote"
,
refname
);
error
=
GIT_ENOTFOUND
;
goto
cleanup
;
}
error
=
git_buf_puts
(
buf
,
str
);
cleanup:
...
...
tests/refs/branches/upstream.c
View file @
5915d700
...
...
@@ -70,6 +70,22 @@ void test_refs_branches_upstream__upstream_remote(void)
git_buf_free
(
&
buf
);
}
void
test_refs_branches_upstream__upstream_remote_empty_value
(
void
)
{
git_repository
*
repository
;
git_config
*
cfg
;
git_buf
buf
=
GIT_BUF_INIT
;
repository
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_git_pass
(
git_repository_config
(
&
cfg
,
repository
));
cl_git_pass
(
git_config_set_string
(
cfg
,
"branch.master.remote"
,
""
));
cl_git_fail_with
(
GIT_ENOTFOUND
,
git_branch_upstream_remote
(
&
buf
,
repository
,
"refs/heads/master"
));
cl_git_pass
(
git_config_delete_entry
(
cfg
,
"branch.master.remote"
));
cl_git_fail_with
(
GIT_ENOTFOUND
,
git_branch_upstream_remote
(
&
buf
,
repository
,
"refs/heads/master"
));
cl_git_sandbox_cleanup
();
}
static
void
assert_merge_and_or_remote_key_missing
(
git_repository
*
repository
,
const
git_commit
*
target
,
const
char
*
entry_name
)
{
git_reference
*
branch
;
...
...
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