File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -1822,7 +1822,8 @@ static int update_one_tip(
18221822 if (error < 0 && error != GIT_ENOTFOUND )
18231823 goto done ;
18241824
1825- if (!spec -> force &&
1825+ if (!(error || error == GIT_ENOTFOUND ) &&
1826+ !spec -> force &&
18261827 !git_graph_descendant_of (remote -> repo , & head -> oid , & old )) {
18271828 error = 0 ;
18281829 goto done ;
@@ -1856,6 +1857,7 @@ static int update_one_tip(
18561857
18571858done :
18581859 git_reference_free (ref );
1860+ git_str_dispose (& refname );
18591861 return error ;
18601862}
18611863
Original file line number Diff line number Diff line change 1+ #include "clar_libgit2.h"
2+ #include "futils.h"
3+
4+ static git_repository * repo ;
5+
6+ void test_fetch_local__initialize (void )
7+ {
8+ cl_git_pass (git_repository_init (& repo , "./fetch" , 0 ));
9+ }
10+
11+ void test_fetch_local__cleanup (void )
12+ {
13+ git_repository_free (repo );
14+ repo = NULL ;
15+
16+ cl_fixture_cleanup ("./fetch" );
17+ }
18+
19+ void test_fetch_local__defaults (void )
20+ {
21+ git_remote * remote ;
22+ git_object * obj ;
23+ git_oid expected_id ;
24+
25+ cl_git_pass (git_remote_create (& remote , repo , "test" ,
26+ cl_fixture ("testrepo.git" )));
27+ cl_git_pass (git_remote_fetch (remote , NULL , NULL , NULL ));
28+
29+ git_oid_fromstr (& expected_id , "258f0e2a959a364e40ed6603d5d44fbb24765b10" );
30+
31+ cl_git_pass (git_revparse_single (& obj , repo , "refs/remotes/test/haacked" ));
32+ cl_assert_equal_oid (& expected_id , git_object_id (obj ));
33+
34+ git_object_free (obj );
35+ git_remote_free (remote );
36+ }
You can’t perform that action at this time.
0 commit comments