rugged 0.24.0b13 → 0.24.0b14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/rugged/rugged_commit.c +6 -6
- data/ext/rugged/rugged_revwalk.c +7 -3
- data/ext/rugged/rugged_settings.c +5 -0
- data/lib/rugged/tag.rb +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +21 -8
- data/vendor/libgit2/include/git2/commit.h +6 -0
- data/vendor/libgit2/include/git2/common.h +15 -0
- data/vendor/libgit2/include/git2/errors.h +0 -5
- data/vendor/libgit2/include/git2/rebase.h +1 -1
- data/vendor/libgit2/include/git2/sys/filter.h +34 -25
- data/vendor/libgit2/include/git2/sys/index.h +1 -1
- data/vendor/libgit2/src/checkout.c +1 -1
- data/vendor/libgit2/src/commit.c +44 -12
- data/vendor/libgit2/src/common.h +11 -0
- data/vendor/libgit2/src/crlf.c +1 -1
- data/vendor/libgit2/src/diff_print.c +5 -1
- data/vendor/libgit2/src/diff_tform.c +16 -11
- data/vendor/libgit2/src/fileops.c +8 -15
- data/vendor/libgit2/src/filter.c +155 -124
- data/vendor/libgit2/src/filter.h +2 -0
- data/vendor/libgit2/src/global.c +56 -162
- data/vendor/libgit2/src/index.c +68 -30
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/iterator.c +9 -3
- data/vendor/libgit2/src/netops.c +4 -0
- data/vendor/libgit2/src/object.c +26 -0
- data/vendor/libgit2/src/object.h +23 -0
- data/vendor/libgit2/src/openssl_stream.c +135 -3
- data/vendor/libgit2/src/openssl_stream.h +2 -0
- data/vendor/libgit2/src/pack-objects.c +6 -6
- data/vendor/libgit2/src/pack.c +18 -1
- data/vendor/libgit2/src/path.c +7 -3
- data/vendor/libgit2/src/path.h +14 -4
- data/vendor/libgit2/src/pool.c +78 -30
- data/vendor/libgit2/src/pool.h +28 -0
- data/vendor/libgit2/src/posix.c +5 -2
- data/vendor/libgit2/src/rebase.c +12 -10
- data/vendor/libgit2/src/refdb_fs.c +3 -4
- data/vendor/libgit2/src/refs.c +1 -7
- data/vendor/libgit2/src/refspec.c +4 -4
- data/vendor/libgit2/src/remote.c +2 -2
- data/vendor/libgit2/src/revwalk.c +1 -2
- data/vendor/libgit2/src/settings.c +9 -0
- data/vendor/libgit2/src/signature.c +2 -3
- data/vendor/libgit2/src/submodule.c +2 -2
- data/vendor/libgit2/src/thread-utils.h +1 -1
- data/vendor/libgit2/src/transports/smart_pkt.c +15 -9
- data/vendor/libgit2/src/transports/smart_protocol.c +2 -0
- data/vendor/libgit2/src/transports/winhttp.c +1 -1
- data/vendor/libgit2/src/tree.c +31 -10
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +15 -1
- data/vendor/libgit2/src/win32/posix.h +6 -4
- data/vendor/libgit2/src/win32/posix_w32.c +18 -2
- data/vendor/libgit2/src/win32/utf-conv.c +3 -18
- data/vendor/libgit2/src/win32/w32_util.h +44 -11
- data/vendor/libgit2/src/win32/win32-compat.h +10 -0
- data/vendor/libgit2/src/xdiff/xmerge.c +2 -0
- metadata +416 -405
- checksums.yaml +0 -7
data/ext/rugged/rugged_commit.c
CHANGED
@@ -625,7 +625,7 @@ static VALUE rb_git_commit_header(VALUE self)
|
|
625
625
|
static VALUE rb_git_commit_extract_signature(int argc, VALUE *argv, VALUE self)
|
626
626
|
{
|
627
627
|
int error;
|
628
|
-
VALUE
|
628
|
+
VALUE ret;
|
629
629
|
git_oid commit_id;
|
630
630
|
const char *field;
|
631
631
|
git_repository *repo;
|
@@ -647,19 +647,19 @@ static VALUE rb_git_commit_extract_signature(int argc, VALUE *argv, VALUE self)
|
|
647
647
|
git_buf_free(&signed_data);
|
648
648
|
}
|
649
649
|
|
650
|
-
if (error == GIT_ENOTFOUND) {
|
651
|
-
|
650
|
+
if (error == GIT_ENOTFOUND && giterr_last()->klass == GITERR_OBJECT ) {
|
651
|
+
ret = Qnil;
|
652
652
|
} else {
|
653
653
|
rugged_exception_check(error);
|
654
654
|
|
655
|
-
|
656
|
-
|
655
|
+
ret = rb_ary_new3(2, rb_str_new(signature.ptr, signature.size),
|
656
|
+
rb_str_new(signed_data.ptr, signed_data.size));
|
657
657
|
}
|
658
658
|
|
659
659
|
git_buf_free(&signature);
|
660
660
|
git_buf_free(&signed_data);
|
661
661
|
|
662
|
-
return
|
662
|
+
return ret;
|
663
663
|
}
|
664
664
|
|
665
665
|
void Init_rugged_commit(void)
|
data/ext/rugged/rugged_revwalk.c
CHANGED
@@ -194,15 +194,19 @@ static VALUE rb_git_walker_simplify_first_parent(VALUE self)
|
|
194
194
|
* call-seq:
|
195
195
|
* walker.count -> Fixnum
|
196
196
|
*
|
197
|
-
* Returns the amount of objects a walker iterated over.
|
197
|
+
* Returns the amount of objects a walker iterated over. If an argument or
|
198
|
+
* block is given this method delegates to +Enumerable#count+.
|
198
199
|
*/
|
199
|
-
static VALUE rb_git_walker_count(VALUE self)
|
200
|
+
static VALUE rb_git_walker_count(int argc, VALUE *argv, VALUE self)
|
200
201
|
{
|
201
202
|
git_revwalk *walk;
|
202
203
|
git_oid commit_oid;
|
203
204
|
int error = 0;
|
204
205
|
uint64_t count = 0;
|
205
206
|
|
207
|
+
if (argc > 0 || rb_block_given_p())
|
208
|
+
return rb_call_super(argc, argv);
|
209
|
+
|
206
210
|
Data_Get_Struct(self, git_revwalk, walk);
|
207
211
|
|
208
212
|
while (((error = git_revwalk_next(&commit_oid, walk)) == 0) && ++count != UINT64_MAX);
|
@@ -515,5 +519,5 @@ void Init_rugged_revwalk(void)
|
|
515
519
|
rb_define_method(rb_cRuggedWalker, "reset", rb_git_walker_reset, 0);
|
516
520
|
rb_define_method(rb_cRuggedWalker, "sorting", rb_git_walker_sorting, 1);
|
517
521
|
rb_define_method(rb_cRuggedWalker, "simplify_first_parent", rb_git_walker_simplify_first_parent, 0);
|
518
|
-
rb_define_method(rb_cRuggedWalker, "count", rb_git_walker_count,
|
522
|
+
rb_define_method(rb_cRuggedWalker, "count", rb_git_walker_count, -1);
|
519
523
|
}
|
@@ -98,6 +98,11 @@ static VALUE rb_git_set_option(VALUE self, VALUE option, VALUE value)
|
|
98
98
|
set_search_path(GIT_CONFIG_LEVEL_SYSTEM, value);
|
99
99
|
}
|
100
100
|
|
101
|
+
else if (strcmp(opt, "strict_object_creation") == 0) {
|
102
|
+
int strict = RTEST(value) ? 1 : 0;
|
103
|
+
git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, strict);
|
104
|
+
}
|
105
|
+
|
101
106
|
else {
|
102
107
|
rb_raise(rb_eArgError, "Unknown option specified");
|
103
108
|
}
|
data/lib/rugged/tag.rb
CHANGED
data/lib/rugged/version.rb
CHANGED
@@ -41,6 +41,11 @@ OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
|
|
41
41
|
OPTION( USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF )
|
42
42
|
OPTION( VALGRIND "Configure build for valgrind" OFF )
|
43
43
|
OPTION( CURL "User curl for HTTP if available" ON)
|
44
|
+
OPTION( DEBUG_POOL "Enable debug pool allocator" OFF )
|
45
|
+
|
46
|
+
IF(DEBUG_POOL)
|
47
|
+
ADD_DEFINITIONS(-DGIT_DEBUG_POOL)
|
48
|
+
ENDIF()
|
44
49
|
|
45
50
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
46
51
|
SET( USE_ICONV ON )
|
@@ -86,17 +91,21 @@ IF (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
86
91
|
OPTION( USE_OPENSSL "Link with and use openssl library" ON )
|
87
92
|
ENDIF()
|
88
93
|
|
89
|
-
CHECK_STRUCT_HAS_MEMBER ("struct stat"
|
90
|
-
|
91
|
-
CHECK_STRUCT_HAS_MEMBER ("struct stat"
|
92
|
-
|
94
|
+
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h"
|
95
|
+
HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C)
|
96
|
+
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtimespec "sys/types.h;sys/stat.h"
|
97
|
+
HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C)
|
98
|
+
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_nsec sys/stat.h
|
99
|
+
HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C)
|
93
100
|
|
94
|
-
IF (
|
101
|
+
IF (HAVE_STRUCT_STAT_ST_MTIM)
|
95
102
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
|
96
103
|
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
97
|
-
ELSEIF (
|
104
|
+
ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
|
98
105
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
|
99
106
|
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
107
|
+
ELSE ()
|
108
|
+
SET( HAVE_STRUCT_STAT_NSEC ON )
|
100
109
|
ENDIF()
|
101
110
|
|
102
111
|
IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
|
@@ -539,8 +548,12 @@ IF (USE_NSEC)
|
|
539
548
|
ADD_DEFINITIONS(-DGIT_USE_NSEC)
|
540
549
|
ENDIF()
|
541
550
|
|
542
|
-
IF (
|
543
|
-
ADD_DEFINITIONS(-
|
551
|
+
IF (HAVE_STRUCT_STAT_ST_MTIM)
|
552
|
+
ADD_DEFINITIONS(-DGIT_USE_STAT_MTIM)
|
553
|
+
ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
|
554
|
+
ADD_DEFINITIONS(-DGIT_USE_STAT_MTIMESPEC)
|
555
|
+
ELSEIF (HAVE_STRUCT_STAT_ST_MTIME_NSEC)
|
556
|
+
ADD_DEFINITIONS(-DGIT_USE_STAT_MTIME_NSEC)
|
544
557
|
ENDIF()
|
545
558
|
|
546
559
|
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
|
@@ -266,12 +266,18 @@ GIT_EXTERN(int) git_commit_header_field(git_buf *out, const git_commit *commit,
|
|
266
266
|
/**
|
267
267
|
* Extract the signature from a commit
|
268
268
|
*
|
269
|
+
* If the id is not for a commit, the error class will be
|
270
|
+
* `GITERR_INVALID`. If the commit does not have a signature, the
|
271
|
+
* error class will be `GITERR_OBJECT`.
|
272
|
+
*
|
269
273
|
* @param signature the signature block
|
270
274
|
* @param signed_data signed data; this is the commit contents minus the signature block
|
271
275
|
* @param repo the repository in which the commit exists
|
272
276
|
* @param commit_id the commit from which to extract the data
|
273
277
|
* @param field the name of the header field containing the signature
|
274
278
|
* block; pass `NULL` to extract the default 'gpgsig'
|
279
|
+
* @return 0 on success, GIT_ENOTFOUND if the id is not for a commit
|
280
|
+
* or the commit does not have a signature.
|
275
281
|
*/
|
276
282
|
GIT_EXTERN(int) git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_repository *repo, git_oid *commit_id, const char *field);
|
277
283
|
|
@@ -147,6 +147,7 @@ typedef enum {
|
|
147
147
|
GIT_OPT_SET_TEMPLATE_PATH,
|
148
148
|
GIT_OPT_SET_SSL_CERT_LOCATIONS,
|
149
149
|
GIT_OPT_SET_USER_AGENT,
|
150
|
+
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION,
|
150
151
|
} git_libgit2_opt_t;
|
151
152
|
|
152
153
|
/**
|
@@ -245,6 +246,20 @@ typedef enum {
|
|
245
246
|
*
|
246
247
|
* * opts(GIT_OPT_SET_USER_AGENT, const char *user_agent)
|
247
248
|
*
|
249
|
+
* > Set the value of the User-Agent header. This value will be
|
250
|
+
* > appended to "git/1.0", for compatibility with other git clients.
|
251
|
+
* >
|
252
|
+
* > - `user_agent` is the value that will be delivered as the
|
253
|
+
* > User-Agent header on HTTP requests.
|
254
|
+
*
|
255
|
+
* * opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, int enabled)
|
256
|
+
*
|
257
|
+
* > Enable strict input validation when creating new objects
|
258
|
+
* > to ensure that all inputs to the new objects are valid. For
|
259
|
+
* > example, when this is enabled, the parent(s) and tree inputs
|
260
|
+
* > will be validated when creating a new commit. This defaults
|
261
|
+
* > to disabled.
|
262
|
+
*
|
248
263
|
* @param option Option key
|
249
264
|
* @param ... value to set the option
|
250
265
|
* @return 0 on success, <0 on failure
|
@@ -126,11 +126,6 @@ GIT_EXTERN(void) giterr_clear(void);
|
|
126
126
|
* This error message is stored in thread-local storage and only applies
|
127
127
|
* to the particular thread that this libgit2 call is made from.
|
128
128
|
*
|
129
|
-
* NOTE: Passing the `error_class` as GITERR_OS has a special behavior: we
|
130
|
-
* attempt to append the system default error message for the last OS error
|
131
|
-
* that occurred and then clear the last error. The specific implementation
|
132
|
-
* of looking up and clearing this last OS error will vary by platform.
|
133
|
-
*
|
134
129
|
* @param error_class One of the `git_error_t` enum above describing the
|
135
130
|
* general subsystem that is responsible for the error.
|
136
131
|
* @param string The formatted error message to keep
|
@@ -64,7 +64,7 @@ typedef struct {
|
|
64
64
|
|
65
65
|
/**
|
66
66
|
* Options to control how files are written during `git_rebase_init`,
|
67
|
-
* `
|
67
|
+
* `git_rebase_next` and `git_rebase_abort`. Note that a minimum
|
68
68
|
* strategy of `GIT_CHECKOUT_SAFE` is defaulted in `init` and `next`,
|
69
69
|
* and a minimum strategy of `GIT_CHECKOUT_FORCE` is defaulted in
|
70
70
|
* `abort` to match git semantics.
|
@@ -127,17 +127,6 @@ GIT_EXTERN(git_filter_mode_t) git_filter_source_mode(const git_filter_source *sr
|
|
127
127
|
*/
|
128
128
|
GIT_EXTERN(uint32_t) git_filter_source_flags(const git_filter_source *src);
|
129
129
|
|
130
|
-
/*
|
131
|
-
* struct git_filter
|
132
|
-
*
|
133
|
-
* The filter lifecycle:
|
134
|
-
* - initialize - first use of filter
|
135
|
-
* - shutdown - filter removed/unregistered from system
|
136
|
-
* - check - considering filter for file
|
137
|
-
* - apply - apply filter to file contents
|
138
|
-
* - cleanup - done with file
|
139
|
-
*/
|
140
|
-
|
141
130
|
/**
|
142
131
|
* Initialize callback on filter
|
143
132
|
*
|
@@ -233,31 +222,51 @@ typedef void (*git_filter_cleanup_fn)(
|
|
233
222
|
* To associate extra data with a filter, allocate extra data and put the
|
234
223
|
* `git_filter` struct at the start of your data buffer, then cast the
|
235
224
|
* `self` pointer to your larger structure when your callback is invoked.
|
236
|
-
*
|
237
|
-
* `version` should be set to GIT_FILTER_VERSION
|
238
|
-
*
|
239
|
-
* `attributes` is a whitespace-separated list of attribute names to check
|
240
|
-
* for this filter (e.g. "eol crlf text"). If the attribute name is bare,
|
241
|
-
* it will be simply loaded and passed to the `check` callback. If it has
|
242
|
-
* a value (i.e. "name=value"), the attribute must match that value for
|
243
|
-
* the filter to be applied. The value may be a wildcard (eg, "name=*"),
|
244
|
-
* in which case the filter will be invoked for any value for the given
|
245
|
-
* attribute name. See the attribute parameter of the `check` callback
|
246
|
-
* for the attribute value that was specified.
|
247
|
-
*
|
248
|
-
* The `initialize`, `shutdown`, `check`, `apply`, and `cleanup` callbacks
|
249
|
-
* are all documented above with the respective function pointer typedefs.
|
250
225
|
*/
|
251
226
|
struct git_filter {
|
227
|
+
/** The `version` field should be set to `GIT_FILTER_VERSION`. */
|
252
228
|
unsigned int version;
|
253
229
|
|
230
|
+
/**
|
231
|
+
* A whitespace-separated list of attribute names to check for this
|
232
|
+
* filter (e.g. "eol crlf text"). If the attribute name is bare, it
|
233
|
+
* will be simply loaded and passed to the `check` callback. If it
|
234
|
+
* has a value (i.e. "name=value"), the attribute must match that
|
235
|
+
* value for the filter to be applied. The value may be a wildcard
|
236
|
+
* (eg, "name=*"), in which case the filter will be invoked for any
|
237
|
+
* value for the given attribute name. See the attribute parameter
|
238
|
+
* of the `check` callback for the attribute value that was specified.
|
239
|
+
*/
|
254
240
|
const char *attributes;
|
255
241
|
|
242
|
+
/** Called when the filter is first used for any file. */
|
256
243
|
git_filter_init_fn initialize;
|
244
|
+
|
245
|
+
/** Called when the filter is removed or unregistered from the system. */
|
257
246
|
git_filter_shutdown_fn shutdown;
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Called to determine whether the filter should be invoked for a
|
250
|
+
* given file. If this function returns `GIT_PASSTHROUGH` then the
|
251
|
+
* `apply` function will not be invoked and the contents will be passed
|
252
|
+
* through unmodified.
|
253
|
+
*/
|
258
254
|
git_filter_check_fn check;
|
255
|
+
|
256
|
+
/**
|
257
|
+
* Called to actually apply the filter to file contents. If this
|
258
|
+
* function returns `GIT_PASSTHROUGH` then the contents will be passed
|
259
|
+
* through unmodified.
|
260
|
+
*/
|
259
261
|
git_filter_apply_fn apply;
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Called to apply the filter in a streaming manner. If this is not
|
265
|
+
* specified then the system will call `apply` with the whole buffer.
|
266
|
+
*/
|
260
267
|
git_filter_stream_fn stream;
|
268
|
+
|
269
|
+
/** Called when the system is done filtering for a file. */
|
261
270
|
git_filter_cleanup_fn cleanup;
|
262
271
|
};
|
263
272
|
|
@@ -1226,7 +1226,7 @@ static int checkout_verify_paths(
|
|
1226
1226
|
int action,
|
1227
1227
|
git_diff_delta *delta)
|
1228
1228
|
{
|
1229
|
-
unsigned int flags =
|
1229
|
+
unsigned int flags = GIT_PATH_REJECT_WORKDIR_DEFAULTS;
|
1230
1230
|
|
1231
1231
|
if (action & CHECKOUT_ACTION__REMOVE) {
|
1232
1232
|
if (!git_path_isvalid(repo, delta->old_file.path, flags)) {
|
data/vendor/libgit2/src/commit.c
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
#include "signature.h"
|
18
18
|
#include "message.h"
|
19
19
|
#include "refs.h"
|
20
|
+
#include "object.h"
|
20
21
|
|
21
22
|
void git_commit__free(void *_commit)
|
22
23
|
{
|
@@ -36,7 +37,7 @@ void git_commit__free(void *_commit)
|
|
36
37
|
git__free(commit);
|
37
38
|
}
|
38
39
|
|
39
|
-
int
|
40
|
+
static int git_commit__create_internal(
|
40
41
|
git_oid *id,
|
41
42
|
git_repository *repo,
|
42
43
|
const char *update_ref,
|
@@ -46,7 +47,8 @@ int git_commit_create_from_callback(
|
|
46
47
|
const char *message,
|
47
48
|
const git_oid *tree,
|
48
49
|
git_commit_parent_callback parent_cb,
|
49
|
-
void *parent_payload
|
50
|
+
void *parent_payload,
|
51
|
+
bool validate)
|
50
52
|
{
|
51
53
|
git_reference *ref = NULL;
|
52
54
|
int error = 0, matched_parent = 0;
|
@@ -58,6 +60,9 @@ int git_commit_create_from_callback(
|
|
58
60
|
|
59
61
|
assert(id && repo && tree && parent_cb);
|
60
62
|
|
63
|
+
if (validate && !git_object__is_valid(repo, tree, GIT_OBJ_TREE))
|
64
|
+
return -1;
|
65
|
+
|
61
66
|
if (update_ref) {
|
62
67
|
error = git_reference_lookup_resolved(&ref, repo, update_ref, 10);
|
63
68
|
if (error < 0 && error != GIT_ENOTFOUND)
|
@@ -71,6 +76,11 @@ int git_commit_create_from_callback(
|
|
71
76
|
git_oid__writebuf(&commit, "tree ", tree);
|
72
77
|
|
73
78
|
while ((parent = parent_cb(i, parent_payload)) != NULL) {
|
79
|
+
if (validate && !git_object__is_valid(repo, parent, GIT_OBJ_COMMIT)) {
|
80
|
+
error = -1;
|
81
|
+
goto on_error;
|
82
|
+
}
|
83
|
+
|
74
84
|
git_oid__writebuf(&commit, "parent ", parent);
|
75
85
|
if (i == 0 && current_id && git_oid_equal(current_id, parent))
|
76
86
|
matched_parent = 1;
|
@@ -114,10 +124,26 @@ int git_commit_create_from_callback(
|
|
114
124
|
|
115
125
|
on_error:
|
116
126
|
git_buf_free(&commit);
|
117
|
-
giterr_set(GITERR_OBJECT, "Failed to create commit.");
|
118
127
|
return -1;
|
119
128
|
}
|
120
129
|
|
130
|
+
int git_commit_create_from_callback(
|
131
|
+
git_oid *id,
|
132
|
+
git_repository *repo,
|
133
|
+
const char *update_ref,
|
134
|
+
const git_signature *author,
|
135
|
+
const git_signature *committer,
|
136
|
+
const char *message_encoding,
|
137
|
+
const char *message,
|
138
|
+
const git_oid *tree,
|
139
|
+
git_commit_parent_callback parent_cb,
|
140
|
+
void *parent_payload)
|
141
|
+
{
|
142
|
+
return git_commit__create_internal(
|
143
|
+
id, repo, update_ref, author, committer, message_encoding, message,
|
144
|
+
tree, parent_cb, parent_payload, true);
|
145
|
+
}
|
146
|
+
|
121
147
|
typedef struct {
|
122
148
|
size_t total;
|
123
149
|
va_list args;
|
@@ -153,10 +179,10 @@ int git_commit_create_v(
|
|
153
179
|
data.total = parent_count;
|
154
180
|
va_start(data.args, parent_count);
|
155
181
|
|
156
|
-
error =
|
182
|
+
error = git_commit__create_internal(
|
157
183
|
id, repo, update_ref, author, committer,
|
158
184
|
message_encoding, message, git_tree_id(tree),
|
159
|
-
commit_parent_from_varargs, &data);
|
185
|
+
commit_parent_from_varargs, &data, false);
|
160
186
|
|
161
187
|
va_end(data.args);
|
162
188
|
return error;
|
@@ -187,10 +213,10 @@ int git_commit_create_from_ids(
|
|
187
213
|
{
|
188
214
|
commit_parent_oids data = { parent_count, parents };
|
189
215
|
|
190
|
-
return
|
216
|
+
return git_commit__create_internal(
|
191
217
|
id, repo, update_ref, author, committer,
|
192
218
|
message_encoding, message, tree,
|
193
|
-
commit_parent_from_ids, &data);
|
219
|
+
commit_parent_from_ids, &data, true);
|
194
220
|
}
|
195
221
|
|
196
222
|
typedef struct {
|
@@ -227,10 +253,10 @@ int git_commit_create(
|
|
227
253
|
|
228
254
|
assert(tree && git_tree_owner(tree) == repo);
|
229
255
|
|
230
|
-
return
|
256
|
+
return git_commit__create_internal(
|
231
257
|
id, repo, update_ref, author, committer,
|
232
258
|
message_encoding, message, git_tree_id(tree),
|
233
|
-
commit_parent_from_array, &data);
|
259
|
+
commit_parent_from_array, &data, false);
|
234
260
|
}
|
235
261
|
|
236
262
|
static const git_oid *commit_parent_for_amend(size_t curr, void *payload)
|
@@ -290,9 +316,9 @@ int git_commit_amend(
|
|
290
316
|
}
|
291
317
|
}
|
292
318
|
|
293
|
-
error =
|
319
|
+
error = git_commit__create_internal(
|
294
320
|
id, repo, NULL, author, committer, message_encoding, message,
|
295
|
-
&tree_id, commit_parent_for_amend, (void *)commit_to_amend);
|
321
|
+
&tree_id, commit_parent_for_amend, (void *)commit_to_amend, false);
|
296
322
|
|
297
323
|
if (!error && update_ref) {
|
298
324
|
error = git_reference__update_for_commit(
|
@@ -642,6 +668,12 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
642
668
|
if ((error = git_odb_read(&obj, odb, commit_id)) < 0)
|
643
669
|
return error;
|
644
670
|
|
671
|
+
if (obj->cached.type != GIT_OBJ_COMMIT) {
|
672
|
+
giterr_set(GITERR_INVALID, "the requested type does not match the type in ODB");
|
673
|
+
error = GIT_ENOTFOUND;
|
674
|
+
goto cleanup;
|
675
|
+
}
|
676
|
+
|
645
677
|
buf = git_odb_object_data(obj);
|
646
678
|
|
647
679
|
while ((h = strchr(buf, '\n')) && h[1] != '\0' && h[1] != '\n') {
|
@@ -688,7 +720,7 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
688
720
|
return git_buf_puts(signed_data, eol+1);
|
689
721
|
}
|
690
722
|
|
691
|
-
giterr_set(
|
723
|
+
giterr_set(GITERR_OBJECT, "this commit is not signed");
|
692
724
|
error = GIT_ENOTFOUND;
|
693
725
|
goto cleanup;
|
694
726
|
|