rugged 0.27.7 → 0.27.9
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/CMakeLists.txt +6 -2
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
- data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
- data/vendor/libgit2/include/git2.h +0 -1
- data/vendor/libgit2/include/git2/attr.h +7 -18
- data/vendor/libgit2/include/git2/blame.h +22 -39
- data/vendor/libgit2/include/git2/blob.h +1 -1
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +2 -14
- data/vendor/libgit2/include/git2/checkout.h +12 -13
- data/vendor/libgit2/include/git2/cherrypick.h +4 -6
- data/vendor/libgit2/include/git2/clone.h +6 -8
- data/vendor/libgit2/include/git2/commit.h +0 -28
- data/vendor/libgit2/include/git2/common.h +0 -27
- data/vendor/libgit2/include/git2/config.h +0 -1
- data/vendor/libgit2/include/git2/describe.h +7 -30
- data/vendor/libgit2/include/git2/diff.h +22 -32
- data/vendor/libgit2/include/git2/errors.h +0 -1
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/merge.h +8 -10
- data/vendor/libgit2/include/git2/proxy.h +5 -9
- data/vendor/libgit2/include/git2/rebase.h +4 -7
- data/vendor/libgit2/include/git2/refs.h +1 -1
- data/vendor/libgit2/include/git2/refspec.h +0 -17
- data/vendor/libgit2/include/git2/remote.h +10 -12
- data/vendor/libgit2/include/git2/repository.h +5 -7
- data/vendor/libgit2/include/git2/revert.h +3 -5
- data/vendor/libgit2/include/git2/stash.h +8 -11
- data/vendor/libgit2/include/git2/status.h +3 -7
- data/vendor/libgit2/include/git2/submodule.h +7 -8
- data/vendor/libgit2/include/git2/sys/index.h +0 -3
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +1 -6
- data/vendor/libgit2/include/git2/transaction.h +0 -1
- data/vendor/libgit2/include/git2/types.h +5 -8
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +11 -46
- data/vendor/libgit2/src/CMakeLists.txt +28 -91
- data/vendor/libgit2/src/annotated_commit.c +4 -4
- data/vendor/libgit2/src/apply.c +6 -5
- data/vendor/libgit2/src/attr.c +4 -4
- data/vendor/libgit2/src/attr_file.c +5 -5
- data/vendor/libgit2/src/attrcache.c +2 -2
- data/vendor/libgit2/src/blame.c +4 -11
- data/vendor/libgit2/src/blame.h +0 -1
- data/vendor/libgit2/src/blame_git.c +5 -8
- data/vendor/libgit2/src/blob.c +5 -5
- data/vendor/libgit2/src/branch.c +20 -20
- data/vendor/libgit2/src/buffer.c +4 -9
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/checkout.c +24 -33
- data/vendor/libgit2/src/cherrypick.c +3 -3
- data/vendor/libgit2/src/clone.c +13 -13
- data/vendor/libgit2/src/commit.c +5 -18
- data/vendor/libgit2/src/commit_list.c +9 -3
- data/vendor/libgit2/src/common.h +1 -3
- data/vendor/libgit2/src/config.c +15 -6
- data/vendor/libgit2/src/config_file.c +249 -193
- data/vendor/libgit2/src/config_parse.c +66 -89
- data/vendor/libgit2/src/config_parse.h +2 -2
- data/vendor/libgit2/src/crlf.c +3 -9
- data/vendor/libgit2/src/diff.c +2 -2
- data/vendor/libgit2/src/diff_driver.c +3 -3
- data/vendor/libgit2/src/diff_file.c +3 -3
- data/vendor/libgit2/src/diff_generate.c +3 -4
- data/vendor/libgit2/src/diff_print.c +8 -8
- data/vendor/libgit2/src/diff_tform.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.c +0 -12
- data/vendor/libgit2/src/features.h.in +0 -2
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetchhead.c +5 -5
- data/vendor/libgit2/src/filebuf.c +4 -4
- data/vendor/libgit2/src/fileops.c +10 -10
- data/vendor/libgit2/src/filter.c +9 -3
- data/vendor/libgit2/src/global.c +12 -17
- data/vendor/libgit2/src/hash.h +0 -2
- data/vendor/libgit2/src/ignore.c +5 -5
- data/vendor/libgit2/src/index.c +40 -80
- data/vendor/libgit2/src/index.h +0 -10
- data/vendor/libgit2/src/indexer.c +9 -9
- data/vendor/libgit2/src/iterator.c +8 -8
- data/vendor/libgit2/src/khash.h +1 -3
- data/vendor/libgit2/src/merge.c +7 -7
- data/vendor/libgit2/src/netops.c +5 -5
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/odb.c +9 -9
- data/vendor/libgit2/src/odb_loose.c +22 -18
- data/vendor/libgit2/src/odb_pack.c +3 -3
- data/vendor/libgit2/src/pack-objects.c +3 -3
- data/vendor/libgit2/src/pack.c +5 -5
- data/vendor/libgit2/src/pack.h +1 -1
- data/vendor/libgit2/src/parse.c +7 -4
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +4 -24
- data/vendor/libgit2/src/path.c +140 -39
- data/vendor/libgit2/src/path.h +84 -2
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/push.c +2 -2
- data/vendor/libgit2/src/rebase.c +23 -20
- data/vendor/libgit2/src/refdb_fs.c +34 -65
- data/vendor/libgit2/src/refs.c +16 -13
- data/vendor/libgit2/src/refspec.c +5 -30
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +43 -43
- data/vendor/libgit2/src/repository.c +56 -56
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revert.c +3 -3
- data/vendor/libgit2/src/revparse.c +7 -6
- data/vendor/libgit2/src/revwalk.c +20 -48
- data/vendor/libgit2/src/revwalk.h +1 -2
- data/vendor/libgit2/src/settings.c +1 -25
- data/vendor/libgit2/src/signature.c +4 -2
- data/vendor/libgit2/src/stash.c +34 -80
- data/vendor/libgit2/src/status.c +1 -1
- data/vendor/libgit2/src/streams/curl.c +1 -1
- data/vendor/libgit2/src/streams/openssl.c +34 -132
- data/vendor/libgit2/src/streams/openssl.h +107 -0
- data/vendor/libgit2/src/streams/tls.c +0 -3
- data/vendor/libgit2/src/submodule.c +83 -118
- data/vendor/libgit2/src/sysdir.c +4 -4
- data/vendor/libgit2/src/tag.c +12 -12
- data/vendor/libgit2/src/trace.h +1 -1
- data/vendor/libgit2/src/trailer.c +6 -6
- data/vendor/libgit2/src/transport.c +2 -2
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -2
- data/vendor/libgit2/src/transports/git.c +1 -1
- data/vendor/libgit2/src/transports/http.c +15 -12
- data/vendor/libgit2/src/transports/local.c +7 -7
- data/vendor/libgit2/src/transports/smart.c +15 -20
- data/vendor/libgit2/src/transports/smart.h +5 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +131 -123
- data/vendor/libgit2/src/transports/smart_protocol.c +38 -48
- data/vendor/libgit2/src/transports/ssh.c +1 -1
- data/vendor/libgit2/src/transports/winhttp.c +26 -21
- data/vendor/libgit2/src/tree-cache.c +2 -2
- data/vendor/libgit2/src/tree.c +69 -23
- data/vendor/libgit2/src/tree.h +12 -0
- data/vendor/libgit2/src/util.c +99 -52
- data/vendor/libgit2/src/util.h +138 -14
- data/vendor/libgit2/src/vector.c +13 -8
- data/vendor/libgit2/src/win32/findfile.c +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +1 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -94
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -28
- data/vendor/libgit2/src/worktree.c +44 -65
- data/vendor/libgit2/src/worktree.h +0 -2
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -3
- metadata +5 -17
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
- data/vendor/libgit2/include/git2/mailmap.h +0 -115
- data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
- data/vendor/libgit2/include/git2/sys/path.h +0 -55
- data/vendor/libgit2/src/alloc.c +0 -47
- data/vendor/libgit2/src/alloc.h +0 -40
- data/vendor/libgit2/src/hash/hash_mbedtls.c +0 -38
- data/vendor/libgit2/src/hash/hash_mbedtls.h +0 -20
- data/vendor/libgit2/src/mailmap.c +0 -485
- data/vendor/libgit2/src/mailmap.h +0 -35
- data/vendor/libgit2/src/stdalloc.c +0 -120
- data/vendor/libgit2/src/stdalloc.h +0 -17
- data/vendor/libgit2/src/streams/mbedtls.c +0 -463
- data/vendor/libgit2/src/streams/mbedtls.h +0 -20
data/vendor/libgit2/src/path.h
CHANGED
@@ -13,8 +13,6 @@
|
|
13
13
|
#include "buffer.h"
|
14
14
|
#include "vector.h"
|
15
15
|
|
16
|
-
#include "git2/sys/path.h"
|
17
|
-
|
18
16
|
/**
|
19
17
|
* Path manipulation utils
|
20
18
|
*
|
@@ -647,4 +645,88 @@ extern bool git_path_isvalid(
|
|
647
645
|
*/
|
648
646
|
int git_path_normalize_slashes(git_buf *out, const char *path);
|
649
647
|
|
648
|
+
/**
|
649
|
+
* Check whether a path component corresponds to a .gitmodules file
|
650
|
+
*
|
651
|
+
* @param name the path component to check
|
652
|
+
* @param len the length of `name`
|
653
|
+
*/
|
654
|
+
extern int git_path_is_dotgit_modules(const char *name, size_t len);
|
655
|
+
|
656
|
+
/**
|
657
|
+
* Check whether a path component corresponds to a .gitmodules file in NTFS
|
658
|
+
*
|
659
|
+
* @param name the path component to check
|
660
|
+
* @param len the length of `name`
|
661
|
+
*/
|
662
|
+
extern int git_path_is_ntfs_dotgit_modules(const char *name, size_t len);
|
663
|
+
|
664
|
+
/**
|
665
|
+
* Check whether a path component corresponds to a .gitmodules file in HFS+
|
666
|
+
*
|
667
|
+
* @param name the path component to check
|
668
|
+
* @param len the length of `name`
|
669
|
+
*/
|
670
|
+
extern int git_path_is_hfs_dotgit_modules(const char *name, size_t len);
|
671
|
+
|
672
|
+
/**
|
673
|
+
* Check whether a path component corresponds to a .gitignore file
|
674
|
+
*
|
675
|
+
* @param name the path component to check
|
676
|
+
* @param len the length of `name`
|
677
|
+
*/
|
678
|
+
extern int git_path_is_dotgit_ignore(const char *name, size_t len);
|
679
|
+
|
680
|
+
/**
|
681
|
+
* Check whether a path component corresponds to a .gitignore file in NTFS
|
682
|
+
*
|
683
|
+
* @param name the path component to check
|
684
|
+
* @param len the length of `name`
|
685
|
+
*/
|
686
|
+
extern int git_path_is_ntfs_dotgit_ignore(const char *name, size_t len);
|
687
|
+
|
688
|
+
/**
|
689
|
+
* Check whether a path component corresponds to a .gitignore file in HFS+
|
690
|
+
*
|
691
|
+
* @param name the path component to check
|
692
|
+
* @param len the length of `name`
|
693
|
+
*/
|
694
|
+
extern int git_path_is_hfs_dotgit_ignore(const char *name, size_t len);
|
695
|
+
|
696
|
+
/**
|
697
|
+
* Check whether a path component corresponds to a .gitignore file
|
698
|
+
*
|
699
|
+
* @param name the path component to check
|
700
|
+
* @param len the length of `name`
|
701
|
+
*/
|
702
|
+
extern int git_path_is_dotgit_attributes(const char *name, size_t len);
|
703
|
+
|
704
|
+
/**
|
705
|
+
* Check whether a path component corresponds to a .gitattributes file in NTFS
|
706
|
+
*
|
707
|
+
* @param name the path component to check
|
708
|
+
* @param len the length of `name`
|
709
|
+
*/
|
710
|
+
extern int git_path_is_ntfs_dotgit_attributes(const char *name, size_t len);
|
711
|
+
|
712
|
+
/**
|
713
|
+
* Check whether a path component corresponds to a .gitattributes file in HFS+
|
714
|
+
*
|
715
|
+
* @param name the path component to check
|
716
|
+
* @param len the length of `name`
|
717
|
+
*/
|
718
|
+
extern int git_path_is_hfs_dotgit_attributes(const char *name, size_t len);
|
719
|
+
|
720
|
+
/*
|
721
|
+
* Validate a system file's ownership
|
722
|
+
*
|
723
|
+
* Verify that the file in question is owned by an administrator or system
|
724
|
+
* account, or at least by the current user.
|
725
|
+
*
|
726
|
+
* This function returns 0 if successful. If the file is not owned by any of
|
727
|
+
* these, or any other if there have been problems determining the file
|
728
|
+
* ownership, it returns -1.
|
729
|
+
*/
|
730
|
+
int git_path_validate_system_file_ownership(const char *path);
|
731
|
+
|
650
732
|
#endif
|
data/vendor/libgit2/src/push.c
CHANGED
@@ -83,7 +83,7 @@ static void free_refspec(push_spec *spec)
|
|
83
83
|
if (spec == NULL)
|
84
84
|
return;
|
85
85
|
|
86
|
-
|
86
|
+
git_refspec__free(&spec->refspec);
|
87
87
|
git__free(spec);
|
88
88
|
}
|
89
89
|
|
@@ -228,7 +228,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
|
|
228
228
|
error = 0;
|
229
229
|
|
230
230
|
on_error:
|
231
|
-
|
231
|
+
git_buf_free(&remote_ref_name);
|
232
232
|
return error;
|
233
233
|
}
|
234
234
|
|
data/vendor/libgit2/src/rebase.c
CHANGED
@@ -116,7 +116,7 @@ done:
|
|
116
116
|
if (type != GIT_REBASE_TYPE_NONE && path_out)
|
117
117
|
*path_out = git_buf_detach(&path);
|
118
118
|
|
119
|
-
|
119
|
+
git_buf_free(&path);
|
120
120
|
|
121
121
|
return 0;
|
122
122
|
}
|
@@ -152,7 +152,7 @@ GIT_INLINE(int) rebase_readint(
|
|
152
152
|
if ((error = rebase_readfile(asc_out, state_path, filename)) < 0)
|
153
153
|
return error;
|
154
154
|
|
155
|
-
if (
|
155
|
+
if (git__strntol32(&num, asc_out->ptr, asc_out->size, &eol, 10) < 0 || num < 0 || *eol) {
|
156
156
|
giterr_set(GITERR_REBASE, "the file '%s' contains an invalid numeric value", filename);
|
157
157
|
return -1;
|
158
158
|
}
|
@@ -251,9 +251,9 @@ static int rebase_open_merge(git_rebase *rebase)
|
|
251
251
|
rebase->onto_name = git_buf_detach(&buf);
|
252
252
|
|
253
253
|
done:
|
254
|
-
|
255
|
-
|
256
|
-
|
254
|
+
git_buf_free(&cmt);
|
255
|
+
git_buf_free(&state_path);
|
256
|
+
git_buf_free(&buf);
|
257
257
|
|
258
258
|
return error;
|
259
259
|
}
|
@@ -275,6 +275,9 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
|
|
275
275
|
GITERR_CHECK_ALLOC(rebase->options.rewrite_notes_ref);
|
276
276
|
}
|
277
277
|
|
278
|
+
if ((rebase->options.checkout_options.checkout_strategy & (GIT_CHECKOUT_SAFE | GIT_CHECKOUT_FORCE)) == 0)
|
279
|
+
rebase->options.checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE;
|
280
|
+
|
278
281
|
*out = rebase;
|
279
282
|
|
280
283
|
return 0;
|
@@ -390,10 +393,10 @@ done:
|
|
390
393
|
else
|
391
394
|
git_rebase_free(rebase);
|
392
395
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
396
|
+
git_buf_free(&path);
|
397
|
+
git_buf_free(&orig_head_name);
|
398
|
+
git_buf_free(&orig_head_id);
|
399
|
+
git_buf_free(&onto_id);
|
397
400
|
return error;
|
398
401
|
}
|
399
402
|
|
@@ -421,8 +424,8 @@ static int rebase_setupfile(git_rebase *rebase, const char *filename, int flags,
|
|
421
424
|
if ((error = git_buf_joinpath(&path, rebase->state_path, filename)) == 0)
|
422
425
|
error = git_futils_writebuffer(&contents, path.ptr, flags, REBASE_FILE_MODE);
|
423
426
|
|
424
|
-
|
425
|
-
|
427
|
+
git_buf_free(&path);
|
428
|
+
git_buf_free(&contents);
|
426
429
|
|
427
430
|
return error;
|
428
431
|
}
|
@@ -463,7 +466,7 @@ static int rebase_setupfiles_merge(git_rebase *rebase)
|
|
463
466
|
}
|
464
467
|
|
465
468
|
done:
|
466
|
-
|
469
|
+
git_buf_free(&commit_filename);
|
467
470
|
return error;
|
468
471
|
}
|
469
472
|
|
@@ -659,8 +662,8 @@ static int rebase_init_merge(
|
|
659
662
|
done:
|
660
663
|
git_reference_free(head_ref);
|
661
664
|
git_commit_free(onto_commit);
|
662
|
-
|
663
|
-
|
665
|
+
git_buf_free(&reflog);
|
666
|
+
git_buf_free(&state_path);
|
664
667
|
|
665
668
|
return error;
|
666
669
|
}
|
@@ -839,7 +842,7 @@ done:
|
|
839
842
|
git_tree_free(parent_tree);
|
840
843
|
git_commit_free(parent_commit);
|
841
844
|
git_commit_free(current_commit);
|
842
|
-
|
845
|
+
git_buf_free(&path);
|
843
846
|
|
844
847
|
return error;
|
845
848
|
}
|
@@ -1263,9 +1266,9 @@ on_error:
|
|
1263
1266
|
error = -1;
|
1264
1267
|
|
1265
1268
|
done:
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
+
git_buf_free(&rewritten);
|
1270
|
+
git_buf_free(&path);
|
1271
|
+
git_buf_free(¬es_ref);
|
1269
1272
|
|
1270
1273
|
return error;
|
1271
1274
|
}
|
@@ -1297,8 +1300,8 @@ static int return_to_orig_head(git_rebase *rebase)
|
|
1297
1300
|
rebase->repo, GIT_HEAD_FILE, rebase->orig_head_name, 1,
|
1298
1301
|
head_msg.ptr);
|
1299
1302
|
|
1300
|
-
|
1301
|
-
|
1303
|
+
git_buf_free(&head_msg);
|
1304
|
+
git_buf_free(&branch_msg);
|
1302
1305
|
git_commit_free(terminal_commit);
|
1303
1306
|
git_reference_free(head_ref);
|
1304
1307
|
git_reference_free(branch_ref);
|
@@ -183,7 +183,7 @@ static int packed_reload(refdb_fs_backend *backend)
|
|
183
183
|
}
|
184
184
|
|
185
185
|
git_sortedcache_wunlock(backend->refcache);
|
186
|
-
|
186
|
+
git_buf_free(&packedrefs);
|
187
187
|
|
188
188
|
return 0;
|
189
189
|
|
@@ -192,7 +192,7 @@ parse_failed:
|
|
192
192
|
|
193
193
|
git_sortedcache_clear(backend->refcache, false);
|
194
194
|
git_sortedcache_wunlock(backend->refcache);
|
195
|
-
|
195
|
+
git_buf_free(&packedrefs);
|
196
196
|
|
197
197
|
return -1;
|
198
198
|
}
|
@@ -226,7 +226,7 @@ static int loose_readbuffer(git_buf *buf, const char *base, const char *path)
|
|
226
226
|
/* build full path to file */
|
227
227
|
if ((error = git_buf_joinpath(buf, base, path)) < 0 ||
|
228
228
|
(error = git_futils_readbuffer(buf, buf->ptr)) < 0)
|
229
|
-
|
229
|
+
git_buf_free(buf);
|
230
230
|
|
231
231
|
return error;
|
232
232
|
}
|
@@ -266,7 +266,7 @@ static int loose_lookup_to_packfile(refdb_fs_backend *backend, const char *name)
|
|
266
266
|
git_sortedcache_wunlock(backend->refcache);
|
267
267
|
|
268
268
|
done:
|
269
|
-
|
269
|
+
git_buf_free(&ref_file);
|
270
270
|
return error;
|
271
271
|
}
|
272
272
|
|
@@ -317,7 +317,7 @@ static int packed_loadloose(refdb_fs_backend *backend)
|
|
317
317
|
error = git_path_direach(
|
318
318
|
&refs_path, backend->direach_flags, _dirent_loose_load, backend);
|
319
319
|
|
320
|
-
|
320
|
+
git_buf_free(&refs_path);
|
321
321
|
|
322
322
|
return error;
|
323
323
|
}
|
@@ -340,7 +340,7 @@ static int refdb_fs_backend__exists(
|
|
340
340
|
*exists = git_path_isfile(ref_path.ptr) ||
|
341
341
|
(git_sortedcache_lookup(backend->refcache, ref_name) != NULL);
|
342
342
|
|
343
|
-
|
343
|
+
git_buf_free(&ref_path);
|
344
344
|
return 0;
|
345
345
|
}
|
346
346
|
|
@@ -414,7 +414,7 @@ static int loose_lookup(
|
|
414
414
|
*out = git_reference__alloc(ref_name, &oid, NULL);
|
415
415
|
}
|
416
416
|
|
417
|
-
|
417
|
+
git_buf_free(&ref_file);
|
418
418
|
return error;
|
419
419
|
}
|
420
420
|
|
@@ -505,57 +505,26 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
505
505
|
git_iterator *fsit = NULL;
|
506
506
|
git_iterator_options fsit_opts = GIT_ITERATOR_OPTIONS_INIT;
|
507
507
|
const git_index_entry *entry = NULL;
|
508
|
-
const char *ref_prefix = GIT_REFS_DIR;
|
509
|
-
size_t ref_prefix_len = strlen(ref_prefix);
|
510
508
|
|
511
509
|
if (!backend->commonpath) /* do nothing if no commonpath for loose refs */
|
512
510
|
return 0;
|
513
511
|
|
514
512
|
fsit_opts.flags = backend->iterator_flags;
|
515
513
|
|
516
|
-
if (
|
517
|
-
|
518
|
-
|
519
|
-
for (pos = iter->glob; *pos; ++pos) {
|
520
|
-
switch (*pos) {
|
521
|
-
case '?':
|
522
|
-
case '*':
|
523
|
-
case '[':
|
524
|
-
case '\\':
|
525
|
-
break;
|
526
|
-
case '/':
|
527
|
-
last_sep = pos;
|
528
|
-
/* FALLTHROUGH */
|
529
|
-
default:
|
530
|
-
continue;
|
531
|
-
}
|
532
|
-
break;
|
533
|
-
}
|
534
|
-
if (last_sep) {
|
535
|
-
ref_prefix = iter->glob;
|
536
|
-
ref_prefix_len = (last_sep - ref_prefix) + 1;
|
537
|
-
}
|
538
|
-
}
|
539
|
-
|
540
|
-
if ((error = git_buf_printf(&path, "%s/", backend->commonpath)) < 0 ||
|
541
|
-
(error = git_buf_put(&path, ref_prefix, ref_prefix_len)) < 0) {
|
542
|
-
git_buf_dispose(&path);
|
514
|
+
if ((error = git_buf_printf(&path, "%s/refs", backend->commonpath)) < 0 ||
|
515
|
+
(error = git_iterator_for_filesystem(&fsit, path.ptr, &fsit_opts)) < 0) {
|
516
|
+
git_buf_free(&path);
|
543
517
|
return error;
|
544
518
|
}
|
545
519
|
|
546
|
-
|
547
|
-
git_buf_dispose(&path);
|
548
|
-
return (iter->glob && error == GIT_ENOTFOUND)? 0 : error;
|
549
|
-
}
|
550
|
-
|
551
|
-
error = git_buf_sets(&path, ref_prefix);
|
520
|
+
error = git_buf_sets(&path, GIT_REFS_DIR);
|
552
521
|
|
553
522
|
while (!error && !git_iterator_advance(&entry, fsit)) {
|
554
523
|
const char *ref_name;
|
555
524
|
struct packref *ref;
|
556
525
|
char *ref_dup;
|
557
526
|
|
558
|
-
git_buf_truncate(&path,
|
527
|
+
git_buf_truncate(&path, strlen(GIT_REFS_DIR));
|
559
528
|
git_buf_puts(&path, entry->path);
|
560
529
|
ref_name = git_buf_cstr(&path);
|
561
530
|
|
@@ -577,7 +546,7 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
577
546
|
}
|
578
547
|
|
579
548
|
git_iterator_free(fsit);
|
580
|
-
|
549
|
+
git_buf_free(&path);
|
581
550
|
|
582
551
|
return error;
|
583
552
|
}
|
@@ -803,7 +772,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
|
|
803
772
|
if (error == GIT_EDIRECTORY)
|
804
773
|
giterr_set(GITERR_REFERENCE, "cannot lock ref '%s', there are refs beneath that folder", name);
|
805
774
|
|
806
|
-
|
775
|
+
git_buf_free(&ref_path);
|
807
776
|
return error;
|
808
777
|
}
|
809
778
|
|
@@ -990,7 +959,7 @@ static int packed_remove_loose(refdb_fs_backend *backend)
|
|
990
959
|
continue;
|
991
960
|
|
992
961
|
if (error < 0) {
|
993
|
-
|
962
|
+
git_buf_free(&ref_content);
|
994
963
|
giterr_set(GITERR_REFERENCE, "failed to lock loose reference '%s'", ref->name);
|
995
964
|
return error;
|
996
965
|
}
|
@@ -1021,7 +990,7 @@ static int packed_remove_loose(refdb_fs_backend *backend)
|
|
1021
990
|
p_unlink(lock.path_original);
|
1022
991
|
}
|
1023
992
|
|
1024
|
-
|
993
|
+
git_buf_free(&ref_content);
|
1025
994
|
git_filebuf_cleanup(&lock);
|
1026
995
|
return 0;
|
1027
996
|
}
|
@@ -1350,7 +1319,7 @@ static int refdb_fs_backend__delete_tail(
|
|
1350
1319
|
}
|
1351
1320
|
|
1352
1321
|
/* If a loose reference exists, remove it from the filesystem */
|
1353
|
-
if (git_buf_joinpath(&loose_path, backend->
|
1322
|
+
if (git_buf_joinpath(&loose_path, backend->gitpath, ref_name) < 0)
|
1354
1323
|
return -1;
|
1355
1324
|
|
1356
1325
|
|
@@ -1383,7 +1352,7 @@ static int refdb_fs_backend__delete_tail(
|
|
1383
1352
|
error = packed_write(backend);
|
1384
1353
|
|
1385
1354
|
cleanup:
|
1386
|
-
|
1355
|
+
git_buf_free(&loose_path);
|
1387
1356
|
git_filebuf_cleanup(file);
|
1388
1357
|
|
1389
1358
|
return error;
|
@@ -1522,7 +1491,7 @@ static char *setup_namespace(git_repository *repo, const char *in)
|
|
1522
1491
|
out = git_buf_detach(&path);
|
1523
1492
|
|
1524
1493
|
done:
|
1525
|
-
|
1494
|
+
git_buf_free(&path);
|
1526
1495
|
return out;
|
1527
1496
|
}
|
1528
1497
|
|
@@ -1655,7 +1624,7 @@ static int refdb_reflog_fs__ensure_log(git_refdb_backend *_backend, const char *
|
|
1655
1624
|
return error;
|
1656
1625
|
|
1657
1626
|
error = create_new_reflog_file(git_buf_cstr(&path));
|
1658
|
-
|
1627
|
+
git_buf_free(&path);
|
1659
1628
|
|
1660
1629
|
return error;
|
1661
1630
|
}
|
@@ -1671,7 +1640,7 @@ static int has_reflog(git_repository *repo, const char *name)
|
|
1671
1640
|
ret = git_path_isfile(git_buf_cstr(&path));
|
1672
1641
|
|
1673
1642
|
cleanup:
|
1674
|
-
|
1643
|
+
git_buf_free(&path);
|
1675
1644
|
return ret;
|
1676
1645
|
}
|
1677
1646
|
|
@@ -1725,8 +1694,8 @@ cleanup:
|
|
1725
1694
|
git_reflog_free(log);
|
1726
1695
|
|
1727
1696
|
success:
|
1728
|
-
|
1729
|
-
|
1697
|
+
git_buf_free(&log_file);
|
1698
|
+
git_buf_free(&log_path);
|
1730
1699
|
|
1731
1700
|
return error;
|
1732
1701
|
}
|
@@ -1791,7 +1760,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
|
|
1791
1760
|
error = git_filebuf_open(file, git_buf_cstr(&log_path), 0, GIT_REFLOG_FILE_MODE);
|
1792
1761
|
|
1793
1762
|
cleanup:
|
1794
|
-
|
1763
|
+
git_buf_free(&log_path);
|
1795
1764
|
|
1796
1765
|
return error;
|
1797
1766
|
}
|
@@ -1827,7 +1796,7 @@ cleanup:
|
|
1827
1796
|
git_filebuf_cleanup(&fbuf);
|
1828
1797
|
|
1829
1798
|
success:
|
1830
|
-
|
1799
|
+
git_buf_free(&log);
|
1831
1800
|
|
1832
1801
|
return error;
|
1833
1802
|
}
|
@@ -1911,8 +1880,8 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
|
|
1911
1880
|
error = git_futils_writebuffer(&buf, git_buf_cstr(&path), open_flags, GIT_REFLOG_FILE_MODE);
|
1912
1881
|
|
1913
1882
|
cleanup:
|
1914
|
-
|
1915
|
-
|
1883
|
+
git_buf_free(&buf);
|
1884
|
+
git_buf_free(&path);
|
1916
1885
|
|
1917
1886
|
return error;
|
1918
1887
|
}
|
@@ -1990,10 +1959,10 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
1990
1959
|
}
|
1991
1960
|
|
1992
1961
|
cleanup:
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1962
|
+
git_buf_free(&temp_path);
|
1963
|
+
git_buf_free(&old_path);
|
1964
|
+
git_buf_free(&new_path);
|
1965
|
+
git_buf_free(&normalized);
|
1997
1966
|
|
1998
1967
|
return error;
|
1999
1968
|
}
|
@@ -2016,7 +1985,7 @@ static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name
|
|
2016
1985
|
if (!error && git_path_exists(path.ptr))
|
2017
1986
|
error = p_unlink(path.ptr);
|
2018
1987
|
|
2019
|
-
|
1988
|
+
git_buf_free(&path);
|
2020
1989
|
|
2021
1990
|
return error;
|
2022
1991
|
|
@@ -2055,7 +2024,7 @@ int git_refdb_backend_fs(
|
|
2055
2024
|
NULL, NULL, packref_cmp, git_buf_cstr(&gitpath)) < 0)
|
2056
2025
|
goto fail;
|
2057
2026
|
|
2058
|
-
|
2027
|
+
git_buf_free(&gitpath);
|
2059
2028
|
|
2060
2029
|
if (!git_repository__cvar(&t, backend->repo, GIT_CVAR_IGNORECASE) && t) {
|
2061
2030
|
backend->iterator_flags |= GIT_ITERATOR_IGNORE_CASE;
|
@@ -2091,7 +2060,7 @@ int git_refdb_backend_fs(
|
|
2091
2060
|
return 0;
|
2092
2061
|
|
2093
2062
|
fail:
|
2094
|
-
|
2063
|
+
git_buf_free(&gitpath);
|
2095
2064
|
git__free(backend->gitpath);
|
2096
2065
|
git__free(backend->commonpath);
|
2097
2066
|
git__free(backend);
|