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
07264ea7
Commit
07264ea7
authored
Feb 06, 2022
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch: add a test for local fetching
parent
37d98aaf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletions
+39
-1
src/remote.c
+3
-1
tests/fetch/local.c
+36
-0
No files found.
src/remote.c
View file @
07264ea7
...
...
@@ -1822,7 +1822,8 @@ static int update_one_tip(
if
(
error
<
0
&&
error
!=
GIT_ENOTFOUND
)
goto
done
;
if
(
!
spec
->
force
&&
if
(
!
(
error
||
error
==
GIT_ENOTFOUND
)
&&
!
spec
->
force
&&
!
git_graph_descendant_of
(
remote
->
repo
,
&
head
->
oid
,
&
old
))
{
error
=
0
;
goto
done
;
...
...
@@ -1856,6 +1857,7 @@ static int update_one_tip(
done
:
git_reference_free
(
ref
);
git_str_dispose
(
&
refname
);
return
error
;
}
...
...
tests/fetch/local.c
0 → 100644
View file @
07264ea7
#include "clar_libgit2.h"
#include "futils.h"
static
git_repository
*
repo
;
void
test_fetch_local__initialize
(
void
)
{
cl_git_pass
(
git_repository_init
(
&
repo
,
"./fetch"
,
0
));
}
void
test_fetch_local__cleanup
(
void
)
{
git_repository_free
(
repo
);
repo
=
NULL
;
cl_fixture_cleanup
(
"./fetch"
);
}
void
test_fetch_local__defaults
(
void
)
{
git_remote
*
remote
;
git_object
*
obj
;
git_oid
expected_id
;
cl_git_pass
(
git_remote_create
(
&
remote
,
repo
,
"test"
,
cl_fixture
(
"testrepo.git"
)));
cl_git_pass
(
git_remote_fetch
(
remote
,
NULL
,
NULL
,
NULL
));
git_oid_fromstr
(
&
expected_id
,
"258f0e2a959a364e40ed6603d5d44fbb24765b10"
);
cl_git_pass
(
git_revparse_single
(
&
obj
,
repo
,
"refs/remotes/test/haacked"
));
cl_assert_equal_oid
(
&
expected_id
,
git_object_id
(
obj
));
git_object_free
(
obj
);
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