rugged 0.22.2 → 0.23.0b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/rugged.c +1 -2
- data/ext/rugged/rugged_branch_collection.c +6 -44
- data/ext/rugged/rugged_config.c +7 -3
- data/ext/rugged/rugged_diff_delta.c +1 -1
- data/ext/rugged/rugged_diff_line.c +1 -1
- data/ext/rugged/rugged_object.c +2 -2
- data/ext/rugged/rugged_reference_collection.c +12 -56
- data/ext/rugged/rugged_remote.c +4 -33
- data/ext/rugged/rugged_remote_collection.c +1 -1
- data/ext/rugged/rugged_repo.c +10 -36
- data/ext/rugged/rugged_settings.c +3 -3
- data/ext/rugged/rugged_tree.c +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +10 -3
- data/vendor/libgit2/COPYING +15 -21
- data/vendor/libgit2/include/git2/annotated_commit.h +20 -3
- data/vendor/libgit2/include/git2/branch.h +20 -16
- data/vendor/libgit2/include/git2/checkout.h +32 -18
- data/vendor/libgit2/include/git2/cherrypick.h +2 -2
- data/vendor/libgit2/include/git2/clone.h +4 -10
- data/vendor/libgit2/include/git2/config.h +66 -12
- data/vendor/libgit2/include/git2/describe.h +3 -2
- data/vendor/libgit2/include/git2/diff.h +3 -3
- data/vendor/libgit2/include/git2/errors.h +1 -0
- data/vendor/libgit2/include/git2/filter.h +21 -5
- data/vendor/libgit2/include/git2/index.h +32 -0
- data/vendor/libgit2/include/git2/merge.h +20 -3
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +13 -0
- data/vendor/libgit2/include/git2/patch.h +3 -6
- data/vendor/libgit2/include/git2/rebase.h +8 -12
- data/vendor/libgit2/include/git2/refs.h +19 -29
- data/vendor/libgit2/include/git2/remote.h +5 -11
- data/vendor/libgit2/include/git2/repository.h +44 -15
- data/vendor/libgit2/include/git2/reset.h +19 -10
- data/vendor/libgit2/include/git2/revert.h +2 -2
- data/vendor/libgit2/include/git2/submodule.h +3 -9
- data/vendor/libgit2/include/git2/sys/config.h +3 -1
- data/vendor/libgit2/include/git2/sys/filter.h +10 -2
- data/vendor/libgit2/include/git2/sys/hashsig.h +49 -22
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/types.h +10 -3
- data/vendor/libgit2/include/git2/version.h +3 -2
- data/vendor/libgit2/src/annotated_commit.c +28 -0
- data/vendor/libgit2/src/array.h +19 -8
- data/vendor/libgit2/src/attr.c +95 -35
- data/vendor/libgit2/src/attr_file.c +51 -17
- data/vendor/libgit2/src/attr_file.h +37 -10
- data/vendor/libgit2/src/attrcache.c +13 -7
- data/vendor/libgit2/src/attrcache.h +1 -0
- data/vendor/libgit2/src/blame.c +26 -2
- data/vendor/libgit2/src/blame_git.c +6 -2
- data/vendor/libgit2/src/blob.c +6 -8
- data/vendor/libgit2/src/branch.c +55 -43
- data/vendor/libgit2/src/buf_text.c +13 -6
- data/vendor/libgit2/src/buffer.c +110 -25
- data/vendor/libgit2/src/buffer.h +18 -0
- data/vendor/libgit2/src/checkout.c +164 -92
- data/vendor/libgit2/src/checkout.h +0 -7
- data/vendor/libgit2/src/cherrypick.c +13 -7
- data/vendor/libgit2/src/clone.c +23 -25
- data/vendor/libgit2/src/commit.c +3 -3
- data/vendor/libgit2/src/common.h +23 -1
- data/vendor/libgit2/src/config.c +137 -19
- data/vendor/libgit2/src/config.h +2 -2
- data/vendor/libgit2/src/config_cache.c +2 -1
- data/vendor/libgit2/src/config_file.c +39 -18
- data/vendor/libgit2/src/config_file.h +1 -1
- data/vendor/libgit2/src/crlf.c +1 -1
- data/vendor/libgit2/src/delta-apply.c +3 -2
- data/vendor/libgit2/src/delta.c +25 -6
- data/vendor/libgit2/src/describe.c +2 -0
- data/vendor/libgit2/src/diff.c +8 -5
- data/vendor/libgit2/src/diff_driver.c +39 -18
- data/vendor/libgit2/src/diff_file.c +1 -1
- data/vendor/libgit2/src/diff_patch.c +12 -6
- data/vendor/libgit2/src/diff_tform.c +21 -24
- data/vendor/libgit2/src/filebuf.c +14 -12
- data/vendor/libgit2/src/fileops.c +61 -18
- data/vendor/libgit2/src/fileops.h +11 -2
- data/vendor/libgit2/src/filter.c +351 -99
- data/vendor/libgit2/src/filter.h +17 -0
- data/vendor/libgit2/src/global.c +38 -9
- data/vendor/libgit2/src/hash/hash_generic.c +1 -1
- data/vendor/libgit2/src/hashsig.c +28 -16
- data/vendor/libgit2/src/ignore.c +2 -2
- data/vendor/libgit2/src/index.c +159 -42
- data/vendor/libgit2/src/index.h +29 -0
- data/vendor/libgit2/src/indexer.c +11 -2
- data/vendor/libgit2/src/integer.h +96 -0
- data/vendor/libgit2/src/iterator.c +5 -3
- data/vendor/libgit2/src/khash.h +41 -29
- data/vendor/libgit2/src/merge.c +48 -35
- data/vendor/libgit2/src/merge.h +0 -1
- data/vendor/libgit2/src/merge_file.c +13 -0
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/notes.c +1 -1
- data/vendor/libgit2/src/odb.c +13 -11
- data/vendor/libgit2/src/odb_loose.c +22 -10
- data/vendor/libgit2/src/odb_mempack.c +4 -2
- data/vendor/libgit2/src/offmap.h +3 -2
- data/vendor/libgit2/src/oid.c +1 -1
- data/vendor/libgit2/src/oidmap.h +2 -1
- data/vendor/libgit2/src/openssl_stream.c +6 -3
- data/vendor/libgit2/src/pack-objects.c +273 -12
- data/vendor/libgit2/src/pack-objects.h +10 -0
- data/vendor/libgit2/src/pack.c +17 -6
- data/vendor/libgit2/src/pack.h +1 -3
- data/vendor/libgit2/src/path.c +68 -38
- data/vendor/libgit2/src/pathspec.c +3 -0
- data/vendor/libgit2/src/pool.c +9 -8
- data/vendor/libgit2/src/posix.c +11 -1
- data/vendor/libgit2/src/push.c +15 -17
- data/vendor/libgit2/src/push.h +1 -6
- data/vendor/libgit2/src/rebase.c +77 -35
- data/vendor/libgit2/src/refdb_fs.c +2 -2
- data/vendor/libgit2/src/refs.c +107 -81
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +3 -0
- data/vendor/libgit2/src/remote.c +19 -21
- data/vendor/libgit2/src/repository.c +258 -67
- data/vendor/libgit2/src/repository.h +31 -16
- data/vendor/libgit2/src/reset.c +28 -12
- data/vendor/libgit2/src/revert.c +12 -7
- data/vendor/libgit2/src/revwalk.c +3 -5
- data/vendor/libgit2/src/revwalk.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +5 -3
- data/vendor/libgit2/src/stash.c +3 -5
- data/vendor/libgit2/src/strmap.h +2 -1
- data/vendor/libgit2/src/submodule.c +5 -6
- data/vendor/libgit2/src/tag.c +7 -5
- data/vendor/libgit2/src/transaction.c +1 -1
- data/vendor/libgit2/src/transports/cred.c +5 -2
- data/vendor/libgit2/src/transports/git.c +2 -3
- data/vendor/libgit2/src/transports/local.c +15 -34
- data/vendor/libgit2/src/transports/smart.c +1 -1
- data/vendor/libgit2/src/transports/smart_pkt.c +58 -18
- data/vendor/libgit2/src/transports/smart_protocol.c +2 -2
- data/vendor/libgit2/src/transports/winhttp.c +2 -2
- data/vendor/libgit2/src/tree.c +7 -5
- data/vendor/libgit2/src/tsort.c +3 -1
- data/vendor/libgit2/src/util.c +25 -0
- data/vendor/libgit2/src/util.h +31 -27
- data/vendor/libgit2/src/vector.c +2 -7
- data/vendor/libgit2/src/win32/dir.c +5 -3
- data/vendor/libgit2/src/win32/git2.rc +8 -4
- data/vendor/libgit2/src/win32/mingw-compat.h +7 -0
- data/vendor/libgit2/src/win32/msvc-compat.h +3 -0
- data/vendor/libgit2/src/win32/posix.h +1 -3
- data/vendor/libgit2/src/win32/posix_w32.c +31 -7
- data/vendor/libgit2/src/win32/utf-conv.c +1 -3
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +5 -5
- data/vendor/libgit2/src/bswap.h +0 -97
@@ -14,6 +14,7 @@
|
|
14
14
|
#include "git2/object.h"
|
15
15
|
#include "git2/config.h"
|
16
16
|
|
17
|
+
#include "array.h"
|
17
18
|
#include "cache.h"
|
18
19
|
#include "refs.h"
|
19
20
|
#include "buffer.h"
|
@@ -27,6 +28,9 @@
|
|
27
28
|
#define GIT_DIR_MODE 0755
|
28
29
|
#define GIT_BARE_DIR_MODE 0777
|
29
30
|
|
31
|
+
/* Default DOS-compatible 8.3 "short name" for a git repository, "GIT~1" */
|
32
|
+
#define GIT_DIR_SHORTNAME "GIT~1"
|
33
|
+
|
30
34
|
/** Cvar cache identifiers */
|
31
35
|
typedef enum {
|
32
36
|
GIT_CVAR_AUTO_CRLF = 0, /* core.autocrlf */
|
@@ -124,15 +128,21 @@ struct git_repository {
|
|
124
128
|
git_diff_driver_registry *diff_drivers;
|
125
129
|
|
126
130
|
char *path_repository;
|
131
|
+
char *path_gitlink;
|
127
132
|
char *workdir;
|
128
133
|
char *namespace;
|
129
|
-
char *name_8dot3;
|
130
134
|
|
131
|
-
|
132
|
-
|
133
|
-
|
135
|
+
char *ident_name;
|
136
|
+
char *ident_email;
|
137
|
+
|
138
|
+
git_array_t(git_buf) reserved_names;
|
139
|
+
|
140
|
+
unsigned is_bare:1;
|
141
|
+
|
134
142
|
unsigned int lru_counter;
|
135
143
|
|
144
|
+
git_atomic attr_session_key;
|
145
|
+
|
136
146
|
git_cvar_value cvar_cache[GIT_CVAR_CACHE_MAX];
|
137
147
|
};
|
138
148
|
|
@@ -183,19 +193,24 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head
|
|
183
193
|
|
184
194
|
int git_repository__cleanup_files(git_repository *repo, const char *files[], size_t files_len);
|
185
195
|
|
186
|
-
/*
|
187
|
-
|
188
|
-
|
189
|
-
* will always return a pointer to `git_repository__8dot3_default` when
|
190
|
-
* "GIT~1" is the short name. This will return NULL for bare repositories,
|
191
|
-
* and systems that do not have a short name.
|
192
|
-
*/
|
193
|
-
const char *git_repository__8dot3_name(git_repository *repo);
|
196
|
+
/* The default "reserved names" for a repository */
|
197
|
+
extern git_buf git_repository__reserved_names_win32[];
|
198
|
+
extern size_t git_repository__reserved_names_win32_len;
|
194
199
|
|
195
|
-
|
196
|
-
|
200
|
+
extern git_buf git_repository__reserved_names_posix[];
|
201
|
+
extern size_t git_repository__reserved_names_posix_len;
|
202
|
+
|
203
|
+
/*
|
204
|
+
* Gets any "reserved names" in the repository. This will return paths
|
205
|
+
* that should not be allowed in the repository (like ".git") to avoid
|
206
|
+
* conflicting with the repository path, or with alternate mechanisms to
|
207
|
+
* the repository path (eg, "GIT~1"). Every attempt will be made to look
|
208
|
+
* up all possible reserved names - if there was a conflict for the shortname
|
209
|
+
* GIT~1, for example, this function will try to look up the alternate
|
210
|
+
* shortname. If that fails, this function returns false, but out and outlen
|
211
|
+
* will still be populated with good defaults.
|
197
212
|
*/
|
198
|
-
|
199
|
-
|
213
|
+
bool git_repository__reserved_names(
|
214
|
+
git_buf **out, size_t *outlen, git_repository *repo, bool include_ntfs);
|
200
215
|
|
201
216
|
#endif
|
data/vendor/libgit2/src/reset.c
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
#include "tag.h"
|
11
11
|
#include "merge.h"
|
12
12
|
#include "diff.h"
|
13
|
+
#include "annotated_commit.h"
|
13
14
|
#include "git2/reset.h"
|
14
15
|
#include "git2/checkout.h"
|
15
16
|
#include "git2/merge.h"
|
@@ -96,20 +97,19 @@ cleanup:
|
|
96
97
|
return error;
|
97
98
|
}
|
98
99
|
|
99
|
-
int
|
100
|
+
static int reset(
|
100
101
|
git_repository *repo,
|
101
102
|
git_object *target,
|
103
|
+
const char *to,
|
102
104
|
git_reset_t reset_type,
|
103
|
-
git_checkout_options *checkout_opts
|
104
|
-
const git_signature *signature,
|
105
|
-
const char *log_message)
|
105
|
+
git_checkout_options *checkout_opts)
|
106
106
|
{
|
107
107
|
git_object *commit = NULL;
|
108
108
|
git_index *index = NULL;
|
109
109
|
git_tree *tree = NULL;
|
110
110
|
int error = 0;
|
111
111
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
112
|
-
git_buf
|
112
|
+
git_buf log_message = GIT_BUF_INIT;
|
113
113
|
|
114
114
|
assert(repo && target);
|
115
115
|
|
@@ -141,19 +141,17 @@ int git_reset(
|
|
141
141
|
goto cleanup;
|
142
142
|
}
|
143
143
|
|
144
|
-
if (log_message)
|
145
|
-
|
146
|
-
else
|
147
|
-
git_buf_sets(&log_message_buf, "reset: moving");
|
144
|
+
if ((error = git_buf_printf(&log_message, "reset: moving to %s", to)) < 0)
|
145
|
+
return error;
|
148
146
|
|
149
147
|
/* move HEAD to the new target */
|
150
148
|
if ((error = git_reference__update_terminal(repo, GIT_HEAD_FILE,
|
151
|
-
git_object_id(commit),
|
149
|
+
git_object_id(commit), NULL, git_buf_cstr(&log_message))) < 0)
|
152
150
|
goto cleanup;
|
153
151
|
|
154
152
|
if (reset_type == GIT_RESET_HARD) {
|
155
153
|
/* overwrite working directory with HEAD */
|
156
|
-
opts.checkout_strategy = GIT_CHECKOUT_FORCE
|
154
|
+
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
|
157
155
|
|
158
156
|
if ((error = git_checkout_tree(repo, (git_object *)tree, &opts)) < 0)
|
159
157
|
goto cleanup;
|
@@ -176,7 +174,25 @@ cleanup:
|
|
176
174
|
git_object_free(commit);
|
177
175
|
git_index_free(index);
|
178
176
|
git_tree_free(tree);
|
179
|
-
git_buf_free(&
|
177
|
+
git_buf_free(&log_message);
|
180
178
|
|
181
179
|
return error;
|
182
180
|
}
|
181
|
+
|
182
|
+
int git_reset(
|
183
|
+
git_repository *repo,
|
184
|
+
git_object *target,
|
185
|
+
git_reset_t reset_type,
|
186
|
+
git_checkout_options *checkout_opts)
|
187
|
+
{
|
188
|
+
return reset(repo, target, git_oid_tostr_s(git_object_id(target)), reset_type, checkout_opts);
|
189
|
+
}
|
190
|
+
|
191
|
+
int git_reset_from_annotated(
|
192
|
+
git_repository *repo,
|
193
|
+
git_annotated_commit *commit,
|
194
|
+
git_reset_t reset_type,
|
195
|
+
git_checkout_options *checkout_opts)
|
196
|
+
{
|
197
|
+
return reset(repo, (git_object *) commit->commit, commit->ref_name, reset_type, checkout_opts);
|
198
|
+
}
|
data/vendor/libgit2/src/revert.c
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
#include "repository.h"
|
10
10
|
#include "filebuf.h"
|
11
11
|
#include "merge.h"
|
12
|
+
#include "index.h"
|
12
13
|
|
13
14
|
#include "git2/types.h"
|
14
15
|
#include "git2/merge.h"
|
@@ -72,7 +73,7 @@ static int revert_normalize_opts(
|
|
72
73
|
const char *their_label)
|
73
74
|
{
|
74
75
|
int error = 0;
|
75
|
-
unsigned int default_checkout_strategy =
|
76
|
+
unsigned int default_checkout_strategy = GIT_CHECKOUT_SAFE |
|
76
77
|
GIT_CHECKOUT_ALLOW_CONFLICTS;
|
77
78
|
|
78
79
|
GIT_UNUSED(repo);
|
@@ -174,7 +175,8 @@ int git_revert(
|
|
174
175
|
char commit_oidstr[GIT_OID_HEXSZ + 1];
|
175
176
|
const char *commit_msg;
|
176
177
|
git_buf their_label = GIT_BUF_INIT;
|
177
|
-
git_index *
|
178
|
+
git_index *index = NULL;
|
179
|
+
git_indexwriter indexwriter = GIT_INDEXWRITER_INIT;
|
178
180
|
int error;
|
179
181
|
|
180
182
|
assert(repo && commit);
|
@@ -194,14 +196,16 @@ int git_revert(
|
|
194
196
|
|
195
197
|
if ((error = git_buf_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
|
196
198
|
(error = revert_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
|
199
|
+
(error = git_indexwriter_init_for_operation(&indexwriter, repo, &opts.checkout_opts.checkout_strategy)) < 0 ||
|
197
200
|
(error = write_revert_head(repo, commit_oidstr)) < 0 ||
|
198
201
|
(error = write_merge_msg(repo, commit_oidstr, commit_msg)) < 0 ||
|
199
202
|
(error = git_repository_head(&our_ref, repo)) < 0 ||
|
200
203
|
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
|
201
|
-
(error = git_revert_commit(&
|
202
|
-
(error = git_merge__check_result(repo,
|
203
|
-
(error = git_merge__append_conflicts_to_merge_msg(repo,
|
204
|
-
(error = git_checkout_index(repo,
|
204
|
+
(error = git_revert_commit(&index, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
|
205
|
+
(error = git_merge__check_result(repo, index)) < 0 ||
|
206
|
+
(error = git_merge__append_conflicts_to_merge_msg(repo, index)) < 0 ||
|
207
|
+
(error = git_checkout_index(repo, index, &opts.checkout_opts)) < 0 ||
|
208
|
+
(error = git_indexwriter_commit(&indexwriter)) < 0)
|
205
209
|
goto on_error;
|
206
210
|
|
207
211
|
goto done;
|
@@ -210,7 +214,8 @@ on_error:
|
|
210
214
|
revert_state_cleanup(repo);
|
211
215
|
|
212
216
|
done:
|
213
|
-
|
217
|
+
git_indexwriter_cleanup(&indexwriter);
|
218
|
+
git_index_free(index);
|
214
219
|
git_commit_free(our_commit);
|
215
220
|
git_reference_free(our_ref);
|
216
221
|
git_buf_free(&their_label);
|
@@ -14,6 +14,8 @@
|
|
14
14
|
#include "git2/revparse.h"
|
15
15
|
#include "merge.h"
|
16
16
|
|
17
|
+
GIT__USE_OIDMAP;
|
18
|
+
|
17
19
|
git_commit_list_node *git_revwalk__commit_lookup(
|
18
20
|
git_revwalk *walk, const git_oid *oid)
|
19
21
|
{
|
@@ -503,13 +505,9 @@ static int prepare_walk(git_revwalk *walk)
|
|
503
505
|
|
504
506
|
int git_revwalk_new(git_revwalk **revwalk_out, git_repository *repo)
|
505
507
|
{
|
506
|
-
git_revwalk *walk;
|
507
|
-
|
508
|
-
walk = git__malloc(sizeof(git_revwalk));
|
508
|
+
git_revwalk *walk = git__calloc(1, sizeof(git_revwalk));
|
509
509
|
GITERR_CHECK_ALLOC(walk);
|
510
510
|
|
511
|
-
memset(walk, 0x0, sizeof(git_revwalk));
|
512
|
-
|
513
511
|
walk->commits = git_oidmap_alloc();
|
514
512
|
GITERR_CHECK_ALLOC(walk->commits);
|
515
513
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#include "sortedcache.h"
|
2
2
|
|
3
|
-
GIT__USE_STRMAP
|
3
|
+
GIT__USE_STRMAP
|
4
4
|
|
5
5
|
int git_sortedcache_new(
|
6
6
|
git_sortedcache **out,
|
@@ -11,11 +11,13 @@ int git_sortedcache_new(
|
|
11
11
|
const char *path)
|
12
12
|
{
|
13
13
|
git_sortedcache *sc;
|
14
|
-
size_t pathlen;
|
14
|
+
size_t pathlen, alloclen;
|
15
15
|
|
16
16
|
pathlen = path ? strlen(path) : 0;
|
17
17
|
|
18
|
-
|
18
|
+
GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
|
19
|
+
GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
|
20
|
+
sc = git__calloc(1, alloclen);
|
19
21
|
GITERR_CHECK_ALLOC(sc);
|
20
22
|
|
21
23
|
if (git_pool_init(&sc->pool, 1, 0) < 0 ||
|
data/vendor/libgit2/src/stash.c
CHANGED
@@ -313,8 +313,7 @@ static int build_workdir_tree(
|
|
313
313
|
if ((error = git_commit_tree(&b_tree, b_commit)) < 0)
|
314
314
|
goto cleanup;
|
315
315
|
|
316
|
-
if ((error =
|
317
|
-
&diff, repo, b_tree, &opts)) < 0)
|
316
|
+
if ((error = git_diff_tree_to_workdir(&diff, repo, b_tree, &opts)) < 0)
|
318
317
|
goto cleanup;
|
319
318
|
|
320
319
|
data.include_changed = true;
|
@@ -411,7 +410,6 @@ cleanup:
|
|
411
410
|
static int update_reflog(
|
412
411
|
git_oid *w_commit_oid,
|
413
412
|
git_repository *repo,
|
414
|
-
const git_signature *stasher,
|
415
413
|
const char *message)
|
416
414
|
{
|
417
415
|
git_reference *stash;
|
@@ -420,7 +418,7 @@ static int update_reflog(
|
|
420
418
|
if ((error = git_reference_ensure_log(repo, GIT_REFS_STASH_FILE)) < 0)
|
421
419
|
return error;
|
422
420
|
|
423
|
-
error = git_reference_create(&stash, repo, GIT_REFS_STASH_FILE, w_commit_oid, 1,
|
421
|
+
error = git_reference_create(&stash, repo, GIT_REFS_STASH_FILE, w_commit_oid, 1, message);
|
424
422
|
|
425
423
|
git_reference_free(stash);
|
426
424
|
|
@@ -534,7 +532,7 @@ int git_stash_save(
|
|
534
532
|
|
535
533
|
git_buf_rtrim(&msg);
|
536
534
|
|
537
|
-
if ((error = update_reflog(out, repo,
|
535
|
+
if ((error = update_reflog(out, repo, git_buf_cstr(&msg))) < 0)
|
538
536
|
goto cleanup;
|
539
537
|
|
540
538
|
if ((error = reset_index_and_workdir(
|
data/vendor/libgit2/src/strmap.h
CHANGED
@@ -12,10 +12,11 @@
|
|
12
12
|
#define kmalloc git__malloc
|
13
13
|
#define kcalloc git__calloc
|
14
14
|
#define krealloc git__realloc
|
15
|
+
#define kreallocarray git__reallocarray
|
15
16
|
#define kfree git__free
|
16
17
|
#include "khash.h"
|
17
18
|
|
18
|
-
__KHASH_TYPE(str, const char *, void *)
|
19
|
+
__KHASH_TYPE(str, const char *, void *)
|
19
20
|
typedef khash_t(str) git_strmap;
|
20
21
|
typedef khiter_t git_strmap_iter;
|
21
22
|
|
@@ -85,7 +85,7 @@ static kh_inline int str_equal_no_trailing_slash(const char *a, const char *b)
|
|
85
85
|
|
86
86
|
__KHASH_IMPL(
|
87
87
|
str, static kh_inline, const char *, void *, 1,
|
88
|
-
str_hash_no_trailing_slash, str_equal_no_trailing_slash)
|
88
|
+
str_hash_no_trailing_slash, str_equal_no_trailing_slash)
|
89
89
|
|
90
90
|
static int submodule_cache_init(git_repository *repo, int refresh);
|
91
91
|
static void submodule_cache_free(git_submodule_cache *cache);
|
@@ -927,7 +927,6 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
927
927
|
|
928
928
|
/* Copy over the remote callbacks */
|
929
929
|
clone_options.remote_callbacks = update_options.remote_callbacks;
|
930
|
-
clone_options.signature = update_options.signature;
|
931
930
|
|
932
931
|
/* Get the status of the submodule to determine if it is already initialized */
|
933
932
|
if ((error = git_submodule_status(&submodule_status, sm)) < 0)
|
@@ -985,7 +984,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
985
984
|
update_options.checkout_opts.checkout_strategy = update_options.clone_checkout_strategy;
|
986
985
|
|
987
986
|
if ((error = git_clone(&sub_repo, submodule_url, sm->path, &clone_options)) < 0 ||
|
988
|
-
(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm)
|
987
|
+
(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm))) < 0 ||
|
989
988
|
(error = git_checkout_head(sub_repo, &update_options.checkout_opts)) != 0)
|
990
989
|
goto done;
|
991
990
|
} else {
|
@@ -997,7 +996,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
997
996
|
if ((error = git_submodule_open(&sub_repo, sm)) < 0 ||
|
998
997
|
(error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJ_COMMIT)) < 0 ||
|
999
998
|
(error = git_checkout_tree(sub_repo, target_commit, &update_options.checkout_opts)) != 0 ||
|
1000
|
-
(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm)
|
999
|
+
(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm))) < 0)
|
1001
1000
|
goto done;
|
1002
1001
|
|
1003
1002
|
/* Invalidate the wd flags as the workdir has been updated. */
|
@@ -1092,10 +1091,10 @@ int git_submodule_sync(git_submodule *sm)
|
|
1092
1091
|
/* return error from reading submodule config */;
|
1093
1092
|
else if ((error = lookup_head_remote_key(&remote_name, smrepo)) < 0) {
|
1094
1093
|
giterr_clear();
|
1095
|
-
error = git_buf_sets(&key, "
|
1094
|
+
error = git_buf_sets(&key, "remote.origin.url");
|
1096
1095
|
} else {
|
1097
1096
|
error = git_buf_join3(
|
1098
|
-
&key, '.', "
|
1097
|
+
&key, '.', "remote", remote_name.ptr, "url");
|
1099
1098
|
git_buf_free(&remote_name);
|
1100
1099
|
}
|
1101
1100
|
|
data/vendor/libgit2/src/tag.c
CHANGED
@@ -72,7 +72,7 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
|
|
72
72
|
};
|
73
73
|
|
74
74
|
unsigned int i;
|
75
|
-
size_t text_len;
|
75
|
+
size_t text_len, alloc_len;
|
76
76
|
char *search;
|
77
77
|
|
78
78
|
if (git_oid__parse(&tag->target, &buffer, buffer_end, "object ") < 0)
|
@@ -117,7 +117,8 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
|
|
117
117
|
|
118
118
|
text_len = search - buffer;
|
119
119
|
|
120
|
-
|
120
|
+
GITERR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
|
121
|
+
tag->tag_name = git__malloc(alloc_len);
|
121
122
|
GITERR_CHECK_ALLOC(tag->tag_name);
|
122
123
|
|
123
124
|
memcpy(tag->tag_name, buffer, text_len);
|
@@ -141,7 +142,8 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
|
|
141
142
|
|
142
143
|
text_len = buffer_end - ++buffer;
|
143
144
|
|
144
|
-
|
145
|
+
GITERR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
|
146
|
+
tag->message = git__malloc(alloc_len);
|
145
147
|
GITERR_CHECK_ALLOC(tag->message);
|
146
148
|
|
147
149
|
memcpy(tag->message, buffer, text_len);
|
@@ -271,7 +273,7 @@ static int git_tag_create__internal(
|
|
271
273
|
} else
|
272
274
|
git_oid_cpy(oid, git_object_id(target));
|
273
275
|
|
274
|
-
error = git_reference_create(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite, NULL
|
276
|
+
error = git_reference_create(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite, NULL);
|
275
277
|
|
276
278
|
cleanup:
|
277
279
|
git_reference_free(new_ref);
|
@@ -378,7 +380,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
|
|
378
380
|
}
|
379
381
|
|
380
382
|
error = git_reference_create(
|
381
|
-
&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite, NULL
|
383
|
+
&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite, NULL);
|
382
384
|
|
383
385
|
git_reference_free(new_ref);
|
384
386
|
git_buf_free(&ref_name);
|
@@ -306,12 +306,15 @@ int git_cred_default_new(git_cred **cred)
|
|
306
306
|
int git_cred_username_new(git_cred **cred, const char *username)
|
307
307
|
{
|
308
308
|
git_cred_username *c;
|
309
|
-
size_t len;
|
309
|
+
size_t len, allocsize;
|
310
310
|
|
311
311
|
assert(cred);
|
312
312
|
|
313
313
|
len = strlen(username);
|
314
|
-
|
314
|
+
|
315
|
+
GITERR_CHECK_ALLOC_ADD(&allocsize, sizeof(git_cred_username), len);
|
316
|
+
GITERR_CHECK_ALLOC_ADD(&allocsize, allocsize, 1);
|
317
|
+
c = git__malloc(allocsize);
|
315
318
|
GITERR_CHECK_ALLOC(c);
|
316
319
|
|
317
320
|
c->parent.credtype = GIT_CREDTYPE_USERNAME;
|
@@ -136,7 +136,6 @@ static void git_proto_stream_free(git_smart_subtransport_stream *stream)
|
|
136
136
|
|
137
137
|
t->current_stream = NULL;
|
138
138
|
|
139
|
-
git_stream_close(s->io);
|
140
139
|
git_stream_free(s->io);
|
141
140
|
git__free(s->url);
|
142
141
|
git__free(s);
|
@@ -155,7 +154,7 @@ static int git_proto_stream_alloc(
|
|
155
154
|
if (!stream)
|
156
155
|
return -1;
|
157
156
|
|
158
|
-
s = git__calloc(sizeof(git_proto_stream)
|
157
|
+
s = git__calloc(1, sizeof(git_proto_stream));
|
159
158
|
GITERR_CHECK_ALLOC(s);
|
160
159
|
|
161
160
|
s->parent.subtransport = &t->parent;
|
@@ -348,7 +347,7 @@ int git_smart_subtransport_git(git_smart_subtransport **out, git_transport *owne
|
|
348
347
|
if (!out)
|
349
348
|
return -1;
|
350
349
|
|
351
|
-
t = git__calloc(sizeof(git_subtransport)
|
350
|
+
t = git__calloc(1, sizeof(git_subtransport));
|
352
351
|
GITERR_CHECK_ALLOC(t);
|
353
352
|
|
354
353
|
t->owner = owner;
|