Skip to content

Commit 8a708e7

Browse files
lucasderraughCykelero
authored andcommitted
Resolve test failures from API changes
1 parent 705671f commit 8a708e7

File tree

5 files changed

+104
-109
lines changed

5 files changed

+104
-109
lines changed

include/git2/gitup_clone.h

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,51 +15,10 @@
1515
*/
1616
GIT_BEGIN_DECL
1717

18-
/**
19-
* Clone a remote repository.
20-
*
21-
* By default this creates its repository and initial remote to match
22-
* git's defaults. You can use the options in the callback to
23-
* customize how these are created.
24-
*
25-
* @param out pointer that will receive the resulting repository object
26-
* @param url the remote repository to clone
27-
* @param local_path local directory to clone to
28-
* @param options configuration options for the clone. If NULL, the
29-
* function works as though GIT_OPTIONS_INIT were passed.
30-
* @return 0 on success, any non-zero return value from a callback
31-
* function, or a negative value to indicate an error (use
32-
* `git_error_last` for a detailed error message)
33-
*/
34-
35-
/// Use `git_clone instead.
36-
GIT_EXTERN(int) gitup_clone_into(
37-
git_repository **out,
38-
const char *url,
39-
const char *local_path,
40-
const git_clone_options *options
41-
);
42-
43-
/// Deprecated
44-
/**
45-
* Clone a remote repository into an existing empty repository using
46-
* a pre-existing remote.
47-
*
48-
* @param repo the repository to clone into
49-
* @param remote the remote to use for cloning
50-
* @param fetch_opts the fetch options to use
51-
* @param checkout_opts the checkout options to use
52-
* @param branch name of the branch to checkout (NULL means use the
53-
* remote's default branch)
54-
* @return 0 on success, any non-zero return value from a callback
55-
* function, or a negative value to indicate an error
56-
*/
57-
GIT_EXTERN(int) gitup_clone_into_old(
58-
git_repository *repo,
59-
git_remote *remote,
60-
const git_fetch_options *fetch_opts,
61-
const git_checkout_options *checkout_opts,
62-
const char *branch);
18+
GIT_EXTERN(int) gitup_clone_into(git_repository *repo,
19+
git_remote *remote,
20+
const git_fetch_options *fetch_opts,
21+
const git_checkout_options *checkout_opts,
22+
const char *branch);
6323

64-
/** @} */
6524
GIT_END_DECL

include/git2/sys/features.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#ifndef INCLUDE_features_h__
2+
#define INCLUDE_features_h__
3+
4+
/* #undef GIT_DEBUG_POOL */
5+
/* #undef GIT_DEBUG_STRICT_ALLOC */
6+
/* #undef GIT_DEBUG_STRICT_OPEN */
7+
8+
#define GIT_TRACE 1
9+
#define GIT_THREADS 1
10+
/* #undef GIT_WIN32_LEAKCHECK */
11+
12+
#define GIT_ARCH_64 1
13+
/* #undef GIT_ARCH_32 */
14+
15+
#define GIT_USE_ICONV 1
16+
#define GIT_USE_NSEC 1
17+
/* #undef GIT_USE_STAT_MTIM */
18+
#define GIT_USE_STAT_MTIMESPEC 1
19+
/* #undef GIT_USE_STAT_MTIME_NSEC */
20+
#define GIT_USE_FUTIMENS 1
21+
22+
#define GIT_REGEX_REGCOMP_L
23+
/* #undef GIT_REGEX_REGCOMP */
24+
/* #undef GIT_REGEX_PCRE */
25+
/* #undef GIT_REGEX_PCRE2 */
26+
/* #undef GIT_REGEX_BUILTIN */
27+
28+
/* #undef GIT_SSH */
29+
/* #undef GIT_SSH_MEMORY_CREDENTIALS */
30+
31+
#define GIT_NTLM 1
32+
/* #undef GIT_GSSAPI */
33+
/* #undef GIT_GSSFRAMEWORK */
34+
35+
/* #undef GIT_WINHTTP */
36+
#define GIT_HTTPS 1
37+
/* #undef GIT_OPENSSL */
38+
/* #undef GIT_OPENSSL_DYNAMIC */
39+
#define GIT_SECURE_TRANSPORT 1
40+
/* #undef GIT_MBEDTLS */
41+
42+
#define GIT_SHA1_COLLISIONDETECT 1
43+
/* #undef GIT_SHA1_WIN32 */
44+
/* #undef GIT_SHA1_COMMON_CRYPTO */
45+
/* #undef GIT_SHA1_OPENSSL */
46+
/* #undef GIT_SHA1_MBEDTLS */
47+
48+
#endif
49+
#define GIT_SSH_MEMORY_CREDENTIALS 1
50+
#define GIT_SSH 1

src/gitup_clone.c

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/gitup_refs.c

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,47 @@
1111
#include <git2/sys/refs.h>
1212

1313
int gitup_reference_create_virtual(
14-
git_reference **ref_out,
15-
git_repository *repo,
16-
const char *name,
17-
const git_oid *id)
14+
git_reference **ref_out,
15+
git_repository *repo,
16+
const char *name,
17+
const git_oid *id)
1818
{
19-
int force = false;
20-
const char *log_message = "";
21-
return git_reference_create(ref_out, repo, name, id, force, log_message);
19+
int error;
20+
git_refdb *refdb;
21+
git_reference *ref;
22+
23+
assert(ref_out && repo && name && id);
24+
25+
if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0)
26+
return error;
27+
28+
ref = git_reference__alloc(name, id, NULL);
29+
GIT_REFCOUNT_INC(refdb);
30+
ref->db = refdb;
31+
32+
*ref_out = ref;
33+
return 0;
2234
}
2335

2436
int gitup_reference_symbolic_create_virtual(
25-
git_reference **ref_out,
26-
git_repository *repo,
27-
const char *name,
28-
const char *target)
37+
git_reference **ref_out,
38+
git_repository *repo,
39+
const char *name,
40+
const char *target)
2941
{
30-
int force = false;
31-
const char *log_message = "";
32-
return git_reference_symbolic_create(ref_out, repo, name, target, force, log_message);
42+
int error;
43+
git_refdb *refdb;
44+
git_reference *ref;
45+
46+
assert(ref_out && repo && name && target);
47+
48+
if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0)
49+
return error;
50+
51+
ref = git_reference__alloc_symbolic(name, target);
52+
GIT_REFCOUNT_INC(refdb);
53+
ref->db = refdb;
54+
55+
*ref_out = ref;
56+
return 0;
3357
}

src/libgit2/clone.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,17 @@ int git_clone_options_init(git_clone_options *opts, unsigned int version)
698698
return 0;
699699
}
700700

701+
int gitup_clone_into(
702+
git_repository *repo,
703+
git_remote *remote,
704+
const git_fetch_options *fetch_opts,
705+
const git_checkout_options *checkout_opts,
706+
const char *branch)
707+
{
708+
assert(repo && remote && fetch_opts && checkout_opts);
709+
return clone_into(repo, remote, fetch_opts, checkout_opts, branch);
710+
}
711+
701712
#ifndef GIT_DEPRECATE_HARD
702713
int git_clone_init_options(git_clone_options *opts, unsigned int version)
703714
{

0 commit comments

Comments
 (0)