rugged 0.25.1.1 → 0.26.0b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/include/git2/common.h +10 -0
- data/vendor/libgit2/include/git2/merge.h +2 -1
- data/vendor/libgit2/include/git2/oid.h +4 -5
- data/vendor/libgit2/include/git2/submodule.h +2 -11
- data/vendor/libgit2/include/git2/sys/repository.h +29 -0
- data/vendor/libgit2/include/git2/tree.h +13 -0
- data/vendor/libgit2/src/apply.c +2 -2
- data/vendor/libgit2/src/attr_file.c +5 -5
- data/vendor/libgit2/src/attrcache.c +9 -7
- data/vendor/libgit2/src/blob.c +3 -3
- data/vendor/libgit2/src/branch.c +10 -10
- data/vendor/libgit2/src/buffer.c +4 -4
- data/vendor/libgit2/src/cache.c +1 -1
- data/vendor/libgit2/src/checkout.c +29 -25
- data/vendor/libgit2/src/cherrypick.c +2 -2
- data/vendor/libgit2/src/commit.c +2 -2
- data/vendor/libgit2/src/commit_list.c +2 -2
- data/vendor/libgit2/src/common.h +1 -1
- data/vendor/libgit2/src/config.c +12 -12
- data/vendor/libgit2/src/config_file.c +9 -9
- data/vendor/libgit2/src/crlf.c +1 -1
- data/vendor/libgit2/src/delta.c +4 -4
- data/vendor/libgit2/src/describe.c +11 -11
- data/vendor/libgit2/src/diff_driver.c +1 -1
- data/vendor/libgit2/src/diff_file.c +1 -1
- data/vendor/libgit2/src/diff_generate.c +2 -2
- data/vendor/libgit2/src/diff_print.c +5 -5
- data/vendor/libgit2/src/diff_tform.c +1 -1
- data/vendor/libgit2/src/diff_xdiff.c +2 -2
- data/vendor/libgit2/src/fetch.c +1 -1
- data/vendor/libgit2/src/fetchhead.c +8 -8
- data/vendor/libgit2/src/filebuf.c +9 -9
- data/vendor/libgit2/src/fileops.c +27 -27
- data/vendor/libgit2/src/filter.c +4 -4
- data/vendor/libgit2/src/hashsig.c +2 -2
- data/vendor/libgit2/src/ignore.c +4 -4
- data/vendor/libgit2/src/index.c +15 -15
- data/vendor/libgit2/src/indexer.c +39 -6
- data/vendor/libgit2/src/integer.h +6 -6
- data/vendor/libgit2/src/merge.c +12 -12
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/netops.c +4 -4
- data/vendor/libgit2/src/notes.c +3 -3
- data/vendor/libgit2/src/object.c +5 -5
- data/vendor/libgit2/src/odb.c +12 -12
- data/vendor/libgit2/src/odb_loose.c +6 -6
- data/vendor/libgit2/src/oid.c +5 -5
- data/vendor/libgit2/src/openssl_stream.c +3 -3
- data/vendor/libgit2/src/pack-objects.c +6 -6
- data/vendor/libgit2/src/pack.c +19 -10
- data/vendor/libgit2/src/pack.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +5 -3
- data/vendor/libgit2/src/path.c +15 -15
- data/vendor/libgit2/src/pathspec.c +2 -2
- data/vendor/libgit2/src/posix.c +1 -1
- data/vendor/libgit2/src/push.c +6 -6
- data/vendor/libgit2/src/rebase.c +12 -12
- data/vendor/libgit2/src/refdb.c +1 -1
- data/vendor/libgit2/src/refdb_fs.c +12 -12
- data/vendor/libgit2/src/reflog.c +2 -2
- data/vendor/libgit2/src/refs.c +34 -17
- data/vendor/libgit2/src/refs.h +3 -0
- data/vendor/libgit2/src/remote.c +3 -3
- data/vendor/libgit2/src/repository.c +46 -13
- data/vendor/libgit2/src/repository.h +2 -1
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revert.c +2 -2
- data/vendor/libgit2/src/revparse.c +5 -5
- data/vendor/libgit2/src/revwalk.c +3 -3
- data/vendor/libgit2/src/settings.c +6 -1
- data/vendor/libgit2/src/sha1_lookup.c +1 -1
- data/vendor/libgit2/src/signature.c +1 -1
- data/vendor/libgit2/src/socket_stream.c +5 -5
- data/vendor/libgit2/src/sortedcache.c +5 -5
- data/vendor/libgit2/src/stash.c +6 -6
- data/vendor/libgit2/src/status.c +4 -4
- data/vendor/libgit2/src/submodule.c +159 -110
- data/vendor/libgit2/src/submodule.h +3 -0
- data/vendor/libgit2/src/sysdir.c +2 -2
- data/vendor/libgit2/src/tag.c +14 -14
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/transport.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +4 -4
- data/vendor/libgit2/src/transports/cred.c +1 -1
- data/vendor/libgit2/src/transports/git.c +3 -3
- data/vendor/libgit2/src/transports/http.c +6 -6
- data/vendor/libgit2/src/transports/local.c +2 -2
- data/vendor/libgit2/src/transports/smart.c +5 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +4 -4
- data/vendor/libgit2/src/transports/smart_protocol.c +1 -1
- data/vendor/libgit2/src/transports/ssh.c +9 -9
- data/vendor/libgit2/src/transports/winhttp.c +155 -118
- data/vendor/libgit2/src/tree-cache.c +2 -2
- data/vendor/libgit2/src/tree.c +35 -20
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/util.c +3 -3
- data/vendor/libgit2/src/vector.c +3 -0
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +1 -1
- data/vendor/libgit2/src/win32/map.c +6 -6
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -2
- data/vendor/libgit2/src/win32/w32_util.c +1 -1
- data/vendor/libgit2/src/win32/w32_util.h +1 -1
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +4 -4
data/vendor/libgit2/src/stash.c
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
|
28
28
|
static int create_error(int error, const char *msg)
|
29
29
|
{
|
30
|
-
giterr_set(GITERR_STASH, "
|
30
|
+
giterr_set(GITERR_STASH, "cannot stash changes - %s", msg);
|
31
31
|
return error;
|
32
32
|
}
|
33
33
|
|
@@ -36,7 +36,7 @@ static int retrieve_head(git_reference **out, git_repository *repo)
|
|
36
36
|
int error = git_repository_head(out, repo);
|
37
37
|
|
38
38
|
if (error == GIT_EUNBORNBRANCH)
|
39
|
-
return create_error(error, "
|
39
|
+
return create_error(error, "you do not have the initial commit yet.");
|
40
40
|
|
41
41
|
return error;
|
42
42
|
}
|
@@ -198,7 +198,7 @@ static int stash_update_index_from_diff(
|
|
198
198
|
/* Unimplemented */
|
199
199
|
giterr_set(
|
200
200
|
GITERR_INVALID,
|
201
|
-
"
|
201
|
+
"cannot update index. Unimplemented status (%d)",
|
202
202
|
delta->status);
|
203
203
|
return -1;
|
204
204
|
}
|
@@ -479,7 +479,7 @@ static int ensure_there_are_changes_to_stash(
|
|
479
479
|
return 0;
|
480
480
|
|
481
481
|
if (!error)
|
482
|
-
return create_error(GIT_ENOTFOUND, "
|
482
|
+
return create_error(GIT_ENOTFOUND, "there is nothing to stash.");
|
483
483
|
|
484
484
|
return error;
|
485
485
|
}
|
@@ -593,7 +593,7 @@ static int retrieve_stash_commit(
|
|
593
593
|
max = git_reflog_entrycount(reflog);
|
594
594
|
if (!max || index > max - 1) {
|
595
595
|
error = GIT_ENOTFOUND;
|
596
|
-
giterr_set(GITERR_STASH, "
|
596
|
+
giterr_set(GITERR_STASH, "no stashed state at position %" PRIuZ, index);
|
597
597
|
goto cleanup;
|
598
598
|
}
|
599
599
|
|
@@ -1036,7 +1036,7 @@ int git_stash_drop(
|
|
1036
1036
|
|
1037
1037
|
if (!max || index > max - 1) {
|
1038
1038
|
error = GIT_ENOTFOUND;
|
1039
|
-
giterr_set(GITERR_STASH, "
|
1039
|
+
giterr_set(GITERR_STASH, "no stashed state at position %" PRIuZ, index);
|
1040
1040
|
goto cleanup;
|
1041
1041
|
}
|
1042
1042
|
|
data/vendor/libgit2/src/status.c
CHANGED
@@ -243,13 +243,13 @@ static int status_validate_options(const git_status_options *opts)
|
|
243
243
|
GITERR_CHECK_VERSION(opts, GIT_STATUS_OPTIONS_VERSION, "git_status_options");
|
244
244
|
|
245
245
|
if (opts->show > GIT_STATUS_SHOW_WORKDIR_ONLY) {
|
246
|
-
giterr_set(GITERR_INVALID, "
|
246
|
+
giterr_set(GITERR_INVALID, "unknown status 'show' option");
|
247
247
|
return -1;
|
248
248
|
}
|
249
249
|
|
250
250
|
if ((opts->flags & GIT_STATUS_OPT_NO_REFRESH) != 0 &&
|
251
251
|
(opts->flags & GIT_STATUS_OPT_UPDATE_INDEX) != 0) {
|
252
|
-
giterr_set(GITERR_INVALID, "
|
252
|
+
giterr_set(GITERR_INVALID, "updating index from status "
|
253
253
|
"is not allowed when index refresh is disabled");
|
254
254
|
return -1;
|
255
255
|
}
|
@@ -510,13 +510,13 @@ int git_status_file(
|
|
510
510
|
|
511
511
|
if (error < 0 && sfi.ambiguous) {
|
512
512
|
giterr_set(GITERR_INVALID,
|
513
|
-
"
|
513
|
+
"ambiguous path '%s' given to git_status_file", sfi.expected);
|
514
514
|
error = GIT_EAMBIGUOUS;
|
515
515
|
}
|
516
516
|
|
517
517
|
if (!error && !sfi.count) {
|
518
518
|
giterr_set(GITERR_INVALID,
|
519
|
-
"
|
519
|
+
"attempt to get status of nonexistent file '%s'", path);
|
520
520
|
error = GIT_ENOTFOUND;
|
521
521
|
}
|
522
522
|
|
@@ -124,8 +124,8 @@ static void submodule_set_lookup_error(int error, const char *name)
|
|
124
124
|
return;
|
125
125
|
|
126
126
|
giterr_set(GITERR_SUBMODULE, (error == GIT_ENOTFOUND) ?
|
127
|
-
"
|
128
|
-
"
|
127
|
+
"no submodule named '%s'" :
|
128
|
+
"submodule '%s' has not been added yet", name);
|
129
129
|
}
|
130
130
|
|
131
131
|
typedef struct {
|
@@ -149,40 +149,52 @@ static int find_by_path(const git_config_entry *entry, void *payload)
|
|
149
149
|
}
|
150
150
|
|
151
151
|
/**
|
152
|
-
*
|
152
|
+
* Release the name map returned by 'load_submodule_names'.
|
153
153
|
*/
|
154
|
-
static
|
154
|
+
static void free_submodule_names(git_strmap *names)
|
155
|
+
{
|
156
|
+
git_buf *name = 0;
|
157
|
+
if (names == NULL)
|
158
|
+
return;
|
159
|
+
git_strmap_foreach_value(names, name, {
|
160
|
+
git__free(name);
|
161
|
+
});
|
162
|
+
git_strmap_free(names);
|
163
|
+
return;
|
164
|
+
}
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Map submodule paths to names.
|
168
|
+
* TODO: for some use-cases, this might need case-folding on a
|
169
|
+
* case-insensitive filesystem
|
170
|
+
*/
|
171
|
+
static int load_submodule_names(git_strmap *out, git_config *cfg)
|
155
172
|
{
|
156
173
|
const char *key = "submodule\\..*\\.path";
|
157
174
|
git_config_iterator *iter;
|
158
175
|
git_config_entry *entry;
|
159
|
-
|
176
|
+
git_buf buf = GIT_BUF_INIT;
|
177
|
+
int rval;
|
178
|
+
int error = 0;
|
160
179
|
|
161
180
|
if ((error = git_config_iterator_glob_new(&iter, cfg, key)) < 0)
|
162
181
|
return error;
|
163
182
|
|
164
|
-
while (
|
183
|
+
while (git_config_next(&entry, iter) == 0) {
|
165
184
|
const char *fdot, *ldot;
|
166
|
-
/* TODO: this should maybe be strcasecmp on a case-insensitive fs */
|
167
|
-
if (strcmp(path, entry->value) != 0)
|
168
|
-
continue;
|
169
|
-
|
170
185
|
fdot = strchr(entry->name, '.');
|
171
186
|
ldot = strrchr(entry->name, '.');
|
172
187
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
giterr_set(GITERR_SUBMODULE, "could not find a submodule name for '%s'", path);
|
180
|
-
error = GIT_ENOTFOUND;
|
188
|
+
git_buf_put(&buf, fdot + 1, ldot - fdot - 1);
|
189
|
+
git_strmap_insert(out, entry->value, git_buf_detach(&buf), rval);
|
190
|
+
if (rval < 0) {
|
191
|
+
giterr_set(GITERR_NOMEMORY, "error inserting submodule into hash table");
|
192
|
+
return -1;
|
193
|
+
}
|
181
194
|
}
|
182
195
|
|
183
|
-
cleanup:
|
184
196
|
git_config_iterator_free(iter);
|
185
|
-
return
|
197
|
+
return 0;
|
186
198
|
}
|
187
199
|
|
188
200
|
int git_submodule_lookup(
|
@@ -196,6 +208,17 @@ int git_submodule_lookup(
|
|
196
208
|
|
197
209
|
assert(repo && name);
|
198
210
|
|
211
|
+
if (repo->submodule_cache != NULL) {
|
212
|
+
khiter_t pos = git_strmap_lookup_index(repo->submodule_cache, name);
|
213
|
+
if (git_strmap_valid_index(repo->submodule_cache, pos)) {
|
214
|
+
if (out) {
|
215
|
+
*out = git_strmap_value_at(repo->submodule_cache, pos);
|
216
|
+
GIT_REFCOUNT_INC(*out);
|
217
|
+
}
|
218
|
+
return 0;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
199
222
|
if ((error = submodule_alloc(&sm, repo, name)) < 0)
|
200
223
|
return error;
|
201
224
|
|
@@ -324,89 +347,108 @@ done:
|
|
324
347
|
|
325
348
|
static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cfg)
|
326
349
|
{
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
|
333
|
-
return error;
|
350
|
+
int error;
|
351
|
+
git_iterator *i = NULL;
|
352
|
+
const git_index_entry *entry;
|
353
|
+
git_strmap *names = 0;
|
334
354
|
|
335
|
-
|
336
|
-
|
337
|
-
|
355
|
+
git_strmap_alloc(&names);
|
356
|
+
if ((error = load_submodule_names(names, cfg)))
|
357
|
+
goto done;
|
338
358
|
|
339
|
-
|
340
|
-
|
341
|
-
git_strmap_lookup_index(map, name.ptr);
|
342
|
-
}
|
359
|
+
if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
|
360
|
+
goto done;
|
343
361
|
|
344
|
-
|
345
|
-
|
362
|
+
while (!(error = git_iterator_advance(&entry, i))) {
|
363
|
+
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
364
|
+
git_submodule *sm;
|
365
|
+
|
366
|
+
if (git_strmap_valid_index(map, pos)) {
|
367
|
+
sm = git_strmap_value_at(map, pos);
|
368
|
+
|
369
|
+
if (S_ISGITLINK(entry->mode))
|
370
|
+
submodule_update_from_index_entry(sm, entry);
|
371
|
+
else
|
372
|
+
sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
|
373
|
+
} else if (S_ISGITLINK(entry->mode)) {
|
374
|
+
khiter_t name_pos;
|
375
|
+
const char *name;
|
376
|
+
|
377
|
+
name_pos = git_strmap_lookup_index(names, entry->path);
|
378
|
+
if (git_strmap_valid_index(names, name_pos)) {
|
379
|
+
name = git_strmap_value_at(names, name_pos);
|
380
|
+
} else {
|
381
|
+
name = entry->path;
|
382
|
+
}
|
346
383
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
submodule_update_from_index_entry(sm, entry);
|
354
|
-
git_submodule_free(sm);
|
355
|
-
}
|
356
|
-
}
|
357
|
-
}
|
384
|
+
if (!submodule_get_or_create(&sm, git_index_owner(idx), map, name)) {
|
385
|
+
submodule_update_from_index_entry(sm, entry);
|
386
|
+
git_submodule_free(sm);
|
387
|
+
}
|
388
|
+
}
|
389
|
+
}
|
358
390
|
|
359
|
-
|
360
|
-
|
391
|
+
if (error == GIT_ITEROVER)
|
392
|
+
error = 0;
|
361
393
|
|
362
|
-
|
363
|
-
|
394
|
+
done:
|
395
|
+
git_iterator_free(i);
|
396
|
+
free_submodule_names(names);
|
364
397
|
|
365
|
-
|
398
|
+
return error;
|
366
399
|
}
|
367
400
|
|
368
401
|
static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg)
|
369
402
|
{
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
while (!(error = git_iterator_advance(&entry, i))) {
|
379
|
-
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
380
|
-
git_submodule *sm;
|
403
|
+
int error;
|
404
|
+
git_iterator *i = NULL;
|
405
|
+
const git_index_entry *entry;
|
406
|
+
git_strmap *names = 0;
|
407
|
+
git_strmap_alloc(&names);
|
408
|
+
if ((error = load_submodule_names(names, cfg)))
|
409
|
+
goto done;
|
381
410
|
|
382
|
-
|
383
|
-
|
384
|
-
git_strmap_lookup_index(map, name.ptr);
|
385
|
-
}
|
411
|
+
if ((error = git_iterator_for_tree(&i, head, NULL)) < 0)
|
412
|
+
goto done;
|
386
413
|
|
387
|
-
|
388
|
-
|
414
|
+
while (!(error = git_iterator_advance(&entry, i))) {
|
415
|
+
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
416
|
+
git_submodule *sm;
|
417
|
+
|
418
|
+
if (git_strmap_valid_index(map, pos)) {
|
419
|
+
sm = git_strmap_value_at(map, pos);
|
420
|
+
|
421
|
+
if (S_ISGITLINK(entry->mode))
|
422
|
+
submodule_update_from_head_data(sm, entry->mode, &entry->id);
|
423
|
+
else
|
424
|
+
sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
|
425
|
+
} else if (S_ISGITLINK(entry->mode)) {
|
426
|
+
khiter_t name_pos;
|
427
|
+
const char *name;
|
428
|
+
|
429
|
+
name_pos = git_strmap_lookup_index(names, entry->path);
|
430
|
+
if (git_strmap_valid_index(names, name_pos)) {
|
431
|
+
name = git_strmap_value_at(names, name_pos);
|
432
|
+
} else {
|
433
|
+
name = entry->path;
|
434
|
+
}
|
389
435
|
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
sm, entry->mode, &entry->id);
|
398
|
-
git_submodule_free(sm);
|
399
|
-
}
|
400
|
-
}
|
401
|
-
}
|
436
|
+
if (!submodule_get_or_create(&sm, git_tree_owner(head), map, name)) {
|
437
|
+
submodule_update_from_head_data(
|
438
|
+
sm, entry->mode, &entry->id);
|
439
|
+
git_submodule_free(sm);
|
440
|
+
}
|
441
|
+
}
|
442
|
+
}
|
402
443
|
|
403
|
-
|
404
|
-
|
444
|
+
if (error == GIT_ITEROVER)
|
445
|
+
error = 0;
|
405
446
|
|
406
|
-
|
407
|
-
|
447
|
+
done:
|
448
|
+
git_iterator_free(i);
|
449
|
+
free_submodule_names(names);
|
408
450
|
|
409
|
-
|
451
|
+
return error;
|
410
452
|
}
|
411
453
|
|
412
454
|
/* If have_sm is true, sm is populated, otherwise map an repo are. */
|
@@ -416,7 +458,7 @@ typedef struct {
|
|
416
458
|
git_repository *repo;
|
417
459
|
} lfc_data;
|
418
460
|
|
419
|
-
|
461
|
+
int git_submodule__map(git_repository *repo, git_strmap *map)
|
420
462
|
{
|
421
463
|
int error = 0;
|
422
464
|
git_index *idx = NULL;
|
@@ -470,12 +512,12 @@ static int all_submodules(git_repository *repo, git_strmap *map)
|
|
470
512
|
goto cleanup;
|
471
513
|
}
|
472
514
|
/* add back submodule information from index */
|
473
|
-
if (idx) {
|
515
|
+
if (mods && idx) {
|
474
516
|
if ((error = submodules_from_index(map, idx, mods)) < 0)
|
475
517
|
goto cleanup;
|
476
518
|
}
|
477
519
|
/* add submodule information from HEAD */
|
478
|
-
if (head) {
|
520
|
+
if (mods && head) {
|
479
521
|
if ((error = submodules_from_head(map, head, mods)) < 0)
|
480
522
|
goto cleanup;
|
481
523
|
}
|
@@ -509,7 +551,7 @@ int git_submodule_foreach(
|
|
509
551
|
if ((error = git_strmap_alloc(&submodules)) < 0)
|
510
552
|
return error;
|
511
553
|
|
512
|
-
if ((error =
|
554
|
+
if ((error = git_submodule__map(repo, submodules)) < 0)
|
513
555
|
goto done;
|
514
556
|
|
515
557
|
if (!(error = git_vector_init(
|
@@ -618,7 +660,7 @@ int git_submodule_add_setup(
|
|
618
660
|
giterr_clear();
|
619
661
|
else {
|
620
662
|
giterr_set(GITERR_SUBMODULE,
|
621
|
-
"
|
663
|
+
"attempt to add submodule '%s' that already exists", path);
|
622
664
|
return GIT_EEXISTS;
|
623
665
|
}
|
624
666
|
|
@@ -628,7 +670,7 @@ int git_submodule_add_setup(
|
|
628
670
|
path += strlen(git_repository_workdir(repo));
|
629
671
|
|
630
672
|
if (git_path_root(path) >= 0) {
|
631
|
-
giterr_set(GITERR_SUBMODULE, "
|
673
|
+
giterr_set(GITERR_SUBMODULE, "submodule path must be a relative path");
|
632
674
|
error = -1;
|
633
675
|
goto cleanup;
|
634
676
|
}
|
@@ -637,7 +679,7 @@ int git_submodule_add_setup(
|
|
637
679
|
|
638
680
|
if (!(mods = open_gitmodules(repo, GITMODULES_CREATE))) {
|
639
681
|
giterr_set(GITERR_SUBMODULE,
|
640
|
-
"
|
682
|
+
"adding submodules to a bare repository is not supported");
|
641
683
|
return -1;
|
642
684
|
}
|
643
685
|
|
@@ -758,7 +800,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
|
|
758
800
|
/* read stat information for submodule working directory */
|
759
801
|
if (p_stat(path.ptr, &st) < 0) {
|
760
802
|
giterr_set(GITERR_SUBMODULE,
|
761
|
-
"
|
803
|
+
"cannot add submodule without working directory");
|
762
804
|
error = -1;
|
763
805
|
goto cleanup;
|
764
806
|
}
|
@@ -771,7 +813,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
|
|
771
813
|
/* calling git_submodule_open will have set sm->wd_oid if possible */
|
772
814
|
if ((sm->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID) == 0) {
|
773
815
|
giterr_set(GITERR_SUBMODULE,
|
774
|
-
"
|
816
|
+
"cannot add submodule without HEAD to index");
|
775
817
|
error = -1;
|
776
818
|
goto cleanup;
|
777
819
|
}
|
@@ -861,7 +903,7 @@ int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *ur
|
|
861
903
|
} else if (strchr(url, ':') != NULL || url[0] == '/') {
|
862
904
|
error = git_buf_sets(out, url);
|
863
905
|
} else {
|
864
|
-
giterr_set(GITERR_SUBMODULE, "
|
906
|
+
giterr_set(GITERR_SUBMODULE, "invalid format for submodule URL");
|
865
907
|
error = -1;
|
866
908
|
}
|
867
909
|
|
@@ -1133,7 +1175,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
1133
1175
|
goto done;
|
1134
1176
|
|
1135
1177
|
if (!init) {
|
1136
|
-
giterr_set(GITERR_SUBMODULE, "
|
1178
|
+
giterr_set(GITERR_SUBMODULE, "submodule is not initialized");
|
1137
1179
|
error = GIT_ERROR;
|
1138
1180
|
goto done;
|
1139
1181
|
}
|
@@ -1160,7 +1202,6 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
1160
1202
|
* will checkout the specific commit manually.
|
1161
1203
|
*/
|
1162
1204
|
clone_options.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
|
1163
|
-
update_options.checkout_opts.checkout_strategy = update_options.clone_checkout_strategy;
|
1164
1205
|
|
1165
1206
|
if ((error = git_clone(&sub_repo, submodule_url, sm->path, &clone_options)) < 0 ||
|
1166
1207
|
(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm))) < 0 ||
|
@@ -1215,7 +1256,7 @@ int git_submodule_init(git_submodule *sm, int overwrite)
|
|
1215
1256
|
|
1216
1257
|
if (!sm->url) {
|
1217
1258
|
giterr_set(GITERR_SUBMODULE,
|
1218
|
-
"
|
1259
|
+
"no URL configured for submodule '%s'", sm->name);
|
1219
1260
|
return -1;
|
1220
1261
|
}
|
1221
1262
|
|
@@ -1259,7 +1300,7 @@ int git_submodule_sync(git_submodule *sm)
|
|
1259
1300
|
|
1260
1301
|
if (!sm->url) {
|
1261
1302
|
giterr_set(GITERR_SUBMODULE,
|
1262
|
-
"
|
1303
|
+
"no URL configured for submodule '%s'", sm->name);
|
1263
1304
|
return -1;
|
1264
1305
|
}
|
1265
1306
|
|
@@ -1502,13 +1543,22 @@ int git_submodule__status(
|
|
1502
1543
|
return 0;
|
1503
1544
|
}
|
1504
1545
|
|
1505
|
-
/*
|
1506
|
-
|
1507
|
-
|
1546
|
+
/* If the user has requested caching submodule state, performing these
|
1547
|
+
* expensive operations (especially `submodule_update_head`, which is
|
1548
|
+
* bottlenecked on `git_repository_head_tree`) eliminates much of the
|
1549
|
+
* advantage. We will, therefore, interpret the request for caching to
|
1550
|
+
* apply here to and skip them.
|
1551
|
+
*/
|
1508
1552
|
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1553
|
+
if (sm->repo->submodule_cache == NULL) {
|
1554
|
+
/* refresh the index OID */
|
1555
|
+
if (submodule_update_index(sm) < 0)
|
1556
|
+
return -1;
|
1557
|
+
|
1558
|
+
/* refresh the HEAD OID */
|
1559
|
+
if (submodule_update_head(sm) < 0)
|
1560
|
+
return -1;
|
1561
|
+
}
|
1512
1562
|
|
1513
1563
|
/* for ignore == dirty, don't scan the working directory */
|
1514
1564
|
if (ign == GIT_SUBMODULE_IGNORE_DIRTY) {
|
@@ -1566,7 +1616,6 @@ int git_submodule_location(unsigned int *location, git_submodule *sm)
|
|
1566
1616
|
location, NULL, NULL, NULL, sm, GIT_SUBMODULE_IGNORE_ALL);
|
1567
1617
|
}
|
1568
1618
|
|
1569
|
-
|
1570
1619
|
/*
|
1571
1620
|
* INTERNAL FUNCTIONS
|
1572
1621
|
*/
|
@@ -1578,7 +1627,7 @@ static int submodule_alloc(
|
|
1578
1627
|
git_submodule *sm;
|
1579
1628
|
|
1580
1629
|
if (!name || !(namelen = strlen(name))) {
|
1581
|
-
giterr_set(GITERR_SUBMODULE, "
|
1630
|
+
giterr_set(GITERR_SUBMODULE, "invalid submodule name");
|
1582
1631
|
return -1;
|
1583
1632
|
}
|
1584
1633
|
|
@@ -1630,7 +1679,7 @@ void git_submodule_free(git_submodule *sm)
|
|
1630
1679
|
static int submodule_config_error(const char *property, const char *value)
|
1631
1680
|
{
|
1632
1681
|
giterr_set(GITERR_INVALID,
|
1633
|
-
"
|
1682
|
+
"invalid value for submodule '%s' property: '%s'", property, value);
|
1634
1683
|
return -1;
|
1635
1684
|
}
|
1636
1685
|
|
@@ -1968,7 +2017,7 @@ static int lookup_default_remote(git_remote **remote, git_repository *repo)
|
|
1968
2017
|
if (error == GIT_ENOTFOUND)
|
1969
2018
|
giterr_set(
|
1970
2019
|
GITERR_SUBMODULE,
|
1971
|
-
"
|
2020
|
+
"cannot get default remote for submodule - no local tracking "
|
1972
2021
|
"branch for HEAD and origin does not exist");
|
1973
2022
|
|
1974
2023
|
return error;
|