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
73d25f0e
Commit
73d25f0e
authored
Jul 29, 2022
by
yuangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove build errors
parent
68bbcefd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
128 deletions
+21
-128
include/git2/remote.h
+6
-6
include/git2/repository.h
+1
-0
src/libgit2/clone.c
+1
-1
src/libgit2/commit.c
+1
-1
src/libgit2/fetch.c
+1
-6
src/libgit2/repository.c
+3
-106
src/libgit2/transports/smart_pkt.c
+8
-8
No files found.
include/git2/remote.h
View file @
73d25f0e
...
...
@@ -744,6 +744,11 @@ typedef struct {
git_proxy_options
proxy_opts
;
/**
* Depth of the fetch to perform
*/
int
depth
;
/**
* Whether to allow off-site redirects. If this is not
* specified, the `http.followRedirects` configuration setting
* will be consulted.
...
...
@@ -754,16 +759,11 @@ typedef struct {
* Extra headers for this fetch operation
*/
git_strarray
custom_headers
;
/**
* Depth of the fetch to perform
*/
int
depth
;
}
git_fetch_options
;
#define GIT_FETCH_OPTIONS_VERSION 1
#define GIT_FETCH_OPTIONS_INIT { GIT_FETCH_OPTIONS_VERSION, GIT_REMOTE_CALLBACKS_INIT, GIT_FETCH_PRUNE_UNSPECIFIED, 1, \
GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, GIT_PROXY_OPTIONS_INIT,
{ NULL },
-1 }
GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, GIT_PROXY_OPTIONS_INIT, -1 }
/**
* Initialize git_fetch_options structure
...
...
include/git2/repository.h
View file @
73d25f0e
...
...
@@ -11,6 +11,7 @@
#include "types.h"
#include "oid.h"
#include "buffer.h"
#include "oidarray.h"
/**
* @file git2/repository.h
...
...
src/libgit2/clone.c
View file @
73d25f0e
...
...
@@ -411,7 +411,7 @@ static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch
fetch_opts
.
update_fetchhead
=
0
;
if
(
fetch_opts
.
depth
==
-
1
)
fetch_opts
.
download_tags
=
GIT_REMOTE_DOWNLOAD_TAGS_ALL
;
git_
buf
_printf
(
&
reflog_message
,
"clone: from %s"
,
git_remote_url
(
remote
));
git_
str
_printf
(
&
reflog_message
,
"clone: from %s"
,
git_remote_url
(
remote
));
if
((
error
=
git_remote_fetch
(
remote
,
NULL
,
&
fetch_opts
,
git_str_cstr
(
&
reflog_message
)))
!=
0
)
goto
cleanup
;
...
...
src/libgit2/commit.c
View file @
73d25f0e
...
...
@@ -422,7 +422,7 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
buffer
+=
tree_len
;
}
while
(
git_o
id__parse
(
&
parent_id
,
&
buffer
,
buffer_end
,
"parent "
)
==
0
)
{
while
(
git_o
bject__parse_oid_header
(
&
parent_id
,
&
buffer
,
buffer_end
,
"parent "
,
GIT_OID_SHA1
)
==
0
)
{
git_oid
*
new_id
=
git_array_alloc
(
commit
->
parent_ids
);
GIT_ERROR_CHECK_ALLOC
(
new_id
);
...
...
src/libgit2/fetch.c
View file @
73d25f0e
...
...
@@ -209,12 +209,7 @@ int git_fetch_download_pack(git_remote *remote)
if
(
!
remote
->
need_pack
)
return
0
;
if
(
callbacks
)
{
progress
=
callbacks
->
transfer_progress
;
payload
=
callbacks
->
payload
;
}
if
((
error
=
t
->
download_pack
(
t
,
remote
->
repo
,
&
remote
->
stats
,
progress
,
payload
))
<
0
)
if
((
error
=
t
->
download_pack
(
t
,
remote
->
repo
,
&
remote
->
stats
))
<
0
)
return
error
;
if
((
error
=
git_repository__shallow_roots_write
(
remote
->
repo
,
remote
->
nego
.
shallow_roots
->
array
))
<
0
)
...
...
src/libgit2/repository.c
View file @
73d25f0e
...
...
@@ -3340,109 +3340,6 @@ int git_repository_state_cleanup(git_repository *repo)
return
git_repository__cleanup_files
(
repo
,
state_files
,
ARRAY_SIZE
(
state_files
));
}
// int git_repository__shallow_roots(git_array_oid_t *out, git_repository *repo)
// {
// git_buf path = GIT_BUF_INIT;
// git_buf contents = GIT_BUF_INIT;
// int error, updated, line_num = 1;
// char *line;
// chror = git_futils_readbuffer_updated(&contents, git_buf_cstr(&path), &repo->shallow_grafts->git_grafts->path_checksum, &updated);
// git_buf_dispose(&path);
// if (error < 0 && error != GIT_ENOTFOUND)
// return error;
// /* cancel out GIT_ENOTFOUND */
// git_error_clear();
// error = 0;
// if (!updated) {
// out = repo->shallow_grafts;
// goto cleanup;
// }
// git_array_clear(repo->shallow_grafts);
// buffer = contents.ptr;
// while ((line = git__strsep(&buffer, "\n")) != NULL) {
// git_oid *oid = git_array_alloc(repo->shallow_grafts);
// error = git_oid_fromstr(oid, line);
// if (error < 0) {
// git_error_set(GIT_ERROR_REPOSITORY, "Invalid OID at line %d", line_num);
// git_array_clear(repo->shallow_grafts);
// error = -1;
// goto cleanup;
// }
// ++line_num;
// }
// if (*buffer) {
// git_error_set(GIT_ERROR_REPOSITORY, "No EOL at line %d", line_num);
// git_array_clear(repo->shallow_grafts);
// error = -1;
// goto cleanup;
// }
// *out = repo->shallow_grafts;
// cleanup:
// git_buf_dispose(&contents);
// return error;ar *buffer;
// assert(out && repo);
// if ((error = git_buf_joinpath(&path, repo->gitdir, "shallow")) < 0)
// return error;
// //error = git_futils_readbuffer_updated(&contents, git_buf_cstr(&path), &repo->shallow_checksum, &updated);
// error = git_futils_readbuffer_updated(&contents, git_buf_cstr(&path), &repo->shallow_grafts->git_grafts->path_checksum, &updated);
// git_buf_dispose(&path);
// if (error < 0 && error != GIT_ENOTFOUND)
// return error;
// /* cancel out GIT_ENOTFOUND */
// git_error_clear();
// error = 0;
// if (!updated) {
// out = repo->shallow_grafts;
// goto cleanup;
// }
// git_array_clear(repo->shallow_grafts);
// buffer = contents.ptr;
// while ((line = git__strsep(&buffer, "\n")) != NULL) {
// git_oid *oid = git_array_alloc(repo->shallow_grafts);
// error = git_oid_fromstr(oid, line);
// if (error < 0) {
// git_error_set(GIT_ERROR_REPOSITORY, "Invalid OID at line %d", line_num);
// git_array_clear(repo->shallow_grafts);
// error = -1;
// goto cleanup;
// }
// ++line_num;
// }
// if (*buffer) {
// git_error_set(GIT_ERROR_REPOSITORY, "No EOL at line %d", line_num);
// git_array_clear(repo->shallow_grafts);
// error = -1;
// goto cleanup;
// }
// *out = repo->shallow_grafts;
// cleanup:
// git_buf_dispose(&contents);
// return error;
// }
int
git_repository__shallow_roots
(
git_array_oid_t
*
out
,
git_repository
*
repo
)
{
int
error
=
0
;
if
(
!
repo
->
shallow_grafts
)
...
...
@@ -3455,17 +3352,17 @@ int git_repository__shallow_roots(git_array_oid_t *out, git_repository *repo) {
int
git_repository__shallow_roots_write
(
git_repository
*
repo
,
git_array_oid_t
roots
)
{
git_filebuf
file
=
GIT_FILEBUF_INIT
;
git_
buf
path
=
GIT_BUF
_INIT
;
git_
str
path
=
GIT_STR
_INIT
;
int
error
=
0
;
size_t
idx
;
git_oid
*
oid
;
assert
(
repo
);
if
((
error
=
git_
buf
_joinpath
(
&
path
,
repo
->
gitdir
,
"shallow"
))
<
0
)
if
((
error
=
git_
str
_joinpath
(
&
path
,
repo
->
gitdir
,
"shallow"
))
<
0
)
return
error
;
if
((
error
=
git_filebuf_open
(
&
file
,
git_
buf
_cstr
(
&
path
),
GIT_FILEBUF_HASH_CONTENTS
,
0666
))
<
0
)
if
((
error
=
git_filebuf_open
(
&
file
,
git_
str
_cstr
(
&
path
),
GIT_FILEBUF_HASH_CONTENTS
,
0666
))
<
0
)
return
error
;
git_array_foreach
(
roots
,
idx
,
oid
)
{
...
...
src/libgit2/transports/smart_pkt.c
View file @
73d25f0e
...
...
@@ -678,23 +678,23 @@ int git_pkt_buffer_wants(
git_buf
shallow_buf
=
GIT_BUF_INIT
;
git_oid_fmt
(
oid
,
git_shallowarray_get
(
wants
->
shallow_roots
,
i
));
git_
buf
_puts
(
&
shallow_buf
,
"shallow "
);
git_
buf
_put
(
&
shallow_buf
,
oid
,
GIT_OID_HEXSZ
);
git_
buf
_putc
(
&
shallow_buf
,
'\n'
);
git_
str
_puts
(
&
shallow_buf
,
"shallow "
);
git_
str
_put
(
&
shallow_buf
,
oid
,
GIT_OID_HEXSZ
);
git_
str
_putc
(
&
shallow_buf
,
'\n'
);
git_
buf_printf
(
buf
,
"%04x%s"
,
(
unsigned
int
)
git_buf_len
(
&
shallow_buf
)
+
4
,
git_buf
_cstr
(
&
shallow_buf
));
git_
str_printf
(
buf
,
"%04x%s"
,
(
unsigned
int
)
git_str_len
(
&
shallow_buf
)
+
4
,
git_str
_cstr
(
&
shallow_buf
));
if
(
git_
buf
_oom
(
buf
))
if
(
git_
str
_oom
(
buf
))
return
-
1
;
}
if
(
wants
->
depth
>
0
)
{
git_buf
deepen_buf
=
GIT_BUF_INIT
;
git_
buf
_printf
(
&
deepen_buf
,
"deepen %d
\n
"
,
wants
->
depth
);
git_
buf_printf
(
buf
,
"%04x%s"
,
(
unsigned
int
)
git_buf_len
(
&
deepen_buf
)
+
4
,
git_buf
_cstr
(
&
deepen_buf
));
git_
str
_printf
(
&
deepen_buf
,
"deepen %d
\n
"
,
wants
->
depth
);
git_
str_printf
(
buf
,
"%04x%s"
,
(
unsigned
int
)
git_str_len
(
&
deepen_buf
)
+
4
,
git_str
_cstr
(
&
deepen_buf
));
if
(
git_
buf
_oom
(
buf
))
if
(
git_
str
_oom
(
buf
))
return
-
1
;
}
...
...
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