rugged 0.27.10.1 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +23 -2
- data/ext/rugged/rugged.c +48 -2
- data/ext/rugged/rugged.h +5 -0
- data/ext/rugged/rugged_allocator.c +89 -0
- data/ext/rugged/rugged_blob.c +3 -3
- data/ext/rugged/rugged_branch.c +1 -1
- data/ext/rugged/rugged_commit.c +8 -8
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_diff.c +24 -4
- data/ext/rugged/rugged_note.c +1 -1
- data/ext/rugged/rugged_repo.c +10 -10
- data/ext/rugged/rugged_settings.c +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +69 -47
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -8
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
- data/vendor/libgit2/deps/regex/COPYING +502 -0
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/zlib/COPYING +27 -0
- data/vendor/libgit2/include/git2.h +3 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
- data/vendor/libgit2/include/git2/apply.h +129 -0
- data/vendor/libgit2/include/git2/attr.h +19 -8
- data/vendor/libgit2/include/git2/blame.h +41 -24
- 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 -2
- data/vendor/libgit2/include/git2/checkout.h +20 -19
- data/vendor/libgit2/include/git2/cherrypick.h +6 -4
- data/vendor/libgit2/include/git2/clone.h +11 -9
- data/vendor/libgit2/include/git2/commit.h +30 -2
- data/vendor/libgit2/include/git2/common.h +54 -4
- data/vendor/libgit2/include/git2/config.h +18 -7
- data/vendor/libgit2/include/git2/deprecated.h +253 -0
- data/vendor/libgit2/include/git2/describe.h +30 -7
- data/vendor/libgit2/include/git2/diff.h +193 -143
- data/vendor/libgit2/include/git2/errors.h +54 -46
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/index.h +72 -51
- data/vendor/libgit2/include/git2/indexer.h +30 -4
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +29 -8
- data/vendor/libgit2/include/git2/net.h +1 -1
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +16 -16
- data/vendor/libgit2/include/git2/odb.h +10 -10
- data/vendor/libgit2/include/git2/odb_backend.h +7 -7
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +2 -2
- data/vendor/libgit2/include/git2/proxy.h +9 -5
- data/vendor/libgit2/include/git2/rebase.h +7 -4
- data/vendor/libgit2/include/git2/refs.h +14 -15
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +92 -16
- data/vendor/libgit2/include/git2/repository.h +52 -37
- data/vendor/libgit2/include/git2/revert.h +5 -3
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +13 -10
- data/vendor/libgit2/include/git2/status.h +8 -4
- data/vendor/libgit2/include/git2/submodule.h +11 -10
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +9 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +19 -19
- data/vendor/libgit2/include/git2/sys/path.h +64 -0
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +19 -19
- data/vendor/libgit2/include/git2/sys/stream.h +92 -12
- data/vendor/libgit2/include/git2/sys/transport.h +127 -81
- data/vendor/libgit2/include/git2/tag.h +2 -2
- data/vendor/libgit2/include/git2/trace.h +1 -1
- data/vendor/libgit2/include/git2/transaction.h +1 -0
- data/vendor/libgit2/include/git2/transport.h +47 -18
- data/vendor/libgit2/include/git2/tree.h +3 -3
- data/vendor/libgit2/include/git2/types.h +35 -28
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +47 -12
- data/vendor/libgit2/src/CMakeLists.txt +87 -26
- data/vendor/libgit2/src/alloc.c +55 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/annotated_commit.c +15 -8
- data/vendor/libgit2/src/apply.c +490 -14
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +11 -11
- data/vendor/libgit2/src/attr_file.c +20 -15
- data/vendor/libgit2/src/attrcache.c +11 -11
- data/vendor/libgit2/src/blame.c +30 -15
- data/vendor/libgit2/src/blame.h +1 -0
- data/vendor/libgit2/src/blame_git.c +16 -13
- data/vendor/libgit2/src/blob.c +50 -28
- data/vendor/libgit2/src/blob.h +18 -1
- data/vendor/libgit2/src/branch.c +38 -38
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +55 -50
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/cache.c +16 -16
- data/vendor/libgit2/src/cache.h +2 -2
- data/vendor/libgit2/src/cc-compat.h +15 -3
- data/vendor/libgit2/src/checkout.c +83 -74
- data/vendor/libgit2/src/cherrypick.c +6 -6
- data/vendor/libgit2/src/clone.c +20 -20
- data/vendor/libgit2/src/commit.c +53 -33
- data/vendor/libgit2/src/commit.h +1 -0
- data/vendor/libgit2/src/commit_list.c +6 -10
- data/vendor/libgit2/src/common.h +32 -30
- data/vendor/libgit2/src/config.c +167 -147
- data/vendor/libgit2/src/config.h +1 -14
- data/vendor/libgit2/src/config_backend.h +84 -0
- data/vendor/libgit2/src/config_cache.c +7 -1
- data/vendor/libgit2/src/config_entries.c +259 -0
- data/vendor/libgit2/src/config_entries.h +23 -0
- data/vendor/libgit2/src/config_file.c +167 -439
- data/vendor/libgit2/src/config_mem.c +224 -0
- data/vendor/libgit2/src/config_parse.c +69 -38
- data/vendor/libgit2/src/config_parse.h +4 -4
- data/vendor/libgit2/src/crlf.c +215 -186
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +23 -23
- data/vendor/libgit2/src/diff.c +12 -12
- data/vendor/libgit2/src/diff_driver.c +14 -15
- data/vendor/libgit2/src/diff_file.c +10 -10
- data/vendor/libgit2/src/diff_generate.c +29 -23
- data/vendor/libgit2/src/diff_generate.h +1 -1
- data/vendor/libgit2/src/diff_parse.c +3 -3
- data/vendor/libgit2/src/diff_print.c +17 -17
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +12 -12
- data/vendor/libgit2/src/diff_xdiff.c +15 -3
- data/vendor/libgit2/src/errors.c +42 -20
- data/vendor/libgit2/src/features.h.in +2 -1
- data/vendor/libgit2/src/fetch.c +3 -3
- data/vendor/libgit2/src/fetchhead.c +16 -16
- data/vendor/libgit2/src/filebuf.c +28 -28
- data/vendor/libgit2/src/fileops.c +54 -54
- data/vendor/libgit2/src/fileops.h +1 -1
- data/vendor/libgit2/src/filter.c +30 -30
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/global.c +36 -23
- data/vendor/libgit2/src/hash.h +4 -1
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +6 -2
- data/vendor/libgit2/src/hash/hash_common_crypto.h +5 -1
- data/vendor/libgit2/src/hash/hash_generic.h +5 -1
- data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.h +24 -0
- data/vendor/libgit2/src/hash/hash_openssl.h +8 -4
- data/vendor/libgit2/src/hash/hash_win32.c +13 -13
- data/vendor/libgit2/src/hashsig.c +4 -4
- data/vendor/libgit2/src/idxmap.c +25 -5
- data/vendor/libgit2/src/idxmap.h +4 -18
- data/vendor/libgit2/src/ignore.c +9 -9
- data/vendor/libgit2/src/index.c +280 -198
- data/vendor/libgit2/src/index.h +16 -0
- data/vendor/libgit2/src/indexer.c +311 -139
- data/vendor/libgit2/src/integer.h +32 -22
- data/vendor/libgit2/src/iterator.c +116 -49
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- data/vendor/libgit2/src/merge.c +89 -59
- data/vendor/libgit2/src/merge_driver.c +7 -7
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +8 -8
- data/vendor/libgit2/src/netops.c +22 -13
- data/vendor/libgit2/src/netops.h +2 -0
- data/vendor/libgit2/src/notes.c +15 -10
- data/vendor/libgit2/src/object.c +118 -67
- data/vendor/libgit2/src/object.h +20 -9
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +72 -72
- data/vendor/libgit2/src/odb.h +7 -7
- data/vendor/libgit2/src/odb_loose.c +46 -46
- data/vendor/libgit2/src/odb_mempack.c +14 -14
- data/vendor/libgit2/src/odb_pack.c +14 -10
- data/vendor/libgit2/src/offmap.c +30 -0
- data/vendor/libgit2/src/offmap.h +20 -11
- data/vendor/libgit2/src/oid.c +6 -6
- data/vendor/libgit2/src/oidmap.c +20 -0
- data/vendor/libgit2/src/oidmap.h +9 -12
- data/vendor/libgit2/src/pack-objects.c +71 -63
- data/vendor/libgit2/src/pack-objects.h +1 -7
- data/vendor/libgit2/src/pack.c +58 -58
- data/vendor/libgit2/src/pack.h +6 -6
- data/vendor/libgit2/src/parse.h +1 -1
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch_generate.c +18 -18
- data/vendor/libgit2/src/patch_parse.c +13 -13
- data/vendor/libgit2/src/path.c +93 -225
- data/vendor/libgit2/src/path.h +2 -84
- data/vendor/libgit2/src/pathspec.c +6 -6
- data/vendor/libgit2/src/posix.c +3 -3
- data/vendor/libgit2/src/proxy.c +1 -1
- data/vendor/libgit2/src/push.c +27 -26
- data/vendor/libgit2/src/push.h +2 -1
- data/vendor/libgit2/src/reader.c +265 -0
- data/vendor/libgit2/src/reader.h +107 -0
- data/vendor/libgit2/src/rebase.c +49 -52
- data/vendor/libgit2/src/refdb.c +3 -3
- data/vendor/libgit2/src/refdb_fs.c +181 -103
- data/vendor/libgit2/src/reflog.c +3 -3
- data/vendor/libgit2/src/refs.c +98 -74
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +47 -21
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +219 -166
- data/vendor/libgit2/src/remote.h +9 -0
- data/vendor/libgit2/src/repository.c +173 -133
- data/vendor/libgit2/src/repository.h +6 -3
- data/vendor/libgit2/src/reset.c +8 -8
- data/vendor/libgit2/src/revert.c +6 -6
- data/vendor/libgit2/src/revparse.c +30 -30
- data/vendor/libgit2/src/revwalk.c +60 -30
- data/vendor/libgit2/src/revwalk.h +2 -1
- data/vendor/libgit2/src/settings.c +42 -10
- data/vendor/libgit2/src/signature.c +11 -11
- data/vendor/libgit2/src/sortedcache.c +13 -13
- data/vendor/libgit2/src/stash.c +91 -45
- data/vendor/libgit2/src/status.c +13 -13
- data/vendor/libgit2/src/stdalloc.c +120 -0
- data/vendor/libgit2/src/{streams/curl.h → stdalloc.h} +6 -6
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +483 -0
- data/vendor/libgit2/src/streams/mbedtls.h +23 -0
- data/vendor/libgit2/src/streams/openssl.c +204 -114
- data/vendor/libgit2/src/streams/openssl.h +4 -108
- data/vendor/libgit2/src/streams/registry.c +118 -0
- data/vendor/libgit2/src/streams/registry.h +19 -0
- data/vendor/libgit2/src/streams/socket.c +54 -29
- data/vendor/libgit2/src/streams/stransport.c +57 -32
- data/vendor/libgit2/src/streams/stransport.h +5 -0
- data/vendor/libgit2/src/streams/tls.c +50 -19
- data/vendor/libgit2/src/streams/tls.h +12 -4
- data/vendor/libgit2/src/strmap.c +22 -2
- data/vendor/libgit2/src/strmap.h +18 -15
- data/vendor/libgit2/src/submodule.c +179 -155
- data/vendor/libgit2/src/sysdir.c +18 -18
- data/vendor/libgit2/src/tag.c +31 -26
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +1 -1
- data/vendor/libgit2/src/trailer.c +6 -6
- data/vendor/libgit2/src/transaction.c +23 -23
- data/vendor/libgit2/src/transport.c +5 -5
- data/vendor/libgit2/src/transports/auth.c +7 -4
- data/vendor/libgit2/src/transports/auth.h +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +12 -11
- data/vendor/libgit2/src/transports/cred.c +18 -18
- data/vendor/libgit2/src/transports/git.c +15 -15
- data/vendor/libgit2/src/transports/http.c +606 -216
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +26 -26
- data/vendor/libgit2/src/transports/smart.c +54 -31
- data/vendor/libgit2/src/transports/smart.h +1 -2
- data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
- data/vendor/libgit2/src/transports/smart_protocol.c +61 -57
- data/vendor/libgit2/src/transports/ssh.c +34 -33
- data/vendor/libgit2/src/transports/winhttp.c +99 -119
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree.c +96 -121
- data/vendor/libgit2/src/tree.h +1 -12
- data/vendor/libgit2/src/unix/map.c +2 -2
- data/vendor/libgit2/src/util.c +22 -6
- data/vendor/libgit2/src/util.h +12 -135
- data/vendor/libgit2/src/vector.c +4 -4
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +3 -3
- data/vendor/libgit2/src/win32/map.c +6 -6
- data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
- data/vendor/libgit2/src/win32/path_w32.c +101 -7
- data/vendor/libgit2/src/win32/path_w32.h +18 -0
- data/vendor/libgit2/src/win32/posix_w32.c +24 -43
- data/vendor/libgit2/src/win32/w32_buffer.c +2 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +96 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
- data/vendor/libgit2/src/win32/w32_stack.c +2 -2
- data/vendor/libgit2/src/win32/w32_util.c +1 -69
- data/vendor/libgit2/src/win32/w32_util.h +1 -19
- data/vendor/libgit2/src/worktree.c +75 -54
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +7 -5
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +15 -15
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +33 -7
- data/vendor/libgit2/src/config_file.h +0 -73
- data/vendor/libgit2/src/streams/curl.c +0 -385
@@ -0,0 +1,107 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_reader_h__
|
8
|
+
#define INCLUDE_reader_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
/* Returned when the workdir does not match the index */
|
13
|
+
#define GIT_READER_MISMATCH 1
|
14
|
+
|
15
|
+
typedef struct git_reader git_reader;
|
16
|
+
|
17
|
+
/*
|
18
|
+
* The `git_reader` structure is a generic interface for reading the
|
19
|
+
* contents of a file by its name, and implementations are provided
|
20
|
+
* for reading out of a tree, the index, and the working directory.
|
21
|
+
*
|
22
|
+
* Note that the reader implementation is meant to have a short
|
23
|
+
* lifecycle and does not increase the refcount of the object that
|
24
|
+
* it's reading. Callers should ensure that they do not use a
|
25
|
+
* reader after disposing the underlying object that it reads.
|
26
|
+
*/
|
27
|
+
struct git_reader {
|
28
|
+
int (*read)(git_buf *out, git_oid *out_oid, git_filemode_t *mode, git_reader *reader, const char *filename);
|
29
|
+
};
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Create a `git_reader` that will allow random access to the given
|
33
|
+
* tree. Paths requested via `git_reader_read` will be rooted at this
|
34
|
+
* tree, callers are not expected to recurse through tree lookups. Thus,
|
35
|
+
* you can request to read `/src/foo.c` and the tree provided to this
|
36
|
+
* function will be searched to find another tree named `src`, which
|
37
|
+
* will then be opened to find `foo.c`.
|
38
|
+
*
|
39
|
+
* @param out The reader for the given tree
|
40
|
+
* @param tree The tree object to read
|
41
|
+
* @return 0 on success, or an error code < 0
|
42
|
+
*/
|
43
|
+
extern int git_reader_for_tree(
|
44
|
+
git_reader **out,
|
45
|
+
git_tree *tree);
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Create a `git_reader` that will allow random access to the given
|
49
|
+
* index, or the repository's index.
|
50
|
+
*
|
51
|
+
* @param out The reader for the given index
|
52
|
+
* @param repo The repository containing the index
|
53
|
+
* @param index The index to read, or NULL to use the repository's index
|
54
|
+
* @return 0 on success, or an error code < 0
|
55
|
+
*/
|
56
|
+
extern int git_reader_for_index(
|
57
|
+
git_reader **out,
|
58
|
+
git_repository *repo,
|
59
|
+
git_index *index);
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Create a `git_reader` that will allow random access to the given
|
63
|
+
* repository's working directory. Note that the contents are read
|
64
|
+
* in repository format, meaning any workdir -> odb filters are
|
65
|
+
* applied.
|
66
|
+
*
|
67
|
+
* If `validate_index` is set to true, reads of files will hash the
|
68
|
+
* on-disk contents and ensure that the resulting object ID matches
|
69
|
+
* the repository's index. This ensures that the working directory
|
70
|
+
* is unmodified from the index contents.
|
71
|
+
*
|
72
|
+
* @param out The reader for the given working directory
|
73
|
+
* @param repo The repository containing the working directory
|
74
|
+
* @param validate_index If true, the working directory contents will
|
75
|
+
* be compared to the index contents during read to ensure that
|
76
|
+
* the working directory is unmodified.
|
77
|
+
* @return 0 on success, or an error code < 0
|
78
|
+
*/
|
79
|
+
extern int git_reader_for_workdir(
|
80
|
+
git_reader **out,
|
81
|
+
git_repository *repo,
|
82
|
+
bool validate_index);
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Read the given filename from the reader and populate the given buffer
|
86
|
+
* with the contents and the given oid with the object ID.
|
87
|
+
*
|
88
|
+
* @param out The buffer to populate with the file contents
|
89
|
+
* @param out_id The oid to populate with the object ID
|
90
|
+
* @param reader The reader to read
|
91
|
+
* @param filename The filename to read from the reader
|
92
|
+
*/
|
93
|
+
extern int git_reader_read(
|
94
|
+
git_buf *out,
|
95
|
+
git_oid *out_id,
|
96
|
+
git_filemode_t *out_filemode,
|
97
|
+
git_reader *reader,
|
98
|
+
const char *filename);
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Free the given reader and any associated objects.
|
102
|
+
*
|
103
|
+
* @param reader The reader to free
|
104
|
+
*/
|
105
|
+
extern void git_reader_free(git_reader *reader);
|
106
|
+
|
107
|
+
#endif
|
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_dispose(&path);
|
120
120
|
|
121
121
|
return 0;
|
122
122
|
}
|
@@ -153,7 +153,7 @@ GIT_INLINE(int) rebase_readint(
|
|
153
153
|
return error;
|
154
154
|
|
155
155
|
if (git__strntol32(&num, asc_out->ptr, asc_out->size, &eol, 10) < 0 || num < 0 || *eol) {
|
156
|
-
|
156
|
+
git_error_set(GIT_ERROR_REBASE, "the file '%s' contains an invalid numeric value", filename);
|
157
157
|
return -1;
|
158
158
|
}
|
159
159
|
|
@@ -171,7 +171,7 @@ GIT_INLINE(int) rebase_readoid(
|
|
171
171
|
return error;
|
172
172
|
|
173
173
|
if (str_out->size != GIT_OID_HEXSZ || git_oid_fromstr(out, str_out->ptr) < 0) {
|
174
|
-
|
174
|
+
git_error_set(GIT_ERROR_REBASE, "the file '%s' contains an invalid object ID", filename);
|
175
175
|
return -1;
|
176
176
|
}
|
177
177
|
|
@@ -231,7 +231,7 @@ static int rebase_open_merge(git_rebase *rebase)
|
|
231
231
|
|
232
232
|
/* Read cmt.* */
|
233
233
|
git_array_init_to_size(rebase->operations, end);
|
234
|
-
|
234
|
+
GIT_ERROR_CHECK_ARRAY(rebase->operations);
|
235
235
|
|
236
236
|
for (i = 0; i < end; i++) {
|
237
237
|
git_buf_clear(&cmt);
|
@@ -241,7 +241,7 @@ static int rebase_open_merge(git_rebase *rebase)
|
|
241
241
|
goto done;
|
242
242
|
|
243
243
|
operation = rebase_operation_alloc(rebase, GIT_REBASE_OPERATION_PICK, &id, NULL);
|
244
|
-
|
244
|
+
GIT_ERROR_CHECK_ALLOC(operation);
|
245
245
|
}
|
246
246
|
|
247
247
|
/* Read 'onto_name' */
|
@@ -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_dispose(&cmt);
|
255
|
+
git_buf_dispose(&state_path);
|
256
|
+
git_buf_dispose(&buf);
|
257
257
|
|
258
258
|
return error;
|
259
259
|
}
|
@@ -261,7 +261,7 @@ done:
|
|
261
261
|
static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
|
262
262
|
{
|
263
263
|
git_rebase *rebase = git__calloc(1, sizeof(git_rebase));
|
264
|
-
|
264
|
+
GIT_ERROR_CHECK_ALLOC(rebase);
|
265
265
|
|
266
266
|
*out = NULL;
|
267
267
|
|
@@ -272,12 +272,9 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
|
|
272
272
|
|
273
273
|
if (rebase_opts && rebase_opts->rewrite_notes_ref) {
|
274
274
|
rebase->options.rewrite_notes_ref = git__strdup(rebase_opts->rewrite_notes_ref);
|
275
|
-
|
275
|
+
GIT_ERROR_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
|
-
|
281
278
|
*out = rebase;
|
282
279
|
|
283
280
|
return 0;
|
@@ -285,10 +282,10 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
|
|
285
282
|
|
286
283
|
static int rebase_check_versions(const git_rebase_options *given_opts)
|
287
284
|
{
|
288
|
-
|
285
|
+
GIT_ERROR_CHECK_VERSION(given_opts, GIT_REBASE_OPTIONS_VERSION, "git_rebase_options");
|
289
286
|
|
290
287
|
if (given_opts)
|
291
|
-
|
288
|
+
GIT_ERROR_CHECK_VERSION(&given_opts->checkout_options, GIT_CHECKOUT_OPTIONS_VERSION, "git_checkout_options");
|
292
289
|
|
293
290
|
return 0;
|
294
291
|
}
|
@@ -317,7 +314,7 @@ int git_rebase_open(
|
|
317
314
|
goto done;
|
318
315
|
|
319
316
|
if (rebase->type == GIT_REBASE_TYPE_NONE) {
|
320
|
-
|
317
|
+
git_error_set(GIT_ERROR_REBASE, "there is no rebase in progress");
|
321
318
|
error = GIT_ENOTFOUND;
|
322
319
|
goto done;
|
323
320
|
}
|
@@ -373,14 +370,14 @@ int git_rebase_open(
|
|
373
370
|
|
374
371
|
switch (rebase->type) {
|
375
372
|
case GIT_REBASE_TYPE_INTERACTIVE:
|
376
|
-
|
373
|
+
git_error_set(GIT_ERROR_REBASE, "interactive rebase is not supported");
|
377
374
|
error = -1;
|
378
375
|
break;
|
379
376
|
case GIT_REBASE_TYPE_MERGE:
|
380
377
|
error = rebase_open_merge(rebase);
|
381
378
|
break;
|
382
379
|
case GIT_REBASE_TYPE_APPLY:
|
383
|
-
|
380
|
+
git_error_set(GIT_ERROR_REBASE, "patch application rebase is not supported");
|
384
381
|
error = -1;
|
385
382
|
break;
|
386
383
|
default:
|
@@ -393,10 +390,10 @@ done:
|
|
393
390
|
else
|
394
391
|
git_rebase_free(rebase);
|
395
392
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
393
|
+
git_buf_dispose(&path);
|
394
|
+
git_buf_dispose(&orig_head_name);
|
395
|
+
git_buf_dispose(&orig_head_id);
|
396
|
+
git_buf_dispose(&onto_id);
|
400
397
|
return error;
|
401
398
|
}
|
402
399
|
|
@@ -424,8 +421,8 @@ static int rebase_setupfile(git_rebase *rebase, const char *filename, int flags,
|
|
424
421
|
if ((error = git_buf_joinpath(&path, rebase->state_path, filename)) == 0)
|
425
422
|
error = git_futils_writebuffer(&contents, path.ptr, flags, REBASE_FILE_MODE);
|
426
423
|
|
427
|
-
|
428
|
-
|
424
|
+
git_buf_dispose(&path);
|
425
|
+
git_buf_dispose(&contents);
|
429
426
|
|
430
427
|
return error;
|
431
428
|
}
|
@@ -466,7 +463,7 @@ static int rebase_setupfiles_merge(git_rebase *rebase)
|
|
466
463
|
}
|
467
464
|
|
468
465
|
done:
|
469
|
-
|
466
|
+
git_buf_dispose(&commit_filename);
|
470
467
|
return error;
|
471
468
|
}
|
472
469
|
|
@@ -479,7 +476,7 @@ static int rebase_setupfiles(git_rebase *rebase)
|
|
479
476
|
git_oid_fmt(orig_head, &rebase->orig_head_id);
|
480
477
|
|
481
478
|
if (p_mkdir(rebase->state_path, REBASE_DIR_MODE) < 0) {
|
482
|
-
|
479
|
+
git_error_set(GIT_ERROR_OS, "failed to create rebase directory '%s'", rebase->state_path);
|
483
480
|
return -1;
|
484
481
|
}
|
485
482
|
|
@@ -512,7 +509,7 @@ static int rebase_ensure_not_in_progress(git_repository *repo)
|
|
512
509
|
return error;
|
513
510
|
|
514
511
|
if (type != GIT_REBASE_TYPE_NONE) {
|
515
|
-
|
512
|
+
git_error_set(GIT_ERROR_REBASE, "there is an existing rebase in progress");
|
516
513
|
return -1;
|
517
514
|
}
|
518
515
|
|
@@ -537,7 +534,7 @@ static int rebase_ensure_not_dirty(
|
|
537
534
|
goto done;
|
538
535
|
|
539
536
|
if (git_diff_num_deltas(diff) > 0) {
|
540
|
-
|
537
|
+
git_error_set(GIT_ERROR_REBASE, "uncommitted changes exist in index");
|
541
538
|
error = fail_with;
|
542
539
|
goto done;
|
543
540
|
}
|
@@ -553,7 +550,7 @@ static int rebase_ensure_not_dirty(
|
|
553
550
|
goto done;
|
554
551
|
|
555
552
|
if (git_diff_num_deltas(diff) > 0) {
|
556
|
-
|
553
|
+
git_error_set(GIT_ERROR_REBASE, "unstaged changes exist in workdir");
|
557
554
|
error = fail_with;
|
558
555
|
goto done;
|
559
556
|
}
|
@@ -602,7 +599,7 @@ static int rebase_init_operations(
|
|
602
599
|
continue;
|
603
600
|
|
604
601
|
operation = rebase_operation_alloc(rebase, GIT_REBASE_OPERATION_PICK, &id, NULL);
|
605
|
-
|
602
|
+
GIT_ERROR_CHECK_ALLOC(operation);
|
606
603
|
}
|
607
604
|
|
608
605
|
error = 0;
|
@@ -631,17 +628,17 @@ static int rebase_init_merge(
|
|
631
628
|
goto done;
|
632
629
|
|
633
630
|
rebase->state_path = git_buf_detach(&state_path);
|
634
|
-
|
631
|
+
GIT_ERROR_CHECK_ALLOC(rebase->state_path);
|
635
632
|
|
636
633
|
if (branch->ref_name && strcmp(branch->ref_name, "HEAD")) {
|
637
634
|
rebase->orig_head_name = git__strdup(branch->ref_name);
|
638
|
-
|
635
|
+
GIT_ERROR_CHECK_ALLOC(rebase->orig_head_name);
|
639
636
|
} else {
|
640
637
|
rebase->head_detached = 1;
|
641
638
|
}
|
642
639
|
|
643
640
|
rebase->onto_name = git__strdup(rebase_onto_name(onto));
|
644
|
-
|
641
|
+
GIT_ERROR_CHECK_ALLOC(rebase->onto_name);
|
645
642
|
|
646
643
|
rebase->quiet = rebase->options.quiet;
|
647
644
|
|
@@ -662,8 +659,8 @@ static int rebase_init_merge(
|
|
662
659
|
done:
|
663
660
|
git_reference_free(head_ref);
|
664
661
|
git_commit_free(onto_commit);
|
665
|
-
|
666
|
-
|
662
|
+
git_buf_dispose(&reflog);
|
663
|
+
git_buf_dispose(&state_path);
|
667
664
|
|
668
665
|
return error;
|
669
666
|
}
|
@@ -810,7 +807,7 @@ static int rebase_next_merge(
|
|
810
807
|
goto done;
|
811
808
|
|
812
809
|
if ((parent_count = git_commit_parentcount(current_commit)) > 1) {
|
813
|
-
|
810
|
+
git_error_set(GIT_ERROR_REBASE, "cannot rebase a merge commit");
|
814
811
|
error = -1;
|
815
812
|
goto done;
|
816
813
|
} else if (parent_count) {
|
@@ -842,7 +839,7 @@ done:
|
|
842
839
|
git_tree_free(parent_tree);
|
843
840
|
git_commit_free(parent_commit);
|
844
841
|
git_commit_free(current_commit);
|
845
|
-
|
842
|
+
git_buf_dispose(&path);
|
846
843
|
|
847
844
|
return error;
|
848
845
|
}
|
@@ -867,7 +864,7 @@ static int rebase_next_inmemory(
|
|
867
864
|
goto done;
|
868
865
|
|
869
866
|
if ((parent_count = git_commit_parentcount(current_commit)) > 1) {
|
870
|
-
|
867
|
+
git_error_set(GIT_ERROR_REBASE, "cannot rebase a merge commit");
|
871
868
|
error = -1;
|
872
869
|
goto done;
|
873
870
|
} else if (parent_count) {
|
@@ -953,7 +950,7 @@ static int rebase_commit__create(
|
|
953
950
|
operation = git_array_get(rebase->operations, rebase->current);
|
954
951
|
|
955
952
|
if (git_index_has_conflicts(index)) {
|
956
|
-
|
953
|
+
git_error_set(GIT_ERROR_REBASE, "conflicts have not been resolved");
|
957
954
|
error = GIT_EUNMERGED;
|
958
955
|
goto done;
|
959
956
|
}
|
@@ -965,7 +962,7 @@ static int rebase_commit__create(
|
|
965
962
|
goto done;
|
966
963
|
|
967
964
|
if (git_oid_equal(&tree_id, git_tree_id(parent_tree))) {
|
968
|
-
|
965
|
+
git_error_set(GIT_ERROR_REBASE, "this patch has already been applied");
|
969
966
|
error = GIT_EAPPLIED;
|
970
967
|
goto done;
|
971
968
|
}
|
@@ -1017,7 +1014,7 @@ static int rebase_commit_merge(
|
|
1017
1014
|
|
1018
1015
|
if ((error = rebase_ensure_not_dirty(rebase->repo, false, true, GIT_EUNMERGED)) < 0 ||
|
1019
1016
|
(error = git_repository_head(&head, rebase->repo)) < 0 ||
|
1020
|
-
(error = git_reference_peel((git_object **)&head_commit, head,
|
1017
|
+
(error = git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)) < 0 ||
|
1021
1018
|
(error = git_repository_index(&index, rebase->repo)) < 0 ||
|
1022
1019
|
(error = rebase_commit__create(&commit, rebase, index, head_commit,
|
1023
1020
|
author, committer, message_encoding, message)) < 0 ||
|
@@ -1151,7 +1148,7 @@ static int notes_ref_lookup(git_buf *out, git_rebase *rebase)
|
|
1151
1148
|
if (error != GIT_ENOTFOUND)
|
1152
1149
|
goto done;
|
1153
1150
|
|
1154
|
-
|
1151
|
+
git_error_clear();
|
1155
1152
|
do_rewrite = 1;
|
1156
1153
|
}
|
1157
1154
|
|
@@ -1178,7 +1175,7 @@ static int rebase_copy_note(
|
|
1178
1175
|
|
1179
1176
|
if ((error = git_note_read(¬e, rebase->repo, notes_ref, from)) < 0) {
|
1180
1177
|
if (error == GIT_ENOTFOUND) {
|
1181
|
-
|
1178
|
+
git_error_clear();
|
1182
1179
|
error = 0;
|
1183
1180
|
}
|
1184
1181
|
|
@@ -1191,7 +1188,7 @@ static int rebase_copy_note(
|
|
1191
1188
|
(error = git_signature_now(&who, "unknown", "unknown")) < 0)
|
1192
1189
|
goto done;
|
1193
1190
|
|
1194
|
-
|
1191
|
+
git_error_clear();
|
1195
1192
|
}
|
1196
1193
|
|
1197
1194
|
committer = who;
|
@@ -1219,7 +1216,7 @@ static int rebase_copy_notes(
|
|
1219
1216
|
|
1220
1217
|
if ((error = notes_ref_lookup(¬es_ref, rebase)) < 0) {
|
1221
1218
|
if (error == GIT_ENOTFOUND) {
|
1222
|
-
|
1219
|
+
git_error_clear();
|
1223
1220
|
error = 0;
|
1224
1221
|
}
|
1225
1222
|
|
@@ -1262,13 +1259,13 @@ static int rebase_copy_notes(
|
|
1262
1259
|
goto done;
|
1263
1260
|
|
1264
1261
|
on_error:
|
1265
|
-
|
1262
|
+
git_error_set(GIT_ERROR_REBASE, "invalid rewritten file at line %d", linenum);
|
1266
1263
|
error = -1;
|
1267
1264
|
|
1268
1265
|
done:
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1266
|
+
git_buf_dispose(&rewritten);
|
1267
|
+
git_buf_dispose(&path);
|
1268
|
+
git_buf_dispose(¬es_ref);
|
1272
1269
|
|
1273
1270
|
return error;
|
1274
1271
|
}
|
@@ -1291,7 +1288,7 @@ static int return_to_orig_head(git_rebase *rebase)
|
|
1291
1288
|
rebase->orig_head_name)) == 0 &&
|
1292
1289
|
(error = git_repository_head(&terminal_ref, rebase->repo)) == 0 &&
|
1293
1290
|
(error = git_reference_peel((git_object **)&terminal_commit,
|
1294
|
-
terminal_ref,
|
1291
|
+
terminal_ref, GIT_OBJECT_COMMIT)) == 0 &&
|
1295
1292
|
(error = git_reference_create_matching(&branch_ref,
|
1296
1293
|
rebase->repo, rebase->orig_head_name,
|
1297
1294
|
git_commit_id(terminal_commit), 1,
|
@@ -1300,8 +1297,8 @@ static int return_to_orig_head(git_rebase *rebase)
|
|
1300
1297
|
rebase->repo, GIT_HEAD_FILE, rebase->orig_head_name, 1,
|
1301
1298
|
head_msg.ptr);
|
1302
1299
|
|
1303
|
-
|
1304
|
-
|
1300
|
+
git_buf_dispose(&head_msg);
|
1301
|
+
git_buf_dispose(&branch_msg);
|
1305
1302
|
git_commit_free(terminal_commit);
|
1306
1303
|
git_reference_free(head_ref);
|
1307
1304
|
git_reference_free(branch_ref);
|