rugged 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -34
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +5 -5
- data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
- data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
- data/vendor/libgit2/include/git2/apply.h +2 -0
- data/vendor/libgit2/include/git2/blob.h +17 -1
- data/vendor/libgit2/include/git2/common.h +5 -0
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/diff.h +1 -1
- data/vendor/libgit2/include/git2/index.h +2 -2
- data/vendor/libgit2/include/git2/indexer.h +2 -1
- data/vendor/libgit2/include/git2/odb.h +15 -20
- data/vendor/libgit2/include/git2/refs.h +3 -3
- data/vendor/libgit2/include/git2/repository.h +95 -52
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/tree.h +2 -0
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/blame.c +15 -10
- data/vendor/libgit2/src/blob.c +9 -0
- data/vendor/libgit2/src/clone.c +42 -21
- data/vendor/libgit2/src/config_cache.c +6 -3
- data/vendor/libgit2/src/diff_tform.c +2 -2
- data/vendor/libgit2/src/index.c +6 -5
- data/vendor/libgit2/src/indexer.c +19 -3
- data/vendor/libgit2/src/integer.h +15 -0
- data/vendor/libgit2/src/merge.c +5 -2
- data/vendor/libgit2/src/mwindow.c +3 -1
- data/vendor/libgit2/src/odb.c +4 -3
- data/vendor/libgit2/src/pack.c +10 -6
- data/vendor/libgit2/src/posix.c +32 -9
- data/vendor/libgit2/src/posix.h +9 -0
- data/vendor/libgit2/src/refdb_fs.c +4 -2
- data/vendor/libgit2/src/refs.c +20 -7
- data/vendor/libgit2/src/refs.h +1 -1
- data/vendor/libgit2/src/refspec.c +48 -32
- data/vendor/libgit2/src/remote.c +13 -7
- data/vendor/libgit2/src/repository.c +15 -15
- data/vendor/libgit2/src/repository.h +1 -1
- data/vendor/libgit2/src/thread-utils.h +24 -19
- data/vendor/libgit2/src/transports/httpclient.c +9 -4
- data/vendor/libgit2/src/transports/winhttp.c +99 -52
- data/vendor/libgit2/src/unix/posix.h +3 -0
- data/vendor/libgit2/src/win32/posix_w32.c +70 -0
- data/vendor/libgit2/src/worktree.c +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a1ceba88401d9f47e851b97baaa27f2604baa0bb47ee81a4616e238c0706867
|
4
|
+
data.tar.gz: 514e432c6e411dfe4e185e5cfcd831c5110cf7a1da819390de46045b01446ea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb345a0ed8a223c30f86e0878b098d9e88b9d2b096bdb67b3b3fb9c82be6c8b9dd5677224f50b1d765032386eaa3926b331864af5b754bc175cd9a268fd939da
|
7
|
+
data.tar.gz: 959b9bb61ab95c6f250a605984846577f74a1b33a9165ca1daa7641f8f1b507f239d5b17bfb4de01180c81eb1e7d3ff3ba5aa6aa40740cb0788753040e5d887d
|
data/lib/rugged/version.rb
CHANGED
@@ -16,6 +16,7 @@ ELSEIF(USE_HTTPS STREQUAL "OpenSSL")
|
|
16
16
|
SET(SRC_NTLMCLIENT_CRYPTO "crypt_openssl.c")
|
17
17
|
ELSEIF(USE_HTTPS STREQUAL "mbedTLS")
|
18
18
|
ADD_DEFINITIONS(-DCRYPT_MBEDTLS)
|
19
|
+
INCLUDE_DIRECTORIES(${MBEDTLS_INCLUDE_DIR})
|
19
20
|
SET(SRC_NTLMCLIENT_CRYPTO "crypt_mbedtls.c")
|
20
21
|
ELSE()
|
21
22
|
MESSAGE(FATAL_ERROR "Unable to use libgit2's HTTPS backend (${USE_HTTPS}) for NTLM crypto")
|
@@ -21,40 +21,6 @@
|
|
21
21
|
# include <stdbool.h>
|
22
22
|
#endif
|
23
23
|
|
24
|
-
#if defined(_WIN32) || defined(__APPLE__)
|
25
|
-
/* winsock and macOS > 10.9 have htonll already */
|
26
|
-
#elif defined(__linux__)
|
27
|
-
/* See man page endian(3) */
|
28
|
-
# include <endian.h>
|
29
|
-
# define htonll htobe64
|
30
|
-
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
31
|
-
/* See man page htobe64(3) */
|
32
|
-
# include <endian.h>
|
33
|
-
# define htonll htobe64
|
34
|
-
#elif defined(__FreeBSD__)
|
35
|
-
/* See man page bwaps64(9) */
|
36
|
-
# include <sys/endian.h>
|
37
|
-
# define htonll htobe64
|
38
|
-
#elif defined(sun) || defined(__sun)
|
39
|
-
/* See man page byteorder(3SOCKET) */
|
40
|
-
# include <sys/types.h>
|
41
|
-
# include <netinet/in.h>
|
42
|
-
# include <inttypes.h>
|
43
|
-
|
44
|
-
# if !defined(htonll)
|
45
|
-
# if defined(_BIG_ENDIAN)
|
46
|
-
# define htonll(x) (x)
|
47
|
-
# else
|
48
|
-
# define htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl((uint64_t)(x) >> 32))
|
49
|
-
# endif
|
50
|
-
# endif
|
51
|
-
#elif defined(__HAIKU__)
|
52
|
-
# include <ByteOrder.h>
|
53
|
-
# define htonll B_HOST_TO_BENDIAN_INT64
|
54
|
-
#else
|
55
|
-
# error "Please implement htonll for your platform"
|
56
|
-
#endif
|
57
|
-
|
58
24
|
#ifndef MIN
|
59
25
|
# define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
60
26
|
#endif
|
@@ -132,10 +132,10 @@ int ntlm_client_set_hostname(
|
|
132
132
|
static void free_credentials(ntlm_client *ntlm)
|
133
133
|
{
|
134
134
|
if (ntlm->password)
|
135
|
-
|
135
|
+
ntlm_memzero(ntlm->password, strlen(ntlm->password));
|
136
136
|
|
137
137
|
if (ntlm->password_utf16)
|
138
|
-
|
138
|
+
ntlm_memzero(ntlm->password_utf16, ntlm->password_utf16_len);
|
139
139
|
|
140
140
|
free(ntlm->username);
|
141
141
|
free(ntlm->username_upper);
|
@@ -1125,7 +1125,7 @@ static bool generate_lm2_response(ntlm_client *ntlm,
|
|
1125
1125
|
size_t lm2_len = 16;
|
1126
1126
|
uint64_t local_nonce;
|
1127
1127
|
|
1128
|
-
local_nonce =
|
1128
|
+
local_nonce = ntlm_htonll(ntlm->nonce);
|
1129
1129
|
|
1130
1130
|
if (!ntlm_hmac_ctx_reset(ntlm->hmac_ctx) ||
|
1131
1131
|
!ntlm_hmac_md5_init(ntlm->hmac_ctx,
|
@@ -1197,8 +1197,8 @@ static bool generate_ntlm2_response(ntlm_client *ntlm)
|
|
1197
1197
|
|
1198
1198
|
/* the blob's integer values are in network byte order */
|
1199
1199
|
signature = htonl(0x01010000);
|
1200
|
-
timestamp =
|
1201
|
-
nonce =
|
1200
|
+
timestamp = ntlm_htonll(ntlm->timestamp);
|
1201
|
+
nonce = ntlm_htonll(ntlm->nonce);
|
1202
1202
|
|
1203
1203
|
/* construct the blob */
|
1204
1204
|
memcpy(&blob[0], &signature, 4);
|
@@ -8,14 +8,28 @@
|
|
8
8
|
|
9
9
|
#include <stdlib.h>
|
10
10
|
#include <stdint.h>
|
11
|
+
#include <arpa/inet.h>
|
11
12
|
|
12
13
|
#include "compat.h"
|
13
14
|
#include "util.h"
|
14
15
|
|
15
|
-
void
|
16
|
+
void ntlm_memzero(void *data, size_t size)
|
16
17
|
{
|
17
18
|
volatile uint8_t *scan = (volatile uint8_t *)data;
|
18
19
|
|
19
20
|
while (size--)
|
20
21
|
*scan++ = 0x0;
|
21
22
|
}
|
23
|
+
|
24
|
+
uint64_t ntlm_htonll(uint64_t value)
|
25
|
+
{
|
26
|
+
static union {
|
27
|
+
uint32_t i;
|
28
|
+
char c[8];
|
29
|
+
} test = { 0x01020304 };
|
30
|
+
|
31
|
+
if (test.c[0] == 0x01)
|
32
|
+
return value;
|
33
|
+
else
|
34
|
+
return ((uint64_t)htonl(value) << 32) | htonl((uint64_t)value >> 32);
|
35
|
+
}
|
@@ -100,6 +100,7 @@ GIT_EXTERN(int) git_apply_options_init(git_apply_options *opts, unsigned int ver
|
|
100
100
|
* @param preimage the tree to apply the diff to
|
101
101
|
* @param diff the diff to apply
|
102
102
|
* @param options the options for the apply (or null for defaults)
|
103
|
+
* @return 0 or an error code
|
103
104
|
*/
|
104
105
|
GIT_EXTERN(int) git_apply_to_tree(
|
105
106
|
git_index **out,
|
@@ -137,6 +138,7 @@ typedef enum {
|
|
137
138
|
* @param diff the diff to apply
|
138
139
|
* @param location the location to apply (workdir, index or both)
|
139
140
|
* @param options the options for the apply (or null for defaults)
|
141
|
+
* @return 0 or an error code
|
140
142
|
*/
|
141
143
|
GIT_EXTERN(int) git_apply(
|
142
144
|
git_repository *repo,
|
@@ -118,6 +118,10 @@ typedef enum {
|
|
118
118
|
|
119
119
|
/**
|
120
120
|
* The options used when applying filter options to a file.
|
121
|
+
*
|
122
|
+
* Initialize with `GIT_BLOB_FILTER_OPTIONS_INIT`. Alternatively, you can
|
123
|
+
* use `git_blob_filter_options_init`.
|
124
|
+
*
|
121
125
|
*/
|
122
126
|
typedef struct {
|
123
127
|
int version;
|
@@ -129,6 +133,18 @@ typedef struct {
|
|
129
133
|
#define GIT_BLOB_FILTER_OPTIONS_VERSION 1
|
130
134
|
#define GIT_BLOB_FILTER_OPTIONS_INIT {GIT_BLOB_FILTER_OPTIONS_VERSION, GIT_BLOB_FILTER_CHECK_FOR_BINARY}
|
131
135
|
|
136
|
+
/**
|
137
|
+
* Initialize git_blob_filter_options structure
|
138
|
+
*
|
139
|
+
* Initializes a `git_blob_filter_options` with default values. Equivalent
|
140
|
+
* to creating an instance with `GIT_BLOB_FILTER_OPTIONS_INIT`.
|
141
|
+
*
|
142
|
+
* @param opts The `git_blob_filter_options` struct to initialize.
|
143
|
+
* @param version The struct version; pass `GIT_BLOB_FILTER_OPTIONS_VERSION`.
|
144
|
+
* @return Zero on success; -1 on failure.
|
145
|
+
*/
|
146
|
+
GIT_EXTERN(int) git_blob_filter_options_init(git_blob_filter_options *opts, unsigned int version);
|
147
|
+
|
132
148
|
/**
|
133
149
|
* Get a buffer with the filtered content of a blob.
|
134
150
|
*
|
@@ -229,7 +245,7 @@ GIT_EXTERN(int) git_blob_create_from_stream_commit(
|
|
229
245
|
* Write an in-memory buffer to the ODB as a blob
|
230
246
|
*
|
231
247
|
* @param id return the id of the written blob
|
232
|
-
* @param repo repository where
|
248
|
+
* @param repo repository where the blob will be written
|
233
249
|
* @param buffer data to be written into the blob
|
234
250
|
* @param len length of the data
|
235
251
|
* @return 0 or an error code
|
@@ -356,6 +356,11 @@ typedef enum {
|
|
356
356
|
* >
|
357
357
|
* > - `ciphers` is the list of ciphers that are eanbled.
|
358
358
|
*
|
359
|
+
* * opts(GIT_OPT_GET_USER_AGENT, git_buf *out)
|
360
|
+
*
|
361
|
+
* > Get the value of the User-Agent header.
|
362
|
+
* > The User-Agent is written to the `out` buffer.
|
363
|
+
*
|
359
364
|
* * opts(GIT_OPT_ENABLE_OFS_DELTA, int enabled)
|
360
365
|
*
|
361
366
|
* > Enable or disable the use of "offset deltas" when creating packfiles,
|
@@ -263,7 +263,7 @@ GIT_EXTERN(int) git_config_open_level(
|
|
263
263
|
*
|
264
264
|
* Git allows you to store your global configuration at
|
265
265
|
* `$HOME/.gitconfig` or `$XDG_CONFIG_HOME/git/config`. For backwards
|
266
|
-
*
|
266
|
+
* compatibility, the XDG file shouldn't be used unless the use has
|
267
267
|
* created it explicitly. With this function you'll open the correct
|
268
268
|
* one to write to.
|
269
269
|
*
|
@@ -998,7 +998,7 @@ GIT_EXTERN(size_t) git_diff_num_deltas(const git_diff *diff);
|
|
998
998
|
/**
|
999
999
|
* Query how many diff deltas are there in a diff filtered by type.
|
1000
1000
|
*
|
1001
|
-
* This works just like `
|
1001
|
+
* This works just like `git_diff_num_deltas()` with an extra parameter
|
1002
1002
|
* that is a `git_delta_t` and returns just the count of how many deltas
|
1003
1003
|
* match that particular type.
|
1004
1004
|
*
|
@@ -349,7 +349,7 @@ GIT_EXTERN(int) git_index_write_tree(git_oid *out, git_index *index);
|
|
349
349
|
*
|
350
350
|
* The index must not contain any file in conflict.
|
351
351
|
*
|
352
|
-
* @param out Pointer where to store OID of the
|
352
|
+
* @param out Pointer where to store OID of the written tree
|
353
353
|
* @param index Index to write
|
354
354
|
* @param repo Repository where to write the tree
|
355
355
|
* @return 0 on success, GIT_EUNMERGED when the index is not clean
|
@@ -702,7 +702,7 @@ GIT_EXTERN(int) git_index_update_all(
|
|
702
702
|
* @param at_pos the address to which the position of the index entry is written (optional)
|
703
703
|
* @param index an existing index object
|
704
704
|
* @param path path to search
|
705
|
-
* @return
|
705
|
+
* @return 0 with valid value in at_pos; an error code otherwise
|
706
706
|
*/
|
707
707
|
GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *path);
|
708
708
|
|
@@ -51,7 +51,7 @@ typedef struct git_indexer_progress {
|
|
51
51
|
* Type for progress callbacks during indexing. Return a value less
|
52
52
|
* than zero to cancel the indexing or download.
|
53
53
|
*
|
54
|
-
* @param stats Structure containing information about the state of the
|
54
|
+
* @param stats Structure containing information about the state of the transfer
|
55
55
|
* @param payload Payload provided by caller
|
56
56
|
*/
|
57
57
|
typedef int GIT_CALLBACK(git_indexer_progress_cb)(const git_indexer_progress *stats, void *payload);
|
@@ -64,6 +64,7 @@ typedef struct git_indexer_options {
|
|
64
64
|
|
65
65
|
/** progress_cb function to call with progress information */
|
66
66
|
git_indexer_progress_cb progress_cb;
|
67
|
+
|
67
68
|
/** progress_cb_payload payload for the progress callback */
|
68
69
|
void *progress_cb_payload;
|
69
70
|
|
@@ -70,7 +70,7 @@ GIT_EXTERN(int) git_odb_open(git_odb **out, const char *objects_dir);
|
|
70
70
|
*
|
71
71
|
* @param odb database to add the backend to
|
72
72
|
* @param path path to the objects folder for the alternate
|
73
|
-
* @return 0 on success
|
73
|
+
* @return 0 on success, error code otherwise
|
74
74
|
*/
|
75
75
|
GIT_EXTERN(int) git_odb_add_disk_alternate(git_odb *odb, const char *path);
|
76
76
|
|
@@ -94,9 +94,8 @@ GIT_EXTERN(void) git_odb_free(git_odb *db);
|
|
94
94
|
* @param out pointer where to store the read object
|
95
95
|
* @param db database to search for the object in.
|
96
96
|
* @param id identity of the object to read.
|
97
|
-
* @return
|
98
|
-
*
|
99
|
-
* - GIT_ENOTFOUND if the object is not in the database.
|
97
|
+
* @return 0 if the object was read, GIT_ENOTFOUND if the object is
|
98
|
+
* not in the database.
|
100
99
|
*/
|
101
100
|
GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id);
|
102
101
|
|
@@ -122,10 +121,9 @@ GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *i
|
|
122
121
|
* @param db database to search for the object in.
|
123
122
|
* @param short_id a prefix of the id of the object to read.
|
124
123
|
* @param len the length of the prefix
|
125
|
-
* @return
|
126
|
-
*
|
127
|
-
*
|
128
|
-
* - GIT_EAMBIGUOUS if the prefix is ambiguous (several objects match the prefix)
|
124
|
+
* @return 0 if the object was read, GIT_ENOTFOUND if the object is not in the
|
125
|
+
* database. GIT_EAMBIGUOUS if the prefix is ambiguous
|
126
|
+
* (several objects match the prefix)
|
129
127
|
*/
|
130
128
|
GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git_oid *short_id, size_t len);
|
131
129
|
|
@@ -143,9 +141,8 @@ GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git
|
|
143
141
|
* @param type_out pointer where to store the type
|
144
142
|
* @param db database to search for the object in.
|
145
143
|
* @param id identity of the object to read.
|
146
|
-
* @return
|
147
|
-
*
|
148
|
-
* - GIT_ENOTFOUND if the object is not in the database.
|
144
|
+
* @return 0 if the object was read, GIT_ENOTFOUND if the object is not
|
145
|
+
* in the database.
|
149
146
|
*/
|
150
147
|
GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_object_t *type_out, git_odb *db, const git_oid *id);
|
151
148
|
|
@@ -154,9 +151,7 @@ GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_object_t *type_out, git
|
|
154
151
|
*
|
155
152
|
* @param db database to be searched for the given object.
|
156
153
|
* @param id the object to search for.
|
157
|
-
* @return
|
158
|
-
* - 1, if the object was found
|
159
|
-
* - 0, otherwise
|
154
|
+
* @return 1 if the object was found, 0 otherwise
|
160
155
|
*/
|
161
156
|
GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id);
|
162
157
|
|
@@ -305,7 +300,7 @@ GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_obje
|
|
305
300
|
* @param stream the stream
|
306
301
|
* @param buffer the data to write
|
307
302
|
* @param len the buffer's length
|
308
|
-
* @return 0 if the write succeeded
|
303
|
+
* @return 0 if the write succeeded, error code otherwise
|
309
304
|
*/
|
310
305
|
GIT_EXTERN(int) git_odb_stream_write(git_odb_stream *stream, const char *buffer, size_t len);
|
311
306
|
|
@@ -320,7 +315,7 @@ GIT_EXTERN(int) git_odb_stream_write(git_odb_stream *stream, const char *buffer,
|
|
320
315
|
*
|
321
316
|
* @param out pointer to store the resulting object's id
|
322
317
|
* @param stream the stream
|
323
|
-
* @return 0 on success
|
318
|
+
* @return 0 on success, an error code otherwise
|
324
319
|
*/
|
325
320
|
GIT_EXTERN(int) git_odb_stream_finalize_write(git_oid *out, git_odb_stream *stream);
|
326
321
|
|
@@ -362,7 +357,7 @@ GIT_EXTERN(void) git_odb_stream_free(git_odb_stream *stream);
|
|
362
357
|
* @param type pointer where to store the type of the object
|
363
358
|
* @param db object database where the stream will read from
|
364
359
|
* @param oid oid of the object the stream will read from
|
365
|
-
* @return 0 if the stream was created
|
360
|
+
* @return 0 if the stream was created, error code otherwise
|
366
361
|
*/
|
367
362
|
GIT_EXTERN(int) git_odb_open_rstream(
|
368
363
|
git_odb_stream **out,
|
@@ -501,7 +496,7 @@ GIT_EXTERN(git_object_t) git_odb_object_type(git_odb_object *object);
|
|
501
496
|
* @param odb database to add the backend to
|
502
497
|
* @param backend pointer to a git_odb_backend instance
|
503
498
|
* @param priority Value for ordering the backends queue
|
504
|
-
* @return 0 on success
|
499
|
+
* @return 0 on success, error code otherwise
|
505
500
|
*/
|
506
501
|
GIT_EXTERN(int) git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int priority);
|
507
502
|
|
@@ -522,7 +517,7 @@ GIT_EXTERN(int) git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int
|
|
522
517
|
* @param odb database to add the backend to
|
523
518
|
* @param backend pointer to a git_odb_backend instance
|
524
519
|
* @param priority Value for ordering the backends queue
|
525
|
-
* @return 0 on success
|
520
|
+
* @return 0 on success, error code otherwise
|
526
521
|
*/
|
527
522
|
GIT_EXTERN(int) git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority);
|
528
523
|
|
@@ -540,7 +535,7 @@ GIT_EXTERN(size_t) git_odb_num_backends(git_odb *odb);
|
|
540
535
|
* @param out output pointer to ODB backend at pos
|
541
536
|
* @param odb object database
|
542
537
|
* @param pos index into object database backend list
|
543
|
-
* @return 0 on success
|
538
|
+
* @return 0 on success, GIT_ENOTFOUND if pos is invalid, other errors < 0
|
544
539
|
*/
|
545
540
|
GIT_EXTERN(int) git_odb_get_backend(git_odb_backend **out, git_odb *odb, size_t pos);
|
546
541
|
|
@@ -169,7 +169,7 @@ GIT_EXTERN(int) git_reference_symbolic_create(git_reference **out, git_repositor
|
|
169
169
|
*
|
170
170
|
* The message for the reflog will be ignored if the reference does
|
171
171
|
* not belong in the standard set (HEAD, branches and remote-tracking
|
172
|
-
* branches) and
|
172
|
+
* branches) and it does not have a reflog.
|
173
173
|
*
|
174
174
|
* @param out Pointer to the newly created reference
|
175
175
|
* @param repo Repository where that reference will live
|
@@ -206,7 +206,7 @@ GIT_EXTERN(int) git_reference_create(git_reference **out, git_repository *repo,
|
|
206
206
|
*
|
207
207
|
* The message for the reflog will be ignored if the reference does
|
208
208
|
* not belong in the standard set (HEAD, branches and remote-tracking
|
209
|
-
* branches) and
|
209
|
+
* branches) and it does not have a reflog.
|
210
210
|
*
|
211
211
|
* It will return GIT_EMODIFIED if the reference's value at the time
|
212
212
|
* of updating does not match the one passed through `current_id`
|
@@ -318,7 +318,7 @@ GIT_EXTERN(git_repository *) git_reference_owner(const git_reference *ref);
|
|
318
318
|
*
|
319
319
|
* The message for the reflog will be ignored if the reference does
|
320
320
|
* not belong in the standard set (HEAD, branches and remote-tracking
|
321
|
-
* branches) and
|
321
|
+
* branches) and it does not have a reflog.
|
322
322
|
*
|
323
323
|
* @param out Pointer to the newly created reference
|
324
324
|
* @param ref The reference
|
@@ -219,36 +219,54 @@ GIT_EXTERN(int) git_repository_init(
|
|
219
219
|
*
|
220
220
|
* These flags configure extra behaviors to `git_repository_init_ext`.
|
221
221
|
* In every case, the default behavior is the zero value (i.e. flag is
|
222
|
-
* not set).
|
223
|
-
* when initializing a new repo.
|
224
|
-
*
|
225
|
-
* * BARE - Create a bare repository with no working directory.
|
226
|
-
* * NO_REINIT - Return an GIT_EEXISTS error if the repo_path appears to
|
227
|
-
* already be an git repository.
|
228
|
-
* * NO_DOTGIT_DIR - Normally a "/.git/" will be appended to the repo
|
229
|
-
* path for non-bare repos (if it is not already there), but
|
230
|
-
* passing this flag prevents that behavior.
|
231
|
-
* * MKDIR - Make the repo_path (and workdir_path) as needed. Init is
|
232
|
-
* always willing to create the ".git" directory even without this
|
233
|
-
* flag. This flag tells init to create the trailing component of
|
234
|
-
* the repo and workdir paths as needed.
|
235
|
-
* * MKPATH - Recursively make all components of the repo and workdir
|
236
|
-
* paths as necessary.
|
237
|
-
* * EXTERNAL_TEMPLATE - libgit2 normally uses internal templates to
|
238
|
-
* initialize a new repo. This flags enables external templates,
|
239
|
-
* looking the "template_path" from the options if set, or the
|
240
|
-
* `init.templatedir` global config if not, or falling back on
|
241
|
-
* "/usr/share/git-core/templates" if it exists.
|
242
|
-
* * GIT_REPOSITORY_INIT_RELATIVE_GITLINK - If an alternate workdir is
|
243
|
-
* specified, use relative paths for the gitdir and core.worktree.
|
222
|
+
* not set). Just OR the flag values together for the `flags` parameter
|
223
|
+
* when initializing a new repo.
|
244
224
|
*/
|
245
225
|
typedef enum {
|
226
|
+
/**
|
227
|
+
* Create a bare repository with no working directory.
|
228
|
+
*/
|
246
229
|
GIT_REPOSITORY_INIT_BARE = (1u << 0),
|
230
|
+
|
231
|
+
/**
|
232
|
+
* Return an GIT_EEXISTS error if the repo_path appears to already be
|
233
|
+
* an git repository.
|
234
|
+
*/
|
247
235
|
GIT_REPOSITORY_INIT_NO_REINIT = (1u << 1),
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Normally a "/.git/" will be appended to the repo path for
|
239
|
+
* non-bare repos (if it is not already there), but passing this flag
|
240
|
+
* prevents that behavior.
|
241
|
+
*/
|
248
242
|
GIT_REPOSITORY_INIT_NO_DOTGIT_DIR = (1u << 2),
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Make the repo_path (and workdir_path) as needed. Init is always willing
|
246
|
+
* to create the ".git" directory even without this flag. This flag tells
|
247
|
+
* init to create the trailing component of the repo and workdir paths
|
248
|
+
* as needed.
|
249
|
+
*/
|
249
250
|
GIT_REPOSITORY_INIT_MKDIR = (1u << 3),
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Recursively make all components of the repo and workdir paths as
|
254
|
+
* necessary.
|
255
|
+
*/
|
250
256
|
GIT_REPOSITORY_INIT_MKPATH = (1u << 4),
|
257
|
+
|
258
|
+
/**
|
259
|
+
* libgit2 normally uses internal templates to initialize a new repo.
|
260
|
+
* This flags enables external templates, looking the "template_path" from
|
261
|
+
* the options if set, or the `init.templatedir` global config if not,
|
262
|
+
* or falling back on "/usr/share/git-core/templates" if it exists.
|
263
|
+
*/
|
251
264
|
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE = (1u << 5),
|
265
|
+
|
266
|
+
/**
|
267
|
+
* If an alternate workdir is specified, use relative paths for the gitdir
|
268
|
+
* and core.worktree.
|
269
|
+
*/
|
252
270
|
GIT_REPOSITORY_INIT_RELATIVE_GITLINK = (1u << 6),
|
253
271
|
} git_repository_init_flag_t;
|
254
272
|
|
@@ -257,17 +275,23 @@ typedef enum {
|
|
257
275
|
*
|
258
276
|
* Set the mode field of the `git_repository_init_options` structure
|
259
277
|
* either to the custom mode that you would like, or to one of the
|
260
|
-
*
|
261
|
-
*
|
262
|
-
* * SHARED_UMASK - Use permissions configured by umask - the default.
|
263
|
-
* * SHARED_GROUP - Use "--shared=group" behavior, chmod'ing the new repo
|
264
|
-
* to be group writable and "g+sx" for sticky group assignment.
|
265
|
-
* * SHARED_ALL - Use "--shared=all" behavior, adding world readability.
|
266
|
-
* * Anything else - Set to custom value.
|
278
|
+
* defined modes.
|
267
279
|
*/
|
268
280
|
typedef enum {
|
281
|
+
/**
|
282
|
+
* Use permissions configured by umask - the default.
|
283
|
+
*/
|
269
284
|
GIT_REPOSITORY_INIT_SHARED_UMASK = 0,
|
285
|
+
|
286
|
+
/**
|
287
|
+
* Use "--shared=group" behavior, chmod'ing the new repo to be group
|
288
|
+
* writable and "g+sx" for sticky group assignment.
|
289
|
+
*/
|
270
290
|
GIT_REPOSITORY_INIT_SHARED_GROUP = 0002775,
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Use "--shared=all" behavior, adding world readability.
|
294
|
+
*/
|
271
295
|
GIT_REPOSITORY_INIT_SHARED_ALL = 0002777,
|
272
296
|
} git_repository_init_mode_t;
|
273
297
|
|
@@ -275,38 +299,57 @@ typedef enum {
|
|
275
299
|
* Extended options structure for `git_repository_init_ext`.
|
276
300
|
*
|
277
301
|
* This contains extra options for `git_repository_init_ext` that enable
|
278
|
-
* additional initialization features.
|
279
|
-
*
|
280
|
-
* * flags - Combination of GIT_REPOSITORY_INIT flags above.
|
281
|
-
* * mode - Set to one of the standard GIT_REPOSITORY_INIT_SHARED_...
|
282
|
-
* constants above, or to a custom value that you would like.
|
283
|
-
* * workdir_path - The path to the working dir or NULL for default (i.e.
|
284
|
-
* repo_path parent on non-bare repos). IF THIS IS RELATIVE PATH,
|
285
|
-
* IT WILL BE EVALUATED RELATIVE TO THE REPO_PATH. If this is not
|
286
|
-
* the "natural" working directory, a .git gitlink file will be
|
287
|
-
* created here linking to the repo_path.
|
288
|
-
* * description - If set, this will be used to initialize the "description"
|
289
|
-
* file in the repository, instead of using the template content.
|
290
|
-
* * template_path - When GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE is set,
|
291
|
-
* this contains the path to use for the template directory. If
|
292
|
-
* this is NULL, the config or default directory options will be
|
293
|
-
* used instead.
|
294
|
-
* * initial_head - The name of the head to point HEAD at. If NULL, then
|
295
|
-
* this will be treated as "master" and the HEAD ref will be set
|
296
|
-
* to "refs/heads/master". If this begins with "refs/" it will be
|
297
|
-
* used verbatim; otherwise "refs/heads/" will be prefixed.
|
298
|
-
* * origin_url - If this is non-NULL, then after the rest of the
|
299
|
-
* repository initialization is completed, an "origin" remote
|
300
|
-
* will be added pointing to this URL.
|
302
|
+
* additional initialization features.
|
301
303
|
*/
|
302
304
|
typedef struct {
|
303
305
|
unsigned int version;
|
306
|
+
|
307
|
+
/**
|
308
|
+
* Combination of GIT_REPOSITORY_INIT flags above.
|
309
|
+
*/
|
304
310
|
uint32_t flags;
|
311
|
+
|
312
|
+
/**
|
313
|
+
* Set to one of the standard GIT_REPOSITORY_INIT_SHARED_... constants
|
314
|
+
* above, or to a custom value that you would like.
|
315
|
+
*/
|
305
316
|
uint32_t mode;
|
317
|
+
|
318
|
+
/**
|
319
|
+
* The path to the working dir or NULL for default (i.e. repo_path parent
|
320
|
+
* on non-bare repos). IF THIS IS RELATIVE PATH, IT WILL BE EVALUATED
|
321
|
+
* RELATIVE TO THE REPO_PATH. If this is not the "natural" working
|
322
|
+
* directory, a .git gitlink file will be created here linking to the
|
323
|
+
* repo_path.
|
324
|
+
*/
|
306
325
|
const char *workdir_path;
|
326
|
+
|
327
|
+
/**
|
328
|
+
* If set, this will be used to initialize the "description" file in the
|
329
|
+
* repository, instead of using the template content.
|
330
|
+
*/
|
307
331
|
const char *description;
|
332
|
+
|
333
|
+
/**
|
334
|
+
* When GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE is set, this contains
|
335
|
+
* the path to use for the template directory. If this is NULL, the config
|
336
|
+
* or default directory options will be used instead.
|
337
|
+
*/
|
308
338
|
const char *template_path;
|
339
|
+
|
340
|
+
/**
|
341
|
+
* The name of the head to point HEAD at. If NULL, then this will be
|
342
|
+
* treated as "master" and the HEAD ref will be set to "refs/heads/master".
|
343
|
+
* If this begins with "refs/" it will be used verbatim;
|
344
|
+
* otherwise "refs/heads/" will be prefixed.
|
345
|
+
*/
|
309
346
|
const char *initial_head;
|
347
|
+
|
348
|
+
/**
|
349
|
+
* If this is non-NULL, then after the rest of the repository
|
350
|
+
* initialization is completed, an "origin" remote will be added
|
351
|
+
* pointing to this URL.
|
352
|
+
*/
|
310
353
|
const char *origin_url;
|
311
354
|
} git_repository_init_options;
|
312
355
|
|