rugged 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -1
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +11 -6
- data/vendor/libgit2/COPYING +109 -1
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +4 -0
- data/vendor/libgit2/cmake/SelectHashes.cmake +1 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +18 -5
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -34
- data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +156 -124
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
- data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
- data/vendor/libgit2/include/git2/apply.h +2 -0
- data/vendor/libgit2/include/git2/attr.h +89 -0
- data/vendor/libgit2/include/git2/blame.h +93 -42
- data/vendor/libgit2/include/git2/blob.h +31 -3
- data/vendor/libgit2/include/git2/branch.h +25 -0
- data/vendor/libgit2/include/git2/cert.h +42 -5
- data/vendor/libgit2/include/git2/checkout.h +28 -12
- data/vendor/libgit2/include/git2/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +19 -4
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +206 -6
- data/vendor/libgit2/include/git2/diff.h +35 -20
- data/vendor/libgit2/include/git2/errors.h +6 -6
- data/vendor/libgit2/include/git2/filter.h +57 -17
- data/vendor/libgit2/include/git2/graph.h +20 -2
- data/vendor/libgit2/include/git2/index.h +3 -3
- data/vendor/libgit2/include/git2/indexer.h +2 -1
- data/vendor/libgit2/include/git2/odb.h +44 -20
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/rebase.h +25 -1
- data/vendor/libgit2/include/git2/refs.h +9 -5
- data/vendor/libgit2/include/git2/remote.h +59 -6
- data/vendor/libgit2/include/git2/repository.h +95 -52
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/status.h +115 -59
- data/vendor/libgit2/include/git2/submodule.h +9 -0
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/include/git2/tag.h +12 -0
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/tree.h +2 -14
- data/vendor/libgit2/include/git2/types.h +9 -0
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +25 -4
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/apply.c +16 -7
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/attr.c +181 -74
- data/vendor/libgit2/src/attr_file.c +84 -39
- data/vendor/libgit2/src/attr_file.h +32 -11
- data/vendor/libgit2/src/attrcache.c +42 -37
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +26 -15
- data/vendor/libgit2/src/blob.c +44 -24
- data/vendor/libgit2/src/branch.c +69 -17
- data/vendor/libgit2/src/buffer.c +334 -25
- data/vendor/libgit2/src/buffer.h +153 -2
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +10 -2
- data/vendor/libgit2/src/checkout.c +48 -26
- data/vendor/libgit2/src/cherrypick.c +6 -2
- data/vendor/libgit2/src/clone.c +26 -11
- data/vendor/libgit2/src/commit.c +41 -28
- data/vendor/libgit2/src/commit_graph.c +1209 -0
- data/vendor/libgit2/src/commit_graph.h +162 -0
- data/vendor/libgit2/src/commit_list.c +46 -0
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +25 -2
- data/vendor/libgit2/src/config.c +37 -15
- data/vendor/libgit2/src/config_cache.c +9 -4
- data/vendor/libgit2/src/config_file.c +16 -8
- data/vendor/libgit2/src/config_parse.c +4 -6
- data/vendor/libgit2/src/crlf.c +16 -6
- data/vendor/libgit2/src/date.c +4 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +6 -3
- data/vendor/libgit2/src/diff.c +11 -8
- data/vendor/libgit2/src/diff_driver.c +21 -17
- data/vendor/libgit2/src/diff_file.c +2 -6
- data/vendor/libgit2/src/diff_generate.c +46 -17
- data/vendor/libgit2/src/diff_print.c +19 -6
- data/vendor/libgit2/src/diff_stats.c +7 -5
- data/vendor/libgit2/src/diff_tform.c +11 -10
- data/vendor/libgit2/src/diff_xdiff.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/errors.c +24 -19
- data/vendor/libgit2/src/features.h.in +5 -1
- data/vendor/libgit2/src/fetch.c +5 -2
- data/vendor/libgit2/src/fetchhead.c +8 -4
- data/vendor/libgit2/src/filebuf.c +9 -7
- data/vendor/libgit2/src/filter.c +206 -110
- data/vendor/libgit2/src/filter.h +24 -5
- data/vendor/libgit2/src/futils.c +5 -5
- data/vendor/libgit2/src/futils.h +1 -1
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
- data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +0 -2
- data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
- data/vendor/libgit2/src/hash.c +16 -13
- data/vendor/libgit2/src/hash.h +1 -1
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +13 -3
- data/vendor/libgit2/src/ignore.c +35 -19
- data/vendor/libgit2/src/index.c +112 -75
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +50 -32
- data/vendor/libgit2/src/integer.h +79 -2
- data/vendor/libgit2/src/iterator.c +36 -24
- data/vendor/libgit2/src/iterator.h +1 -1
- data/vendor/libgit2/src/khash.h +2 -11
- data/vendor/libgit2/src/{settings.c → libgit2.c} +117 -50
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +23 -10
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +75 -32
- data/vendor/libgit2/src/merge.h +2 -1
- data/vendor/libgit2/src/merge_driver.c +19 -13
- data/vendor/libgit2/src/merge_file.c +11 -3
- data/vendor/libgit2/src/message.c +3 -1
- data/vendor/libgit2/src/midx.c +471 -10
- data/vendor/libgit2/src/midx.h +28 -1
- data/vendor/libgit2/src/mwindow.c +106 -60
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +127 -3
- data/vendor/libgit2/src/net.h +16 -2
- data/vendor/libgit2/src/netops.c +6 -4
- data/vendor/libgit2/src/netops.h +2 -2
- data/vendor/libgit2/src/notes.c +10 -10
- data/vendor/libgit2/src/object.c +22 -14
- data/vendor/libgit2/src/odb.c +289 -51
- data/vendor/libgit2/src/odb.h +16 -2
- data/vendor/libgit2/src/odb_loose.c +28 -18
- data/vendor/libgit2/src/odb_mempack.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +391 -114
- data/vendor/libgit2/src/oid.c +5 -4
- data/vendor/libgit2/src/pack-objects.c +54 -48
- data/vendor/libgit2/src/pack.c +339 -125
- data/vendor/libgit2/src/pack.h +25 -7
- data/vendor/libgit2/src/patch.c +14 -7
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +2 -1
- data/vendor/libgit2/src/path.c +98 -53
- data/vendor/libgit2/src/path.h +79 -6
- data/vendor/libgit2/src/pathspec.c +8 -8
- data/vendor/libgit2/src/pool.c +13 -7
- data/vendor/libgit2/src/posix.c +43 -12
- data/vendor/libgit2/src/posix.h +9 -0
- data/vendor/libgit2/src/reader.c +10 -6
- data/vendor/libgit2/src/rebase.c +93 -49
- data/vendor/libgit2/src/refdb.c +30 -13
- data/vendor/libgit2/src/refdb_fs.c +125 -71
- data/vendor/libgit2/src/reflog.c +19 -14
- data/vendor/libgit2/src/refs.c +91 -43
- data/vendor/libgit2/src/refs.h +1 -1
- data/vendor/libgit2/src/refspec.c +80 -44
- data/vendor/libgit2/src/remote.c +281 -105
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +191 -118
- data/vendor/libgit2/src/repository.h +13 -2
- data/vendor/libgit2/src/reset.c +7 -6
- data/vendor/libgit2/src/revert.c +6 -2
- data/vendor/libgit2/src/revparse.c +14 -9
- data/vendor/libgit2/src/revwalk.c +32 -15
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/settings.h +11 -0
- data/vendor/libgit2/src/signature.c +6 -5
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +3 -1
- data/vendor/libgit2/src/status.c +7 -4
- data/vendor/libgit2/src/strarray.c +2 -1
- data/vendor/libgit2/src/streams/mbedtls.c +14 -17
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +101 -201
- data/vendor/libgit2/src/streams/openssl.h +9 -1
- data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
- data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
- data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
- data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
- data/vendor/libgit2/src/streams/registry.c +5 -6
- data/vendor/libgit2/src/streams/socket.c +6 -2
- data/vendor/libgit2/src/streams/stransport.c +6 -3
- data/vendor/libgit2/src/streams/tls.c +5 -3
- data/vendor/libgit2/src/submodule.c +128 -62
- data/vendor/libgit2/src/submodule.h +9 -9
- data/vendor/libgit2/src/sysdir.c +4 -6
- data/vendor/libgit2/src/tag.c +47 -11
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +83 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +17 -13
- data/vendor/libgit2/src/transaction.c +19 -8
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
- data/vendor/libgit2/src/transports/credential.c +15 -7
- data/vendor/libgit2/src/transports/git.c +1 -3
- data/vendor/libgit2/src/transports/http.c +19 -17
- data/vendor/libgit2/src/transports/http.h +1 -0
- data/vendor/libgit2/src/transports/httpclient.c +62 -30
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +3 -3
- data/vendor/libgit2/src/transports/smart.c +12 -7
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
- data/vendor/libgit2/src/transports/ssh.c +51 -17
- data/vendor/libgit2/src/transports/winhttp.c +138 -81
- data/vendor/libgit2/src/tree.c +100 -77
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -1
- data/vendor/libgit2/src/unix/posix.h +3 -0
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +53 -129
- data/vendor/libgit2/src/util.h +33 -39
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +4 -2
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
- data/vendor/libgit2/src/win32/path_w32.c +22 -24
- data/vendor/libgit2/src/win32/path_w32.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +77 -1
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +32 -14
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +32 -16
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/global.c +0 -363
- data/vendor/libgit2/src/global.h +0 -41
- data/vendor/libgit2/src/thread-utils.c +0 -58
- data/vendor/libgit2/src/thread-utils.h +0 -364
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
- data/vendor/libgit2/src/win32/w32_stack.c +0 -188
- data/vendor/libgit2/src/win32/w32_stack.h +0 -140
@@ -68,6 +68,35 @@ typedef struct refdb_fs_backend {
|
|
68
68
|
|
69
69
|
static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name);
|
70
70
|
|
71
|
+
GIT_INLINE(int) loose_path(
|
72
|
+
git_buf *out,
|
73
|
+
const char *base,
|
74
|
+
const char *refname)
|
75
|
+
{
|
76
|
+
if (git_buf_joinpath(out, base, refname) < 0)
|
77
|
+
return -1;
|
78
|
+
|
79
|
+
return git_path_validate_filesystem_with_suffix(out->ptr, out->size,
|
80
|
+
CONST_STRLEN(".lock"));
|
81
|
+
}
|
82
|
+
|
83
|
+
GIT_INLINE(int) reflog_path(
|
84
|
+
git_buf *out,
|
85
|
+
git_repository *repo,
|
86
|
+
const char *refname)
|
87
|
+
{
|
88
|
+
const char *base;
|
89
|
+
int error;
|
90
|
+
|
91
|
+
base = (strcmp(refname, GIT_HEAD_FILE) == 0) ? repo->gitdir :
|
92
|
+
repo->commondir;
|
93
|
+
|
94
|
+
if ((error = git_buf_joinpath(out, base, GIT_REFLOG_DIR)) < 0)
|
95
|
+
return error;
|
96
|
+
|
97
|
+
return loose_path(out, out->ptr, refname);
|
98
|
+
}
|
99
|
+
|
71
100
|
static int packref_cmp(const void *a_, const void *b_)
|
72
101
|
{
|
73
102
|
const struct packref *a = a_, *b = b_;
|
@@ -93,7 +122,7 @@ static int packed_reload(refdb_fs_backend *backend)
|
|
93
122
|
*/
|
94
123
|
if (error <= 0) {
|
95
124
|
if (error == GIT_ENOTFOUND) {
|
96
|
-
git_sortedcache_clear(backend->refcache, true);
|
125
|
+
GIT_UNUSED(git_sortedcache_clear(backend->refcache, true));
|
97
126
|
git_error_clear();
|
98
127
|
error = 0;
|
99
128
|
}
|
@@ -102,7 +131,7 @@ static int packed_reload(refdb_fs_backend *backend)
|
|
102
131
|
|
103
132
|
/* At this point, refresh the packed refs from the loaded buffer. */
|
104
133
|
|
105
|
-
git_sortedcache_clear(backend->refcache, false);
|
134
|
+
GIT_UNUSED(git_sortedcache_clear(backend->refcache, false));
|
106
135
|
|
107
136
|
scan = (char *)packedrefs.ptr;
|
108
137
|
eof = scan + packedrefs.size;
|
@@ -190,7 +219,7 @@ static int packed_reload(refdb_fs_backend *backend)
|
|
190
219
|
parse_failed:
|
191
220
|
git_error_set(GIT_ERROR_REFERENCE, "corrupted packed references file");
|
192
221
|
|
193
|
-
git_sortedcache_clear(backend->refcache, false);
|
222
|
+
GIT_UNUSED(git_sortedcache_clear(backend->refcache, false));
|
194
223
|
git_sortedcache_wunlock(backend->refcache);
|
195
224
|
git_buf_dispose(&packedrefs);
|
196
225
|
|
@@ -223,9 +252,8 @@ static int loose_readbuffer(git_buf *buf, const char *base, const char *path)
|
|
223
252
|
{
|
224
253
|
int error;
|
225
254
|
|
226
|
-
|
227
|
-
|
228
|
-
(error = git_futils_readbuffer(buf, buf->ptr)) < 0)
|
255
|
+
if ((error = loose_path(buf, base, path)) < 0 ||
|
256
|
+
(error = git_futils_readbuffer(buf, buf->ptr)) < 0)
|
229
257
|
git_buf_dispose(buf);
|
230
258
|
|
231
259
|
return error;
|
@@ -254,7 +282,8 @@ static int loose_lookup_to_packfile(refdb_fs_backend *backend, const char *name)
|
|
254
282
|
if ((error = loose_parse_oid(&oid, name, &ref_file)) < 0)
|
255
283
|
goto done;
|
256
284
|
|
257
|
-
git_sortedcache_wlock(backend->refcache)
|
285
|
+
if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
|
286
|
+
goto done;
|
258
287
|
|
259
288
|
if (!(error = git_sortedcache_upsert(
|
260
289
|
(void **)&ref, backend->refcache, name))) {
|
@@ -331,11 +360,11 @@ static int refdb_fs_backend__exists(
|
|
331
360
|
git_buf ref_path = GIT_BUF_INIT;
|
332
361
|
int error;
|
333
362
|
|
334
|
-
|
363
|
+
GIT_ASSERT_ARG(backend);
|
335
364
|
|
336
365
|
*exists = 0;
|
337
366
|
|
338
|
-
if ((error =
|
367
|
+
if ((error = loose_path(&ref_path, backend->gitpath, ref_name)) < 0)
|
339
368
|
goto out;
|
340
369
|
|
341
370
|
if (git_path_isfile(ref_path.ptr)) {
|
@@ -472,7 +501,7 @@ static int refdb_fs_backend__lookup(
|
|
472
501
|
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
473
502
|
int error;
|
474
503
|
|
475
|
-
|
504
|
+
GIT_ASSERT_ARG(backend);
|
476
505
|
|
477
506
|
if (!(error = loose_lookup(out, backend, ref_name)))
|
478
507
|
return 0;
|
@@ -549,7 +578,7 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
549
578
|
}
|
550
579
|
}
|
551
580
|
|
552
|
-
if ((error =
|
581
|
+
if ((error = git_buf_puts(&path, backend->commonpath)) < 0 ||
|
553
582
|
(error = git_buf_put(&path, ref_prefix, ref_prefix_len)) < 0) {
|
554
583
|
git_buf_dispose(&path);
|
555
584
|
return error;
|
@@ -678,7 +707,7 @@ static int refdb_fs_backend__iterator(
|
|
678
707
|
refdb_fs_iter *iter = NULL;
|
679
708
|
int error;
|
680
709
|
|
681
|
-
|
710
|
+
GIT_ASSERT_ARG(backend);
|
682
711
|
|
683
712
|
iter = git__calloc(1, sizeof(refdb_fs_iter));
|
684
713
|
GIT_ERROR_CHECK_ALLOC(iter);
|
@@ -760,7 +789,8 @@ static int reference_path_available(
|
|
760
789
|
}
|
761
790
|
}
|
762
791
|
|
763
|
-
git_sortedcache_rlock(backend->refcache)
|
792
|
+
if ((error = git_sortedcache_rlock(backend->refcache)) < 0)
|
793
|
+
return error;
|
764
794
|
|
765
795
|
for (i = 0; i < git_sortedcache_entrycount(backend->refcache); ++i) {
|
766
796
|
struct packref *ref = git_sortedcache_entry(backend->refcache, i);
|
@@ -783,9 +813,11 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
|
|
783
813
|
git_buf ref_path = GIT_BUF_INIT;
|
784
814
|
const char *basedir;
|
785
815
|
|
786
|
-
|
816
|
+
GIT_ASSERT_ARG(file);
|
817
|
+
GIT_ASSERT_ARG(backend);
|
818
|
+
GIT_ASSERT_ARG(name);
|
787
819
|
|
788
|
-
if (!
|
820
|
+
if (!git_path_validate(backend->repo, name, 0, GIT_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
|
789
821
|
git_error_set(GIT_ERROR_INVALID, "invalid reference name '%s'", name);
|
790
822
|
return GIT_EINVALIDSPEC;
|
791
823
|
}
|
@@ -801,8 +833,8 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
|
|
801
833
|
if ((error = git_futils_rmdir_r(name, basedir, GIT_RMDIR_SKIP_NONEMPTY)) < 0)
|
802
834
|
return error;
|
803
835
|
|
804
|
-
if (
|
805
|
-
return
|
836
|
+
if ((error = loose_path(&ref_path, basedir, name)) < 0)
|
837
|
+
return error;
|
806
838
|
|
807
839
|
filebuf_flags = GIT_FILEBUF_CREATE_LEADING_DIRS;
|
808
840
|
if (backend->fsync)
|
@@ -819,7 +851,8 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
|
|
819
851
|
|
820
852
|
static int loose_commit(git_filebuf *file, const git_reference *ref)
|
821
853
|
{
|
822
|
-
|
854
|
+
GIT_ASSERT_ARG(file);
|
855
|
+
GIT_ASSERT_ARG(ref);
|
823
856
|
|
824
857
|
if (ref->type == GIT_REFERENCE_DIRECT) {
|
825
858
|
char oid[GIT_OID_HEXSZ + 1];
|
@@ -829,7 +862,7 @@ static int loose_commit(git_filebuf *file, const git_reference *ref)
|
|
829
862
|
} else if (ref->type == GIT_REFERENCE_SYMBOLIC) {
|
830
863
|
git_filebuf_printf(file, GIT_SYMREF "%s\n", ref->target.symbolic);
|
831
864
|
} else {
|
832
|
-
|
865
|
+
GIT_ASSERT(0);
|
833
866
|
}
|
834
867
|
|
835
868
|
return git_filebuf_commit(file);
|
@@ -1066,7 +1099,7 @@ static int packed_write(refdb_fs_backend *backend)
|
|
1066
1099
|
|
1067
1100
|
for (i = 0; i < git_sortedcache_entrycount(refcache); ++i) {
|
1068
1101
|
struct packref *ref = git_sortedcache_entry(refcache, i);
|
1069
|
-
|
1102
|
+
GIT_ASSERT(ref);
|
1070
1103
|
|
1071
1104
|
if ((error = packed_find_peel(backend, ref)) < 0)
|
1072
1105
|
goto fail;
|
@@ -1140,8 +1173,11 @@ static int cmp_old_ref(int *cmp, git_refdb_backend *backend, const char *name,
|
|
1140
1173
|
if (!old_id && !old_target)
|
1141
1174
|
return 0;
|
1142
1175
|
|
1143
|
-
if ((error = refdb_fs_backend__lookup(&old_ref, backend, name)) < 0)
|
1176
|
+
if ((error = refdb_fs_backend__lookup(&old_ref, backend, name)) < 0) {
|
1177
|
+
if (error == GIT_ENOTFOUND && old_id && git_oid_is_zero(old_id))
|
1178
|
+
return 0;
|
1144
1179
|
goto out;
|
1180
|
+
}
|
1145
1181
|
|
1146
1182
|
/* If the types don't match, there's no way the values do */
|
1147
1183
|
if (old_id && old_ref->type != GIT_REFERENCE_DIRECT) {
|
@@ -1219,7 +1255,7 @@ static int refdb_fs_backend__write(
|
|
1219
1255
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1220
1256
|
int error = 0;
|
1221
1257
|
|
1222
|
-
|
1258
|
+
GIT_ASSERT_ARG(backend);
|
1223
1259
|
|
1224
1260
|
if ((error = reference_path_available(backend, ref->name, NULL, force)) < 0)
|
1225
1261
|
return error;
|
@@ -1292,7 +1328,7 @@ on_error:
|
|
1292
1328
|
return error;
|
1293
1329
|
}
|
1294
1330
|
|
1295
|
-
static
|
1331
|
+
static int refdb_fs_backend__prune_refs(
|
1296
1332
|
refdb_fs_backend *backend,
|
1297
1333
|
const char *ref_name,
|
1298
1334
|
const char *prefix)
|
@@ -1300,10 +1336,12 @@ static void refdb_fs_backend__prune_refs(
|
|
1300
1336
|
git_buf relative_path = GIT_BUF_INIT;
|
1301
1337
|
git_buf base_path = GIT_BUF_INIT;
|
1302
1338
|
size_t commonlen;
|
1339
|
+
int error;
|
1303
1340
|
|
1304
|
-
|
1341
|
+
GIT_ASSERT_ARG(backend);
|
1342
|
+
GIT_ASSERT_ARG(ref_name);
|
1305
1343
|
|
1306
|
-
if (git_buf_sets(&relative_path, ref_name) < 0)
|
1344
|
+
if ((error = git_buf_sets(&relative_path, ref_name)) < 0)
|
1307
1345
|
goto cleanup;
|
1308
1346
|
|
1309
1347
|
git_path_squash_slashes(&relative_path);
|
@@ -1313,20 +1351,33 @@ static void refdb_fs_backend__prune_refs(
|
|
1313
1351
|
|
1314
1352
|
git_buf_truncate(&relative_path, commonlen);
|
1315
1353
|
|
1316
|
-
if (prefix)
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1354
|
+
if (prefix)
|
1355
|
+
error = git_buf_join3(&base_path, '/',
|
1356
|
+
backend->commonpath, prefix,
|
1357
|
+
git_buf_cstr(&relative_path));
|
1358
|
+
else
|
1359
|
+
error = git_buf_joinpath(&base_path,
|
1360
|
+
backend->commonpath,
|
1361
|
+
git_buf_cstr(&relative_path));
|
1362
|
+
|
1363
|
+
if (!error)
|
1364
|
+
error = git_path_validate_filesystem(base_path.ptr, base_path.size);
|
1365
|
+
|
1366
|
+
if (error < 0)
|
1367
|
+
goto cleanup;
|
1368
|
+
|
1369
|
+
error = git_futils_rmdir_r(ref_name + commonlen,
|
1370
|
+
git_buf_cstr(&base_path),
|
1371
|
+
GIT_RMDIR_EMPTY_PARENTS | GIT_RMDIR_SKIP_ROOT);
|
1323
1372
|
|
1324
|
-
|
1373
|
+
if (error == GIT_ENOTFOUND)
|
1374
|
+
error = 0;
|
1325
1375
|
}
|
1326
1376
|
|
1327
1377
|
cleanup:
|
1328
1378
|
git_buf_dispose(&relative_path);
|
1329
1379
|
git_buf_dispose(&base_path);
|
1380
|
+
return error;
|
1330
1381
|
}
|
1331
1382
|
|
1332
1383
|
static int refdb_fs_backend__delete(
|
@@ -1338,7 +1389,8 @@ static int refdb_fs_backend__delete(
|
|
1338
1389
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1339
1390
|
int error = 0;
|
1340
1391
|
|
1341
|
-
|
1392
|
+
GIT_ASSERT_ARG(backend);
|
1393
|
+
GIT_ASSERT_ARG(ref_name);
|
1342
1394
|
|
1343
1395
|
if ((error = loose_lock(&file, backend, ref_name)) < 0)
|
1344
1396
|
return error;
|
@@ -1353,19 +1405,19 @@ static int refdb_fs_backend__delete(
|
|
1353
1405
|
|
1354
1406
|
static int loose_delete(refdb_fs_backend *backend, const char *ref_name)
|
1355
1407
|
{
|
1356
|
-
git_buf
|
1408
|
+
git_buf path = GIT_BUF_INIT;
|
1357
1409
|
int error = 0;
|
1358
1410
|
|
1359
|
-
if (
|
1360
|
-
return
|
1411
|
+
if ((error = loose_path(&path, backend->commonpath, ref_name)) < 0)
|
1412
|
+
return error;
|
1361
1413
|
|
1362
|
-
error = p_unlink(
|
1414
|
+
error = p_unlink(path.ptr);
|
1363
1415
|
if (error < 0 && errno == ENOENT)
|
1364
1416
|
error = GIT_ENOTFOUND;
|
1365
1417
|
else if (error != 0)
|
1366
1418
|
error = -1;
|
1367
1419
|
|
1368
|
-
git_buf_dispose(&
|
1420
|
+
git_buf_dispose(&path);
|
1369
1421
|
|
1370
1422
|
return error;
|
1371
1423
|
}
|
@@ -1424,7 +1476,7 @@ static int refdb_fs_backend__delete_tail(
|
|
1424
1476
|
cleanup:
|
1425
1477
|
git_filebuf_cleanup(file);
|
1426
1478
|
if (error == 0)
|
1427
|
-
refdb_fs_backend__prune_refs(backend, ref_name, "");
|
1479
|
+
error = refdb_fs_backend__prune_refs(backend, ref_name, "");
|
1428
1480
|
return error;
|
1429
1481
|
}
|
1430
1482
|
|
@@ -1444,7 +1496,7 @@ static int refdb_fs_backend__rename(
|
|
1444
1496
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1445
1497
|
int error;
|
1446
1498
|
|
1447
|
-
|
1499
|
+
GIT_ASSERT_ARG(backend);
|
1448
1500
|
|
1449
1501
|
if ((error = reference_path_available(
|
1450
1502
|
backend, new_name, old_name, force)) < 0 ||
|
@@ -1497,7 +1549,7 @@ static int refdb_fs_backend__compress(git_refdb_backend *_backend)
|
|
1497
1549
|
int error;
|
1498
1550
|
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1499
1551
|
|
1500
|
-
|
1552
|
+
GIT_ASSERT_ARG(backend);
|
1501
1553
|
|
1502
1554
|
if ((error = packed_reload(backend)) < 0 || /* load the existing packfile */
|
1503
1555
|
(error = packed_loadloose(backend)) < 0 || /* add all the loose refs */
|
@@ -1511,7 +1563,8 @@ static void refdb_fs_backend__free(git_refdb_backend *_backend)
|
|
1511
1563
|
{
|
1512
1564
|
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1513
1565
|
|
1514
|
-
|
1566
|
+
if (!backend)
|
1567
|
+
return;
|
1515
1568
|
|
1516
1569
|
git_sortedcache_free(backend->refcache);
|
1517
1570
|
git__free(backend->gitpath);
|
@@ -1556,8 +1609,9 @@ static char *setup_namespace(git_repository *repo, const char *in)
|
|
1556
1609
|
GIT_MKDIR_PATH, NULL) < 0)
|
1557
1610
|
goto done;
|
1558
1611
|
|
1559
|
-
/* Return root of the namespaced gitpath, i.e. without the trailing '
|
1612
|
+
/* Return root of the namespaced gitpath, i.e. without the trailing 'refs' */
|
1560
1613
|
git_buf_rtruncate_at_char(&path, '/');
|
1614
|
+
git_buf_putc(&path, '/');
|
1561
1615
|
out = git_buf_detach(&path);
|
1562
1616
|
|
1563
1617
|
done:
|
@@ -1658,13 +1712,6 @@ static int create_new_reflog_file(const char *filepath)
|
|
1658
1712
|
return p_close(fd);
|
1659
1713
|
}
|
1660
1714
|
|
1661
|
-
GIT_INLINE(int) retrieve_reflog_path(git_buf *path, git_repository *repo, const char *name)
|
1662
|
-
{
|
1663
|
-
if (strcmp(name, GIT_HEAD_FILE) == 0)
|
1664
|
-
return git_buf_join3(path, '/', repo->gitdir, GIT_REFLOG_DIR, name);
|
1665
|
-
return git_buf_join3(path, '/', repo->commondir, GIT_REFLOG_DIR, name);
|
1666
|
-
}
|
1667
|
-
|
1668
1715
|
static int refdb_reflog_fs__ensure_log(git_refdb_backend *_backend, const char *name)
|
1669
1716
|
{
|
1670
1717
|
refdb_fs_backend *backend;
|
@@ -1672,12 +1719,12 @@ static int refdb_reflog_fs__ensure_log(git_refdb_backend *_backend, const char *
|
|
1672
1719
|
git_buf path = GIT_BUF_INIT;
|
1673
1720
|
int error;
|
1674
1721
|
|
1675
|
-
|
1722
|
+
GIT_ASSERT_ARG(_backend && name);
|
1676
1723
|
|
1677
1724
|
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1678
1725
|
repo = backend->repo;
|
1679
1726
|
|
1680
|
-
if ((error =
|
1727
|
+
if ((error = reflog_path(&path, repo, name)) < 0)
|
1681
1728
|
return error;
|
1682
1729
|
|
1683
1730
|
error = create_new_reflog_file(git_buf_cstr(&path));
|
@@ -1691,7 +1738,7 @@ static int has_reflog(git_repository *repo, const char *name)
|
|
1691
1738
|
int ret = 0;
|
1692
1739
|
git_buf path = GIT_BUF_INIT;
|
1693
1740
|
|
1694
|
-
if (
|
1741
|
+
if (reflog_path(&path, repo, name) < 0)
|
1695
1742
|
goto cleanup;
|
1696
1743
|
|
1697
1744
|
ret = git_path_isfile(git_buf_cstr(&path));
|
@@ -1705,7 +1752,8 @@ static int refdb_reflog_fs__has_log(git_refdb_backend *_backend, const char *nam
|
|
1705
1752
|
{
|
1706
1753
|
refdb_fs_backend *backend;
|
1707
1754
|
|
1708
|
-
|
1755
|
+
GIT_ASSERT_ARG(_backend);
|
1756
|
+
GIT_ASSERT_ARG(name);
|
1709
1757
|
|
1710
1758
|
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1711
1759
|
|
@@ -1721,7 +1769,9 @@ static int refdb_reflog_fs__read(git_reflog **out, git_refdb_backend *_backend,
|
|
1721
1769
|
git_repository *repo;
|
1722
1770
|
refdb_fs_backend *backend;
|
1723
1771
|
|
1724
|
-
|
1772
|
+
GIT_ASSERT_ARG(out);
|
1773
|
+
GIT_ASSERT_ARG(_backend);
|
1774
|
+
GIT_ASSERT_ARG(name);
|
1725
1775
|
|
1726
1776
|
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1727
1777
|
repo = backend->repo;
|
@@ -1729,7 +1779,7 @@ static int refdb_reflog_fs__read(git_reflog **out, git_refdb_backend *_backend,
|
|
1729
1779
|
if (reflog_alloc(&log, name) < 0)
|
1730
1780
|
return -1;
|
1731
1781
|
|
1732
|
-
if (
|
1782
|
+
if (reflog_path(&log_path, repo, name) < 0)
|
1733
1783
|
goto cleanup;
|
1734
1784
|
|
1735
1785
|
error = git_futils_readbuffer(&log_file, git_buf_cstr(&log_path));
|
@@ -1806,12 +1856,12 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
|
|
1806
1856
|
|
1807
1857
|
repo = backend->repo;
|
1808
1858
|
|
1809
|
-
if (!
|
1859
|
+
if (!git_path_validate(backend->repo, refname, 0, GIT_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
|
1810
1860
|
git_error_set(GIT_ERROR_INVALID, "invalid reference name '%s'", refname);
|
1811
1861
|
return GIT_EINVALIDSPEC;
|
1812
1862
|
}
|
1813
1863
|
|
1814
|
-
if (
|
1864
|
+
if (reflog_path(&log_path, repo, refname) < 0)
|
1815
1865
|
return -1;
|
1816
1866
|
|
1817
1867
|
if (!git_path_isfile(git_buf_cstr(&log_path))) {
|
@@ -1838,7 +1888,8 @@ static int refdb_reflog_fs__write(git_refdb_backend *_backend, git_reflog *reflo
|
|
1838
1888
|
git_buf log = GIT_BUF_INIT;
|
1839
1889
|
git_filebuf fbuf = GIT_FILEBUF_INIT;
|
1840
1890
|
|
1841
|
-
|
1891
|
+
GIT_ASSERT_ARG(_backend);
|
1892
|
+
GIT_ASSERT_ARG(reflog);
|
1842
1893
|
|
1843
1894
|
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1844
1895
|
|
@@ -1911,7 +1962,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
|
|
1911
1962
|
if ((error = serialize_reflog_entry(&buf, &old_id, &new_id, who, message)) < 0)
|
1912
1963
|
goto cleanup;
|
1913
1964
|
|
1914
|
-
if ((error =
|
1965
|
+
if ((error = reflog_path(&path, repo, ref->name)) < 0)
|
1915
1966
|
goto cleanup;
|
1916
1967
|
|
1917
1968
|
if (((error = git_futils_mkpath2file(git_buf_cstr(&path), 0777)) < 0) &&
|
@@ -1960,7 +2011,9 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
1960
2011
|
git_repository *repo;
|
1961
2012
|
refdb_fs_backend *backend;
|
1962
2013
|
|
1963
|
-
|
2014
|
+
GIT_ASSERT_ARG(_backend);
|
2015
|
+
GIT_ASSERT_ARG(old_name);
|
2016
|
+
GIT_ASSERT_ARG(new_name);
|
1964
2017
|
|
1965
2018
|
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1966
2019
|
repo = backend->repo;
|
@@ -1972,11 +2025,11 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
1972
2025
|
if (git_buf_joinpath(&temp_path, repo->gitdir, GIT_REFLOG_DIR) < 0)
|
1973
2026
|
return -1;
|
1974
2027
|
|
1975
|
-
if (
|
1976
|
-
return
|
2028
|
+
if ((error = loose_path(&old_path, git_buf_cstr(&temp_path), old_name)) < 0)
|
2029
|
+
return error;
|
1977
2030
|
|
1978
|
-
if (
|
1979
|
-
return
|
2031
|
+
if ((error = loose_path(&new_path, git_buf_cstr(&temp_path), git_buf_cstr(&normalized))) < 0)
|
2032
|
+
return error;
|
1980
2033
|
|
1981
2034
|
if (!git_path_exists(git_buf_cstr(&old_path))) {
|
1982
2035
|
error = GIT_ENOTFOUND;
|
@@ -1990,8 +2043,8 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
1990
2043
|
* - a/b -> a/b/c
|
1991
2044
|
* - a/b/c/d -> a/b/c
|
1992
2045
|
*/
|
1993
|
-
if (
|
1994
|
-
return
|
2046
|
+
if ((error = loose_path(&temp_path, git_buf_cstr(&temp_path), "temp_reflog")) < 0)
|
2047
|
+
return error;
|
1995
2048
|
|
1996
2049
|
if ((fd = git_futils_mktmp(&temp_path, git_buf_cstr(&temp_path), GIT_REFLOG_FILE_MODE)) < 0) {
|
1997
2050
|
error = -1;
|
@@ -2037,9 +2090,10 @@ static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name
|
|
2037
2090
|
git_buf path = GIT_BUF_INIT;
|
2038
2091
|
int error;
|
2039
2092
|
|
2040
|
-
|
2093
|
+
GIT_ASSERT_ARG(_backend);
|
2094
|
+
GIT_ASSERT_ARG(name);
|
2041
2095
|
|
2042
|
-
if ((error =
|
2096
|
+
if ((error = reflog_path(&path, backend->repo, name)) < 0)
|
2043
2097
|
goto out;
|
2044
2098
|
|
2045
2099
|
if (!git_path_exists(path.ptr))
|
@@ -2048,7 +2102,7 @@ static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name
|
|
2048
2102
|
if ((error = p_unlink(path.ptr)) < 0)
|
2049
2103
|
goto out;
|
2050
2104
|
|
2051
|
-
refdb_fs_backend__prune_refs(backend, name, GIT_REFLOG_DIR);
|
2105
|
+
error = refdb_fs_backend__prune_refs(backend, name, GIT_REFLOG_DIR);
|
2052
2106
|
|
2053
2107
|
out:
|
2054
2108
|
git_buf_dispose(&path);
|
data/vendor/libgit2/src/reflog.c
CHANGED
@@ -50,7 +50,9 @@ int git_reflog_read(git_reflog **reflog, git_repository *repo, const char *name
|
|
50
50
|
git_refdb *refdb;
|
51
51
|
int error;
|
52
52
|
|
53
|
-
|
53
|
+
GIT_ASSERT_ARG(reflog);
|
54
|
+
GIT_ASSERT_ARG(repo);
|
55
|
+
GIT_ASSERT_ARG(name);
|
54
56
|
|
55
57
|
if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0)
|
56
58
|
return error;
|
@@ -62,7 +64,8 @@ int git_reflog_write(git_reflog *reflog)
|
|
62
64
|
{
|
63
65
|
git_refdb *db;
|
64
66
|
|
65
|
-
|
67
|
+
GIT_ASSERT_ARG(reflog);
|
68
|
+
GIT_ASSERT_ARG(reflog->db);
|
66
69
|
|
67
70
|
db = reflog->db;
|
68
71
|
return db->backend->reflog_write(db->backend, reflog);
|
@@ -73,7 +76,9 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
|
|
73
76
|
const git_reflog_entry *previous;
|
74
77
|
git_reflog_entry *entry;
|
75
78
|
|
76
|
-
|
79
|
+
GIT_ASSERT_ARG(reflog);
|
80
|
+
GIT_ASSERT_ARG(new_oid);
|
81
|
+
GIT_ASSERT_ARG(committer);
|
77
82
|
|
78
83
|
entry = git__calloc(1, sizeof(git_reflog_entry));
|
79
84
|
GIT_ERROR_CHECK_ALLOC(entry);
|
@@ -139,13 +144,13 @@ int git_reflog_delete(git_repository *repo, const char *name)
|
|
139
144
|
|
140
145
|
size_t git_reflog_entrycount(git_reflog *reflog)
|
141
146
|
{
|
142
|
-
|
147
|
+
GIT_ASSERT_ARG_WITH_RETVAL(reflog, 0);
|
143
148
|
return reflog->entries.length;
|
144
149
|
}
|
145
150
|
|
146
|
-
const git_reflog_entry *
|
151
|
+
const git_reflog_entry *git_reflog_entry_byindex(const git_reflog *reflog, size_t idx)
|
147
152
|
{
|
148
|
-
|
153
|
+
GIT_ASSERT_ARG_WITH_RETVAL(reflog, NULL);
|
149
154
|
|
150
155
|
if (idx >= reflog->entries.length)
|
151
156
|
return NULL;
|
@@ -154,27 +159,27 @@ const git_reflog_entry * git_reflog_entry_byindex(const git_reflog *reflog, size
|
|
154
159
|
&reflog->entries, reflog_inverse_index(idx, reflog->entries.length));
|
155
160
|
}
|
156
161
|
|
157
|
-
const git_oid *
|
162
|
+
const git_oid *git_reflog_entry_id_old(const git_reflog_entry *entry)
|
158
163
|
{
|
159
|
-
|
164
|
+
GIT_ASSERT_ARG_WITH_RETVAL(entry, NULL);
|
160
165
|
return &entry->oid_old;
|
161
166
|
}
|
162
167
|
|
163
|
-
const git_oid *
|
168
|
+
const git_oid *git_reflog_entry_id_new(const git_reflog_entry *entry)
|
164
169
|
{
|
165
|
-
|
170
|
+
GIT_ASSERT_ARG_WITH_RETVAL(entry, NULL);
|
166
171
|
return &entry->oid_cur;
|
167
172
|
}
|
168
173
|
|
169
|
-
const git_signature *
|
174
|
+
const git_signature *git_reflog_entry_committer(const git_reflog_entry *entry)
|
170
175
|
{
|
171
|
-
|
176
|
+
GIT_ASSERT_ARG_WITH_RETVAL(entry, NULL);
|
172
177
|
return entry->committer;
|
173
178
|
}
|
174
179
|
|
175
|
-
const char *
|
180
|
+
const char *git_reflog_entry_message(const git_reflog_entry *entry)
|
176
181
|
{
|
177
|
-
|
182
|
+
GIT_ASSERT_ARG_WITH_RETVAL(entry, NULL);
|
178
183
|
return entry->msg;
|
179
184
|
}
|
180
185
|
|