rugged 0.25.0b10 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +5 -0
- data/ext/rugged/rugged.c +3 -20
- data/ext/rugged/rugged.h +3 -20
- data/ext/rugged/rugged_backend.c +3 -20
- data/ext/rugged/rugged_blame.c +7 -24
- data/ext/rugged/rugged_blob.c +5 -22
- data/ext/rugged/rugged_branch.c +3 -20
- data/ext/rugged/rugged_branch_collection.c +3 -20
- data/ext/rugged/rugged_commit.c +37 -24
- data/ext/rugged/rugged_config.c +3 -20
- data/ext/rugged/rugged_cred.c +3 -20
- data/ext/rugged/rugged_diff.c +3 -20
- data/ext/rugged/rugged_diff_delta.c +3 -20
- data/ext/rugged/rugged_diff_hunk.c +3 -20
- data/ext/rugged/rugged_diff_line.c +3 -20
- data/ext/rugged/rugged_index.c +38 -149
- data/ext/rugged/rugged_note.c +3 -20
- data/ext/rugged/rugged_object.c +3 -20
- data/ext/rugged/rugged_patch.c +4 -22
- data/ext/rugged/rugged_rebase.c +3 -20
- data/ext/rugged/rugged_reference.c +4 -21
- data/ext/rugged/rugged_reference_collection.c +3 -20
- data/ext/rugged/rugged_remote.c +4 -21
- data/ext/rugged/rugged_remote_collection.c +3 -20
- data/ext/rugged/rugged_repo.c +5 -22
- data/ext/rugged/rugged_revwalk.c +4 -21
- data/ext/rugged/rugged_settings.c +3 -20
- data/ext/rugged/rugged_signature.c +3 -20
- data/ext/rugged/rugged_submodule.c +4 -21
- data/ext/rugged/rugged_submodule_collection.c +3 -20
- data/ext/rugged/rugged_tag.c +3 -20
- data/ext/rugged/rugged_tag_collection.c +3 -20
- data/ext/rugged/rugged_tree.c +56 -183
- data/lib/rugged.rb +5 -0
- data/lib/rugged/attributes.rb +5 -0
- data/lib/rugged/blob.rb +5 -0
- data/lib/rugged/branch.rb +6 -1
- data/lib/rugged/commit.rb +5 -0
- data/lib/rugged/console.rb +5 -0
- data/lib/rugged/credentials.rb +5 -0
- data/lib/rugged/diff.rb +5 -0
- data/lib/rugged/diff/delta.rb +5 -0
- data/lib/rugged/diff/hunk.rb +5 -0
- data/lib/rugged/diff/line.rb +5 -0
- data/lib/rugged/index.rb +120 -0
- data/lib/rugged/object.rb +5 -0
- data/lib/rugged/patch.rb +5 -0
- data/lib/rugged/reference.rb +5 -0
- data/lib/rugged/remote.rb +5 -0
- data/lib/rugged/repository.rb +6 -1
- data/lib/rugged/submodule_collection.rb +5 -0
- data/lib/rugged/tag.rb +5 -0
- data/lib/rugged/tree.rb +156 -1
- data/lib/rugged/version.rb +6 -1
- data/lib/rugged/walker.rb +5 -0
- data/vendor/libgit2/include/git2/common.h +20 -1
- data/vendor/libgit2/include/git2/describe.h +5 -2
- data/vendor/libgit2/include/git2/patch.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/remote.h +4 -4
- data/vendor/libgit2/include/git2/transaction.h +9 -0
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/src/apply.c +1 -1
- data/vendor/libgit2/src/branch.c +5 -4
- data/vendor/libgit2/src/checkout.c +2 -2
- data/vendor/libgit2/src/commit.c +4 -3
- data/vendor/libgit2/src/common.h +2 -1
- data/vendor/libgit2/src/curl_stream.c +19 -2
- data/vendor/libgit2/src/diff_stats.c +18 -10
- data/vendor/libgit2/src/fetchhead.c +8 -8
- data/vendor/libgit2/src/fileops.c +9 -1
- data/vendor/libgit2/src/fileops.h +2 -2
- data/vendor/libgit2/src/global.c +19 -4
- data/vendor/libgit2/src/global.h +6 -0
- data/vendor/libgit2/src/graph.c +1 -1
- data/vendor/libgit2/src/index.c +1 -1
- data/vendor/libgit2/src/iterator.c +1 -1
- data/vendor/libgit2/src/merge.c +1 -1
- data/vendor/libgit2/src/odb.c +1 -1
- data/vendor/libgit2/src/odb_mempack.c +1 -1
- data/vendor/libgit2/src/openssl_stream.c +45 -26
- data/vendor/libgit2/src/openssl_stream.h +106 -0
- data/vendor/libgit2/src/pack.c +12 -7
- data/vendor/libgit2/src/patch_generate.c +1 -1
- data/vendor/libgit2/src/patch_parse.c +28 -26
- data/vendor/libgit2/src/path.c +5 -2
- data/vendor/libgit2/src/pqueue.c +3 -2
- data/vendor/libgit2/src/rebase.c +1 -1
- data/vendor/libgit2/src/refdb.c +4 -2
- data/vendor/libgit2/src/refdb_fs.c +82 -54
- data/vendor/libgit2/src/repository.c +9 -6
- data/vendor/libgit2/src/revwalk.c +1 -1
- data/vendor/libgit2/src/settings.c +2 -0
- data/vendor/libgit2/src/signature.c +1 -1
- data/vendor/libgit2/src/sortedcache.c +14 -5
- data/vendor/libgit2/src/sysdir.c +1 -1
- data/vendor/libgit2/src/transports/http.c +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -7
- data/vendor/libgit2/src/tree.c +13 -5
- data/vendor/libgit2/src/unix/pthread.h +2 -0
- data/vendor/libgit2/src/win32/thread.c +18 -0
- data/vendor/libgit2/src/win32/thread.h +2 -0
- data/vendor/libgit2/src/win32/w32_util.h +1 -1
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +76 -76
data/lib/rugged/version.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (C) the Rugged contributors. All rights reserved.
|
2
|
+
#
|
3
|
+
# This file is part of Rugged, distributed under the MIT license.
|
4
|
+
# For full terms see the included LICENSE file.
|
5
|
+
|
1
6
|
module Rugged
|
2
|
-
Version = VERSION = '0.25.
|
7
|
+
Version = VERSION = '0.25.0'
|
3
8
|
end
|
data/lib/rugged/walker.rb
CHANGED
@@ -109,9 +109,27 @@ GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
|
|
109
109
|
* was compiled
|
110
110
|
*/
|
111
111
|
typedef enum {
|
112
|
+
/**
|
113
|
+
* If set, libgit2 was built thread-aware and can be safely used from multiple
|
114
|
+
* threads.
|
115
|
+
*/
|
112
116
|
GIT_FEATURE_THREADS = (1 << 0),
|
117
|
+
/**
|
118
|
+
* If set, libgit2 was built with and linked against a TLS implementation.
|
119
|
+
* Custom TLS streams may still be added by the user to support HTTPS
|
120
|
+
* regardless of this.
|
121
|
+
*/
|
113
122
|
GIT_FEATURE_HTTPS = (1 << 1),
|
123
|
+
/**
|
124
|
+
* If set, libgit2 was built with and linked against libssh2. A custom
|
125
|
+
* transport may still be added by the user to support libssh2 regardless of
|
126
|
+
* this.
|
127
|
+
*/
|
114
128
|
GIT_FEATURE_SSH = (1 << 2),
|
129
|
+
/**
|
130
|
+
* If set, libgit2 was built with support for sub-second resolution in file
|
131
|
+
* modification times.
|
132
|
+
*/
|
115
133
|
GIT_FEATURE_NSEC = (1 << 3),
|
116
134
|
} git_feature_t;
|
117
135
|
|
@@ -269,7 +287,8 @@ typedef enum {
|
|
269
287
|
* > to ensure that all inputs to the new objects are valid. For
|
270
288
|
* > example, when this is enabled, the parent(s) and tree inputs
|
271
289
|
* > will be validated when creating a new commit. This defaults
|
272
|
-
* > to
|
290
|
+
* > to enabled.
|
291
|
+
*
|
273
292
|
* * opts(GIT_OPT_SET_SSL_CIPHERS, const char *ciphers)
|
274
293
|
*
|
275
294
|
* > Set the SSL ciphers use for HTTPS connections.
|
@@ -44,8 +44,8 @@ typedef enum {
|
|
44
44
|
typedef struct git_describe_options {
|
45
45
|
unsigned int version;
|
46
46
|
|
47
|
-
unsigned int max_candidates_tags;
|
48
|
-
unsigned int describe_strategy;
|
47
|
+
unsigned int max_candidates_tags; /**< default: 10 */
|
48
|
+
unsigned int describe_strategy; /**< default: GIT_DESCRIBE_DEFAULT */
|
49
49
|
const char *pattern;
|
50
50
|
/**
|
51
51
|
* When calculating the distance from the matching tag or
|
@@ -105,6 +105,9 @@ typedef struct {
|
|
105
105
|
|
106
106
|
GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
|
107
107
|
|
108
|
+
/**
|
109
|
+
* A struct that stores the result of a describe operation.
|
110
|
+
*/
|
108
111
|
typedef struct git_describe_result git_describe_result;
|
109
112
|
|
110
113
|
/**
|
@@ -191,7 +191,7 @@ GIT_EXTERN(int) git_patch_get_hunk(
|
|
191
191
|
*
|
192
192
|
* @param patch The git_patch object
|
193
193
|
* @param hunk_idx Index of the hunk
|
194
|
-
* @return Number of lines in hunk or
|
194
|
+
* @return Number of lines in hunk or GIT_ENOTFOUND if invalid hunk index
|
195
195
|
*/
|
196
196
|
GIT_EXTERN(int) git_patch_num_lines_in_hunk(
|
197
197
|
const git_patch *patch,
|
@@ -19,7 +19,7 @@ typedef enum {
|
|
19
19
|
/**
|
20
20
|
* Do not attempt to connect through a proxy
|
21
21
|
*
|
22
|
-
* If built against
|
22
|
+
* If built against libcurl, it itself may attempt to connect
|
23
23
|
* to a proxy if the environment variables specify it.
|
24
24
|
*/
|
25
25
|
GIT_PROXY_NONE,
|
@@ -26,8 +26,6 @@
|
|
26
26
|
*/
|
27
27
|
GIT_BEGIN_DECL
|
28
28
|
|
29
|
-
typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, void *payload);
|
30
|
-
|
31
29
|
/**
|
32
30
|
* Add a remote with the default fetch refspec to the repository's configuration.
|
33
31
|
*
|
@@ -360,6 +358,8 @@ typedef struct {
|
|
360
358
|
} git_push_update;
|
361
359
|
|
362
360
|
/**
|
361
|
+
* Callback used to inform of upcoming updates.
|
362
|
+
*
|
363
363
|
* @param updates an array containing the updates which will be sent
|
364
364
|
* as commands to the destination.
|
365
365
|
* @param len number of elements in `updates`
|
@@ -403,7 +403,7 @@ struct git_remote_callbacks {
|
|
403
403
|
* connection to proceed. Returns 1 to allow the connection, 0
|
404
404
|
* to disallow it or a negative value to indicate an error.
|
405
405
|
*/
|
406
|
-
|
406
|
+
git_transport_certificate_check_cb certificate_check;
|
407
407
|
|
408
408
|
/**
|
409
409
|
* During the download of new data, this will be regularly
|
@@ -569,7 +569,7 @@ typedef struct {
|
|
569
569
|
* Initializes a `git_fetch_options` with default values. Equivalent to
|
570
570
|
* creating an instance with GIT_FETCH_OPTIONS_INIT.
|
571
571
|
*
|
572
|
-
* @param opts the `
|
572
|
+
* @param opts the `git_fetch_options` instance to initialize.
|
573
573
|
* @param version the version of the struct; you should pass
|
574
574
|
* `GIT_FETCH_OPTIONS_VERSION` here.
|
575
575
|
* @return Zero on success; -1 on failure.
|
@@ -8,6 +8,14 @@
|
|
8
8
|
#define INCLUDE_git_transaction_h__
|
9
9
|
|
10
10
|
#include "common.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @file git2/transaction.h
|
14
|
+
* @brief Git transactional reference routines
|
15
|
+
* @defgroup git_transaction Git transactional reference routines
|
16
|
+
* @ingroup Git
|
17
|
+
* @{
|
18
|
+
*/
|
11
19
|
GIT_BEGIN_DECL
|
12
20
|
|
13
21
|
/**
|
@@ -107,5 +115,6 @@ GIT_EXTERN(int) git_transaction_commit(git_transaction *tx);
|
|
107
115
|
*/
|
108
116
|
GIT_EXTERN(void) git_transaction_free(git_transaction *tx);
|
109
117
|
|
118
|
+
/** @} */
|
110
119
|
GIT_END_DECL
|
111
120
|
#endif
|
@@ -7,12 +7,12 @@
|
|
7
7
|
#ifndef INCLUDE_git_version_h__
|
8
8
|
#define INCLUDE_git_version_h__
|
9
9
|
|
10
|
-
#define LIBGIT2_VERSION "0.
|
10
|
+
#define LIBGIT2_VERSION "0.25.0"
|
11
11
|
#define LIBGIT2_VER_MAJOR 0
|
12
|
-
#define LIBGIT2_VER_MINOR
|
12
|
+
#define LIBGIT2_VER_MINOR 25
|
13
13
|
#define LIBGIT2_VER_REVISION 0
|
14
14
|
#define LIBGIT2_VER_PATCH 0
|
15
15
|
|
16
|
-
#define LIBGIT2_SOVERSION
|
16
|
+
#define LIBGIT2_SOVERSION 25
|
17
17
|
|
18
18
|
#endif
|
data/vendor/libgit2/src/apply.c
CHANGED
@@ -173,7 +173,7 @@ static int apply_hunk(
|
|
173
173
|
git_diff_line *line = git_array_get(patch->lines, linenum);
|
174
174
|
|
175
175
|
if (!line) {
|
176
|
-
error = apply_err("Preimage does not contain line %
|
176
|
+
error = apply_err("Preimage does not contain line %"PRIuZ, linenum);
|
177
177
|
goto done;
|
178
178
|
}
|
179
179
|
|
data/vendor/libgit2/src/branch.c
CHANGED
@@ -58,16 +58,17 @@ static int create_branch(
|
|
58
58
|
const char *from,
|
59
59
|
int force)
|
60
60
|
{
|
61
|
-
int
|
61
|
+
int is_unmovable_head = 0;
|
62
62
|
git_reference *branch = NULL;
|
63
63
|
git_buf canonical_branch_name = GIT_BUF_INIT,
|
64
64
|
log_message = GIT_BUF_INIT;
|
65
65
|
int error = -1;
|
66
|
+
int bare = git_repository_is_bare(repository);
|
66
67
|
|
67
68
|
assert(branch_name && commit && ref_out);
|
68
69
|
assert(git_object_owner((const git_object *)commit) == repository);
|
69
70
|
|
70
|
-
if (force && git_branch_lookup(&branch, repository, branch_name, GIT_BRANCH_LOCAL) == 0) {
|
71
|
+
if (force && !bare && git_branch_lookup(&branch, repository, branch_name, GIT_BRANCH_LOCAL) == 0) {
|
71
72
|
error = git_branch_is_head(branch);
|
72
73
|
git_reference_free(branch);
|
73
74
|
branch = NULL;
|
@@ -75,10 +76,10 @@ static int create_branch(
|
|
75
76
|
if (error < 0)
|
76
77
|
goto cleanup;
|
77
78
|
|
78
|
-
|
79
|
+
is_unmovable_head = error;
|
79
80
|
}
|
80
81
|
|
81
|
-
if (
|
82
|
+
if (is_unmovable_head && force) {
|
82
83
|
giterr_set(GITERR_REFERENCE, "Cannot force update branch '%s' as it is "
|
83
84
|
"the current HEAD of the repository.", branch_name);
|
84
85
|
error = -1;
|
@@ -1966,7 +1966,7 @@ static int checkout_path_suffixed(git_buf *path, const char *suffix)
|
|
1966
1966
|
if (i == INT_MAX) {
|
1967
1967
|
git_buf_truncate(path, path_len);
|
1968
1968
|
|
1969
|
-
giterr_set(GITERR_CHECKOUT, "Could not write '%s': working directory file exists", path);
|
1969
|
+
giterr_set(GITERR_CHECKOUT, "Could not write '%s': working directory file exists", path->ptr);
|
1970
1970
|
return GIT_EEXISTS;
|
1971
1971
|
}
|
1972
1972
|
|
@@ -2469,7 +2469,7 @@ static int checkout_data_init(
|
|
2469
2469
|
data->opts.checkout_strategy |= GIT_CHECKOUT_CONFLICT_STYLE_DIFF3;
|
2470
2470
|
else {
|
2471
2471
|
giterr_set(GITERR_CHECKOUT, "unknown style '%s' given for 'merge.conflictstyle'",
|
2472
|
-
conflict_style);
|
2472
|
+
conflict_style->value);
|
2473
2473
|
error = -1;
|
2474
2474
|
git_config_entry_free(conflict_style);
|
2475
2475
|
goto cleanup;
|
data/vendor/libgit2/src/commit.c
CHANGED
@@ -459,10 +459,11 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
|
459
459
|
buffer = buffer_start + header_len + 1;
|
460
460
|
|
461
461
|
/* extract commit message */
|
462
|
-
if (buffer <= buffer_end)
|
462
|
+
if (buffer <= buffer_end)
|
463
463
|
commit->raw_message = git__strndup(buffer, buffer_end - buffer);
|
464
|
-
|
465
|
-
|
464
|
+
else
|
465
|
+
commit->raw_message = git__strdup("");
|
466
|
+
GITERR_CHECK_ALLOC(commit->raw_message);
|
466
467
|
|
467
468
|
return 0;
|
468
469
|
|
data/vendor/libgit2/src/common.h
CHANGED
@@ -103,7 +103,8 @@
|
|
103
103
|
/**
|
104
104
|
* Set the error message for this thread, formatting as needed.
|
105
105
|
*/
|
106
|
-
|
106
|
+
|
107
|
+
void giterr_set(int error_class, const char *string, ...) GIT_FORMAT_PRINTF(2, 3);
|
107
108
|
|
108
109
|
/**
|
109
110
|
* Set the error message for a regex failure, using the internal regex
|
@@ -15,6 +15,16 @@
|
|
15
15
|
#include "vector.h"
|
16
16
|
#include "proxy.h"
|
17
17
|
|
18
|
+
/* This is for backwards compatibility with curl<7.45.0. */
|
19
|
+
#ifndef CURLINFO_ACTIVESOCKET
|
20
|
+
# define CURLINFO_ACTIVESOCKET CURLINFO_LASTSOCKET
|
21
|
+
# define GIT_CURL_BADSOCKET -1
|
22
|
+
# define git_activesocket_t long
|
23
|
+
#else
|
24
|
+
# define GIT_CURL_BADSOCKET CURL_SOCKET_BAD
|
25
|
+
# define git_activesocket_t curl_socket_t
|
26
|
+
#endif
|
27
|
+
|
18
28
|
typedef struct {
|
19
29
|
git_stream parent;
|
20
30
|
CURL *handle;
|
@@ -87,7 +97,8 @@ static int ask_and_apply_proxy_creds(curl_stream *s)
|
|
87
97
|
static int curls_connect(git_stream *stream)
|
88
98
|
{
|
89
99
|
curl_stream *s = (curl_stream *) stream;
|
90
|
-
|
100
|
+
git_activesocket_t sockextr;
|
101
|
+
long connect_last = 0;
|
91
102
|
int failed_cert = 0, error;
|
92
103
|
bool retry_connect;
|
93
104
|
CURLcode res;
|
@@ -117,10 +128,15 @@ static int curls_connect(git_stream *stream)
|
|
117
128
|
if (res == CURLE_PEER_FAILED_VERIFICATION)
|
118
129
|
failed_cert = 1;
|
119
130
|
|
120
|
-
if ((res = curl_easy_getinfo(s->handle,
|
131
|
+
if ((res = curl_easy_getinfo(s->handle, CURLINFO_ACTIVESOCKET, &sockextr)) != CURLE_OK) {
|
121
132
|
return seterr_curl(s);
|
122
133
|
}
|
123
134
|
|
135
|
+
if (sockextr == GIT_CURL_BADSOCKET) {
|
136
|
+
giterr_set(GITERR_NET, "curl socket is no longer valid");
|
137
|
+
return -1;
|
138
|
+
}
|
139
|
+
|
124
140
|
s->socket = sockextr;
|
125
141
|
|
126
142
|
if (s->parent.encrypted && failed_cert)
|
@@ -198,6 +214,7 @@ static int wait_for(curl_socket_t fd, bool reading)
|
|
198
214
|
FD_ZERO(&outfd);
|
199
215
|
FD_ZERO(&errfd);
|
200
216
|
|
217
|
+
assert(fd >= 0);
|
201
218
|
FD_SET(fd, &errfd);
|
202
219
|
if (reading)
|
203
220
|
FD_SET(fd, &infd);
|
@@ -300,15 +300,24 @@ int git_diff_stats_to_buf(
|
|
300
300
|
}
|
301
301
|
|
302
302
|
if (format & GIT_DIFF_STATS_FULL || format & GIT_DIFF_STATS_SHORT) {
|
303
|
-
|
304
|
-
out, " %" PRIuZ " file%s changed,
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
303
|
+
git_buf_printf(
|
304
|
+
out, " %" PRIuZ " file%s changed",
|
305
|
+
stats->files_changed, stats->files_changed != 1 ? "s" : "");
|
306
|
+
|
307
|
+
if (stats->insertions || stats->deletions == 0)
|
308
|
+
git_buf_printf(
|
309
|
+
out, ", %" PRIuZ " insertion%s(+)",
|
310
|
+
stats->insertions, stats->insertions != 1 ? "s" : "");
|
311
|
+
|
312
|
+
if (stats->deletions || stats->insertions == 0)
|
313
|
+
git_buf_printf(
|
314
|
+
out, ", %" PRIuZ " deletion%s(-)",
|
315
|
+
stats->deletions, stats->deletions != 1 ? "s" : "");
|
316
|
+
|
317
|
+
git_buf_putc(out, '\n');
|
318
|
+
|
319
|
+
if (git_buf_oom(out))
|
320
|
+
return -1;
|
312
321
|
}
|
313
322
|
|
314
323
|
if (format & GIT_DIFF_STATS_INCLUDE_SUMMARY) {
|
@@ -334,4 +343,3 @@ void git_diff_stats_free(git_diff_stats *stats)
|
|
334
343
|
git__free(stats->filestats);
|
335
344
|
git__free(stats);
|
336
345
|
}
|
337
|
-
|
@@ -149,7 +149,7 @@ static int fetchhead_ref_parse(
|
|
149
149
|
|
150
150
|
if (!*line) {
|
151
151
|
giterr_set(GITERR_FETCHHEAD,
|
152
|
-
"Empty line in FETCH_HEAD line %
|
152
|
+
"Empty line in FETCH_HEAD line %"PRIuZ, line_num);
|
153
153
|
return -1;
|
154
154
|
}
|
155
155
|
|
@@ -163,7 +163,7 @@ static int fetchhead_ref_parse(
|
|
163
163
|
|
164
164
|
if (strlen(oid_str) != GIT_OID_HEXSZ) {
|
165
165
|
giterr_set(GITERR_FETCHHEAD,
|
166
|
-
"Invalid object ID in FETCH_HEAD line %
|
166
|
+
"Invalid object ID in FETCH_HEAD line %"PRIuZ, line_num);
|
167
167
|
return -1;
|
168
168
|
}
|
169
169
|
|
@@ -171,7 +171,7 @@ static int fetchhead_ref_parse(
|
|
171
171
|
const git_error *oid_err = giterr_last();
|
172
172
|
const char *err_msg = oid_err ? oid_err->message : "Invalid object ID";
|
173
173
|
|
174
|
-
giterr_set(GITERR_FETCHHEAD, "%s in FETCH_HEAD line %
|
174
|
+
giterr_set(GITERR_FETCHHEAD, "%s in FETCH_HEAD line %"PRIuZ,
|
175
175
|
err_msg, line_num);
|
176
176
|
return -1;
|
177
177
|
}
|
@@ -180,7 +180,7 @@ static int fetchhead_ref_parse(
|
|
180
180
|
if (*line) {
|
181
181
|
if ((is_merge_str = git__strsep(&line, "\t")) == NULL) {
|
182
182
|
giterr_set(GITERR_FETCHHEAD,
|
183
|
-
"Invalid description data in FETCH_HEAD line %
|
183
|
+
"Invalid description data in FETCH_HEAD line %"PRIuZ, line_num);
|
184
184
|
return -1;
|
185
185
|
}
|
186
186
|
|
@@ -190,13 +190,13 @@ static int fetchhead_ref_parse(
|
|
190
190
|
*is_merge = 0;
|
191
191
|
else {
|
192
192
|
giterr_set(GITERR_FETCHHEAD,
|
193
|
-
"Invalid for-merge entry in FETCH_HEAD line %
|
193
|
+
"Invalid for-merge entry in FETCH_HEAD line %"PRIuZ, line_num);
|
194
194
|
return -1;
|
195
195
|
}
|
196
196
|
|
197
197
|
if ((desc = line) == NULL) {
|
198
198
|
giterr_set(GITERR_FETCHHEAD,
|
199
|
-
"Invalid description in FETCH_HEAD line %
|
199
|
+
"Invalid description in FETCH_HEAD line %"PRIuZ, line_num);
|
200
200
|
return -1;
|
201
201
|
}
|
202
202
|
|
@@ -213,7 +213,7 @@ static int fetchhead_ref_parse(
|
|
213
213
|
if ((desc = strstr(name, "' ")) == NULL ||
|
214
214
|
git__prefixcmp(desc, "' of ") != 0) {
|
215
215
|
giterr_set(GITERR_FETCHHEAD,
|
216
|
-
"Invalid description in FETCH_HEAD line %
|
216
|
+
"Invalid description in FETCH_HEAD line %"PRIuZ, line_num);
|
217
217
|
return -1;
|
218
218
|
}
|
219
219
|
|
@@ -277,7 +277,7 @@ int git_repository_fetchhead_foreach(git_repository *repo,
|
|
277
277
|
}
|
278
278
|
|
279
279
|
if (*buffer) {
|
280
|
-
giterr_set(GITERR_FETCHHEAD, "No EOL at line %
|
280
|
+
giterr_set(GITERR_FETCHHEAD, "No EOL at line %"PRIuZ, line_num+1);
|
281
281
|
error = -1;
|
282
282
|
goto done;
|
283
283
|
}
|
@@ -72,8 +72,16 @@ int git_futils_creat_locked(const char *path, const mode_t mode)
|
|
72
72
|
O_EXCL | O_BINARY | O_CLOEXEC, mode);
|
73
73
|
|
74
74
|
if (fd < 0) {
|
75
|
+
int error = errno;
|
75
76
|
giterr_set(GITERR_OS, "Failed to create locked file '%s'", path);
|
76
|
-
|
77
|
+
switch (error) {
|
78
|
+
case EEXIST:
|
79
|
+
return GIT_ELOCKED;
|
80
|
+
case ENOENT:
|
81
|
+
return GIT_ENOTFOUND;
|
82
|
+
default:
|
83
|
+
return -1;
|
84
|
+
}
|
77
85
|
}
|
78
86
|
|
79
87
|
return fd;
|
@@ -45,12 +45,12 @@ extern int git_futils_writebuffer(
|
|
45
45
|
extern int git_futils_creat_withpath(const char *path, const mode_t dirmode, const mode_t mode);
|
46
46
|
|
47
47
|
/**
|
48
|
-
* Create
|
48
|
+
* Create and open a process-locked file
|
49
49
|
*/
|
50
50
|
extern int git_futils_creat_locked(const char *path, const mode_t mode);
|
51
51
|
|
52
52
|
/**
|
53
|
-
* Create
|
53
|
+
* Create and open a process-locked file, while
|
54
54
|
* also creating all the folders in its path
|
55
55
|
*/
|
56
56
|
extern int git_futils_creat_locked_withpath(const char *path, const mode_t dirmode, const mode_t mode);
|