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
c576d4ff
Commit
c576d4ff
authored
Feb 13, 2017
by
Edward Thomson
Committed by
GitHub
Feb 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4115 from gsaralms/users/gsaral/optionalOfsDelta
Changes to provide option to turn off/on ofs_delta
parents
4f9f8e0d
61acc9fa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletions
+21
-1
include/git2/common.h
+11
-0
src/settings.c
+5
-0
src/transports/smart.h
+2
-0
src/transports/smart_protocol.c
+3
-1
No files found.
include/git2/common.h
View file @
c576d4ff
...
...
@@ -178,6 +178,7 @@ typedef enum {
GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION
,
GIT_OPT_SET_SSL_CIPHERS
,
GIT_OPT_GET_USER_AGENT
,
GIT_OPT_ENABLE_OFS_DELTA
,
}
git_libgit2_opt_t
;
/**
...
...
@@ -305,6 +306,16 @@ typedef enum {
* >
* > - `ciphers` is the list of ciphers that are eanbled.
*
* * opts(GIT_OPT_ENABLE_OFS_DELTA, int enabled)
*
* > Enable or disable the use of "offset deltas" when creating packfiles,
* > and the negotiation of them when talking to a remote server.
* > Offset deltas store a delta base location as an offset into the
* > packfile from the current location, which provides a shorter encoding
* > and thus smaller resultant packfiles.
* > Packfiles containing offset deltas can still be read.
* > This defaults to enabled.
*
* @param option Option key
* @param ... value to set the option
* @return 0 on success, <0 on failure
...
...
src/settings.c
View file @
c576d4ff
...
...
@@ -16,6 +16,7 @@
#include "global.h"
#include "object.h"
#include "refs.h"
#include "transports/smart.h"
void
git_libgit2_version
(
int
*
major
,
int
*
minor
,
int
*
rev
)
{
...
...
@@ -222,6 +223,10 @@ int git_libgit2_opts(int key, ...)
}
break
;
case
GIT_OPT_ENABLE_OFS_DELTA
:
git_smart__ofs_delta_enabled
=
(
va_arg
(
ap
,
int
)
!=
0
);
break
;
default:
giterr_set
(
GITERR_INVALID
,
"invalid option key"
);
error
=
-
1
;
...
...
src/transports/smart.h
View file @
c576d4ff
...
...
@@ -26,6 +26,8 @@
#define GIT_CAP_THIN_PACK "thin-pack"
#define GIT_CAP_SYMREF "symref"
extern
bool
git_smart__ofs_delta_enabled
;
enum
git_pkt_type
{
GIT_PKT_CMD
,
GIT_PKT_FLUSH
,
...
...
src/transports/smart_protocol.c
View file @
c576d4ff
...
...
@@ -19,6 +19,8 @@
/* The minimal interval between progress updates (in seconds). */
#define MIN_PROGRESS_UPDATE_INTERVAL 0.5
bool
git_smart__ofs_delta_enabled
=
true
;
int
git_smart__store_refs
(
transport_smart
*
t
,
int
flushes
)
{
gitno_buffer
*
buf
=
&
t
->
buffer
;
...
...
@@ -138,7 +140,7 @@ int git_smart__detect_caps(git_pkt_ref *pkt, transport_smart_caps *caps, git_vec
if
(
*
ptr
==
' '
)
ptr
++
;
if
(
!
git__prefixcmp
(
ptr
,
GIT_CAP_OFS_DELTA
))
{
if
(
git_smart__ofs_delta_enabled
&&
!
git__prefixcmp
(
ptr
,
GIT_CAP_OFS_DELTA
))
{
caps
->
common
=
caps
->
ofs_delta
=
1
;
ptr
+=
strlen
(
GIT_CAP_OFS_DELTA
);
continue
;
...
...
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