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
a5696702
Unverified
Commit
a5696702
authored
Jul 08, 2021
by
Alex Good
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skip descendant check if remote ref not found
parent
39fd7646
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
20 deletions
+7
-20
src/remote.c
+3
-1
tests/remote/fetch.c
+4
-19
No files found.
src/remote.c
View file @
a5696702
...
...
@@ -1460,7 +1460,9 @@ static int update_tips_for_spec(
if
(
error
<
0
&&
error
!=
GIT_ENOTFOUND
)
goto
on_error
;
if
(
!
error
&&
!
spec
->
force
&&
!
git_graph_descendant_of
(
remote
->
repo
,
&
head
->
oid
,
&
old
))
if
(
!
(
error
||
error
==
GIT_ENOTFOUND
)
&&
!
spec
->
force
&&
!
git_graph_descendant_of
(
remote
->
repo
,
&
head
->
oid
,
&
old
))
continue
;
if
(
error
==
GIT_ENOTFOUND
)
{
...
...
tests/remote/fetch.c
View file @
a5696702
...
...
@@ -13,33 +13,18 @@ static const char *REPO2_REFNAME = "refs/remotes/repo1/main";
static
char
*
FORCE_FETCHSPEC
=
"+refs/heads/main:refs/remotes/repo1/main"
;
static
char
*
NON_FORCE_FETCHSPEC
=
"refs/heads/main:refs/remotes/repo1/main"
;
char
*
strip_trailing_slash
(
char
*
path
)
{
if
(
path
[
strlen
(
path
)
-
1
]
==
'/'
)
{
char
*
result
=
(
char
*
)
calloc
(
strlen
(
path
)
-
1
,
sizeof
(
char
));
memcpy
(
result
,
path
,
strlen
(
path
)
-
1
);
return
result
;
}
else
{
char
*
result
=
(
char
*
)
calloc
(
strlen
(
path
),
sizeof
(
char
));
strncpy
(
result
,
path
,
strlen
(
path
));
return
result
;
}
}
void
test_remote_fetch__initialize
(
void
)
{
git_config
*
c
;
git_buf
repo1_path_buf
=
GIT_BUF_INIT
;
git_buf
repo2_path_buf
=
GIT_BUF_INIT
;
const
char
*
sandbox
=
clar_sandbox_path
();
cl_git_pass
(
git_buf_join
(
&
repo1_path_buf
,
'/'
,
sandbox
,
"fetchtest_repo1"
));
repo1_path
=
calloc
(
repo1_path_buf
.
size
,
sizeof
(
char
));
git_buf_copy_cstr
(
repo1_path
,
repo1_path_buf
.
size
,
&
repo1_path_buf
);
cl_git_pass
(
git_buf_joinpath
(
&
repo1_path_buf
,
sandbox
,
"fetchtest_repo1"
));
repo1_path
=
git_buf_detach
(
&
repo1_path_buf
);
cl_git_pass
(
git_repository_init
(
&
repo1
,
repo1_path
,
true
));
cl_git_pass
(
git_buf_join
(
&
repo2_path_buf
,
'/'
,
sandbox
,
"fetchtest_repo2"
));
repo2_path
=
calloc
(
repo2_path_buf
.
size
,
sizeof
(
char
));
git_buf_copy_cstr
(
repo2_path
,
repo2_path_buf
.
size
,
&
repo2_path_buf
);
cl_git_pass
(
git_buf_joinpath
(
&
repo2_path_buf
,
sandbox
,
"fetchtest_repo2"
));
repo2_path
=
git_buf_detach
(
&
repo2_path_buf
);
cl_git_pass
(
git_repository_init
(
&
repo2
,
repo2_path
,
true
));
cl_git_pass
(
git_repository_config
(
&
c
,
repo1
));
...
...
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