rugged 1.9.0 → 1.9.4
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.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +4 -4
- data/ext/rugged/rugged.c +12 -1
- data/ext/rugged/rugged_blame.c +22 -6
- data/ext/rugged/rugged_blob.c +24 -9
- data/ext/rugged/rugged_branch.c +10 -7
- data/ext/rugged/rugged_branch_collection.c +8 -6
- data/ext/rugged/rugged_commit.c +7 -6
- data/ext/rugged/rugged_config.c +20 -11
- data/ext/rugged/rugged_diff.c +26 -12
- data/ext/rugged/rugged_diff_hunk.c +2 -1
- data/ext/rugged/rugged_index.c +39 -29
- data/ext/rugged/rugged_note.c +7 -6
- data/ext/rugged/rugged_object.c +3 -2
- data/ext/rugged/rugged_patch.c +23 -9
- data/ext/rugged/rugged_rebase.c +22 -10
- data/ext/rugged/rugged_reference.c +22 -13
- data/ext/rugged/rugged_reference_collection.c +9 -7
- data/ext/rugged/rugged_remote.c +23 -12
- data/ext/rugged/rugged_remote_collection.c +11 -9
- data/ext/rugged/rugged_repo.c +60 -45
- data/ext/rugged/rugged_revwalk.c +22 -12
- data/ext/rugged/rugged_submodule.c +23 -20
- data/ext/rugged/rugged_submodule_collection.c +20 -9
- data/ext/rugged/rugged_tag.c +6 -4
- data/ext/rugged/rugged_tag_collection.c +7 -5
- data/ext/rugged/rugged_tree.c +27 -15
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +2 -0
- data/vendor/libgit2/CMakeLists.txt +1 -1
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +4 -1
- data/vendor/libgit2/cmake/SelectSSH.cmake +9 -3
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +2 -3
- data/vendor/libgit2/deps/xdiff/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/xdiff/xmerge.c +14 -10
- data/vendor/libgit2/include/git2/deprecated.h +1 -1
- data/vendor/libgit2/include/git2/index.h +1 -1
- data/vendor/libgit2/include/git2/merge.h +4 -2
- data/vendor/libgit2/include/git2/oid.h +0 -1
- data/vendor/libgit2/include/git2/proxy.h +2 -3
- data/vendor/libgit2/include/git2/remote.h +19 -7
- data/vendor/libgit2/include/git2/stdint.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +1 -1
- data/vendor/libgit2/include/git2/version.h +4 -2
- data/vendor/libgit2/src/cli/CMakeLists.txt +1 -2
- data/vendor/libgit2/src/cli/opt.c +3 -3
- data/vendor/libgit2/src/cli/opt_usage.c +1 -1
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +32 -16
- data/vendor/libgit2/src/libgit2/attr_file.c +10 -3
- data/vendor/libgit2/src/libgit2/clone.c +6 -0
- data/vendor/libgit2/src/libgit2/commit.c +1 -1
- data/vendor/libgit2/src/libgit2/commit_graph.c +1 -2
- data/vendor/libgit2/src/libgit2/config.c +1 -1
- data/vendor/libgit2/src/libgit2/config_file.c +2 -1
- data/vendor/libgit2/src/libgit2/config_mem.c +1 -0
- data/vendor/libgit2/src/libgit2/config_parse.c +2 -1
- data/vendor/libgit2/src/libgit2/delta.c +5 -1
- data/vendor/libgit2/src/libgit2/diff_driver.c +1 -1
- data/vendor/libgit2/src/libgit2/diff_stats.c +19 -12
- data/vendor/libgit2/src/libgit2/fetchhead.c +1 -1
- data/vendor/libgit2/src/libgit2/index.c +8 -8
- data/vendor/libgit2/src/libgit2/index.h +3 -0
- data/vendor/libgit2/src/libgit2/indexer.c +2 -2
- data/vendor/libgit2/src/libgit2/merge.c +1 -1
- data/vendor/libgit2/src/libgit2/merge.h +4 -0
- data/vendor/libgit2/src/libgit2/merge_file.c +43 -30
- data/vendor/libgit2/src/libgit2/message.c +1 -1
- data/vendor/libgit2/src/libgit2/midx.c +2 -3
- data/vendor/libgit2/src/libgit2/odb.c +2 -6
- data/vendor/libgit2/src/libgit2/odb_loose.c +24 -14
- data/vendor/libgit2/src/libgit2/oid.c +4 -5
- data/vendor/libgit2/src/libgit2/pack-objects.c +2 -4
- data/vendor/libgit2/src/libgit2/pack.c +3 -0
- data/vendor/libgit2/src/libgit2/refs.c +15 -6
- data/vendor/libgit2/src/libgit2/remote.c +4 -1
- data/vendor/libgit2/src/libgit2/remote.h +0 -1
- data/vendor/libgit2/src/libgit2/repository.c +5 -4
- data/vendor/libgit2/src/libgit2/streams/socket.c +30 -0
- data/vendor/libgit2/src/libgit2/submodule.c +12 -5
- data/vendor/libgit2/src/libgit2/tag.c +3 -1
- data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +2 -0
- data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/git.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +12 -9
- data/vendor/libgit2/src/libgit2/transports/local.c +8 -1
- data/vendor/libgit2/src/libgit2/transports/smart.c +5 -5
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +3 -3
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +57 -18
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +3 -3
- data/vendor/libgit2/src/util/CMakeLists.txt +3 -4
- data/vendor/libgit2/src/util/fs_path.c +66 -6
- data/vendor/libgit2/src/util/fs_path.h +6 -0
- data/vendor/libgit2/src/util/futils.h +11 -3
- data/vendor/libgit2/src/util/hash/builtin.c +14 -4
- data/vendor/libgit2/src/util/hash/openssl.c +0 -4
- data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +8 -6
- data/vendor/libgit2/src/util/hashmap.h +1 -0
- data/vendor/libgit2/src/util/net.c +5 -5
- data/vendor/libgit2/src/util/process.h +2 -1
- data/vendor/libgit2/src/util/runtime.c +2 -2
- data/vendor/libgit2/src/util/str.c +18 -6
- data/vendor/libgit2/src/util/str.h +5 -3
- data/vendor/libgit2/src/util/unix/process.c +92 -15
- data/vendor/libgit2/src/util/util.c +16 -3
- data/vendor/libgit2/src/util/util.h +1 -0
- data/vendor/libgit2/src/util/win32/path_w32.c +81 -5
- data/vendor/libgit2/src/util/win32/process.c +22 -6
- metadata +17 -6
|
@@ -23,6 +23,7 @@ check_type_size("unsigned long long" UNSIGNED_LONG_LONG)
|
|
|
23
23
|
disable_warnings(unused-function)
|
|
24
24
|
disable_warnings(implicit-fallthrough)
|
|
25
25
|
disable_warnings(unused-but-set-variable)
|
|
26
|
+
disable_warnings(dangling-pointer)
|
|
26
27
|
|
|
27
28
|
# User-configurable options
|
|
28
29
|
|
|
@@ -127,7 +128,7 @@ add_definitions(-DHAVE_CONFIG_H)
|
|
|
127
128
|
|
|
128
129
|
if(MSVC)
|
|
129
130
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
|
|
130
|
-
endif(
|
|
131
|
+
endif()
|
|
131
132
|
|
|
132
133
|
set(CMAKE_INCLUDE_CURRENT_DIR 1)
|
|
133
134
|
|
|
@@ -137,5 +138,3 @@ set(targets)
|
|
|
137
138
|
# pcre
|
|
138
139
|
include_directories(${PROJECT_BINARY_DIR}/src/pcre)
|
|
139
140
|
add_library(pcre OBJECT ${PCRE_HEADERS} ${PCRE_SOURCES} ${PCREPOSIX_SOURCES})
|
|
140
|
-
|
|
141
|
-
# end CMakeLists.txt
|
|
@@ -6,7 +6,7 @@ add_library(xdiff OBJECT ${SRC_XDIFF})
|
|
|
6
6
|
target_include_directories(xdiff SYSTEM PRIVATE
|
|
7
7
|
"${PROJECT_SOURCE_DIR}/include"
|
|
8
8
|
"${PROJECT_SOURCE_DIR}/src/util"
|
|
9
|
-
"${PROJECT_BINARY_DIR}/
|
|
9
|
+
"${PROJECT_BINARY_DIR}/gen_headers"
|
|
10
10
|
${LIBGIT2_SYSTEM_INCLUDES}
|
|
11
11
|
${LIBGIT2_DEPENDENCY_INCLUDES})
|
|
12
12
|
|
|
@@ -709,19 +709,23 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, mmfile_t *mf2,
|
|
|
709
709
|
goto out;
|
|
710
710
|
|
|
711
711
|
if (!xscr1) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
712
|
+
if (mf2->size) {
|
|
713
|
+
result->ptr = xdl_malloc(mf2->size);
|
|
714
|
+
if (!result->ptr)
|
|
715
|
+
goto out;
|
|
716
|
+
memcpy(result->ptr, mf2->ptr, mf2->size);
|
|
717
|
+
result->size = mf2->size;
|
|
718
|
+
}
|
|
715
719
|
status = 0;
|
|
716
|
-
memcpy(result->ptr, mf2->ptr, mf2->size);
|
|
717
|
-
result->size = mf2->size;
|
|
718
720
|
} else if (!xscr2) {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
721
|
+
if (mf1->size) {
|
|
722
|
+
result->ptr = xdl_malloc(mf1->size);
|
|
723
|
+
if (!result->ptr)
|
|
724
|
+
goto out;
|
|
725
|
+
memcpy(result->ptr, mf1->ptr, mf1->size);
|
|
726
|
+
result->size = mf1->size;
|
|
727
|
+
}
|
|
722
728
|
status = 0;
|
|
723
|
-
memcpy(result->ptr, mf1->ptr, mf1->size);
|
|
724
|
-
result->size = mf1->size;
|
|
725
729
|
} else {
|
|
726
730
|
status = xdl_do_merge(&xe1, xscr1,
|
|
727
731
|
&xe2, xscr2,
|
|
@@ -503,7 +503,7 @@ GIT_EXTERN(int) git_diff_format_email_options_init(
|
|
|
503
503
|
GIT_EXTERN(const git_error *) giterr_last(void);
|
|
504
504
|
|
|
505
505
|
/**
|
|
506
|
-
* Clear the last error. This is an alias of `
|
|
506
|
+
* Clear the last error. This is an alias of `git_error_clear` and is
|
|
507
507
|
* preserved for backward compatibility.
|
|
508
508
|
*
|
|
509
509
|
* This function is deprecated, but there is no plan to remove this
|
|
@@ -39,7 +39,7 @@ typedef struct {
|
|
|
39
39
|
*
|
|
40
40
|
* This is a public structure that represents a file entry in the index.
|
|
41
41
|
* The meaning of the fields corresponds to core Git's documentation (in
|
|
42
|
-
* "Documentation/
|
|
42
|
+
* "Documentation/gitformat-index.adoc").
|
|
43
43
|
*
|
|
44
44
|
* The `flags` field consists of a number of bit fields which can be
|
|
45
45
|
* accessed via the first set of `GIT_INDEX_ENTRY_...` bitmasks below.
|
|
@@ -568,8 +568,10 @@ GIT_EXTERN(int) git_merge_file(
|
|
|
568
568
|
/**
|
|
569
569
|
* Merge two files as they exist in the index, using the given common
|
|
570
570
|
* ancestor as the baseline, producing a `git_merge_file_result` that
|
|
571
|
-
* reflects the merge result. The `git_merge_file_result` must be
|
|
572
|
-
* `git_merge_file_result_free`.
|
|
571
|
+
* reflects the merge result. The `git_merge_file_result` must be
|
|
572
|
+
* freed with `git_merge_file_result_free`.
|
|
573
|
+
*
|
|
574
|
+
* At least one of `ancestor`, `ours`, or `theirs` must be non-null.
|
|
573
575
|
*
|
|
574
576
|
* @param out The git_merge_file_result to be filled in
|
|
575
577
|
* @param repo The repository
|
|
@@ -70,9 +70,8 @@ typedef struct {
|
|
|
70
70
|
git_credential_acquire_cb credentials;
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* connection to proceed. Returns 0 to allow the connection
|
|
73
|
+
* This will be called to let the user make the final decision of whether
|
|
74
|
+
* to allow the connection to proceed. Returns 0 to allow the connection
|
|
76
75
|
* or a negative value to indicate an error.
|
|
77
76
|
*/
|
|
78
77
|
git_transport_certificate_check_cb certificate_check;
|
|
@@ -249,9 +249,9 @@ GIT_EXTERN(const char *) git_remote_name(const git_remote *remote);
|
|
|
249
249
|
/**
|
|
250
250
|
* Get the remote's url
|
|
251
251
|
*
|
|
252
|
-
* If url.*.insteadOf has been configured for this URL, it will
|
|
253
|
-
*
|
|
254
|
-
*
|
|
252
|
+
* If url.*.insteadOf has been configured for this URL, it will return
|
|
253
|
+
* the modified URL. This function does not consider if a push url has
|
|
254
|
+
* been configured for this remote (use `git_remote_pushurl` if needed).
|
|
255
255
|
*
|
|
256
256
|
* @param remote the remote
|
|
257
257
|
* @return a pointer to the url
|
|
@@ -417,6 +417,19 @@ GIT_EXTERN(int) git_remote_ls(const git_remote_head ***out, size_t *size, git_r
|
|
|
417
417
|
*/
|
|
418
418
|
GIT_EXTERN(int) git_remote_connected(const git_remote *remote);
|
|
419
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Get the remote repository's object format.
|
|
422
|
+
*
|
|
423
|
+
* The remote (or more exactly its transport) must have connected to
|
|
424
|
+
* the remote repository. This format is available as soon as the
|
|
425
|
+
* connection to the remote is initiated and stays connected.
|
|
426
|
+
*
|
|
427
|
+
* @param out the resulting object format type
|
|
428
|
+
* @param remote the remote
|
|
429
|
+
* @return 0 on success, or an error code
|
|
430
|
+
*/
|
|
431
|
+
GIT_EXTERN(int) git_remote_oid_type(git_oid_t *out, git_remote *remote);
|
|
432
|
+
|
|
420
433
|
/**
|
|
421
434
|
* Cancel the operation
|
|
422
435
|
*
|
|
@@ -596,9 +609,8 @@ struct git_remote_callbacks {
|
|
|
596
609
|
git_credential_acquire_cb credentials;
|
|
597
610
|
|
|
598
611
|
/**
|
|
599
|
-
*
|
|
600
|
-
*
|
|
601
|
-
* connection to proceed. Returns 0 to allow the connection
|
|
612
|
+
* This will be called to let the user make the final decision of whether
|
|
613
|
+
* to allow the connection to proceed. Returns 0 to allow the connection
|
|
602
614
|
* or a negative value to indicate an error.
|
|
603
615
|
*/
|
|
604
616
|
git_transport_certificate_check_cb certificate_check;
|
|
@@ -751,7 +763,7 @@ typedef enum {
|
|
|
751
763
|
*/
|
|
752
764
|
GIT_REMOTE_DOWNLOAD_TAGS_NONE,
|
|
753
765
|
/**
|
|
754
|
-
* Ask for
|
|
766
|
+
* Ask for all the tags.
|
|
755
767
|
*/
|
|
756
768
|
GIT_REMOTE_DOWNLOAD_TAGS_ALL
|
|
757
769
|
} git_remote_autotag_option_t;
|
|
@@ -221,7 +221,7 @@ typedef uint64_t uintmax_t;
|
|
|
221
221
|
#endif /* __STDC_LIMIT_MACROS ] */
|
|
222
222
|
|
|
223
223
|
|
|
224
|
-
/* 7.18.4 Limits of other integer types
|
|
224
|
+
/* 7.18.4 Limits of other integer types */
|
|
225
225
|
|
|
226
226
|
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) /* [ See footnote 224 at page 260 */
|
|
227
227
|
|
|
@@ -206,7 +206,7 @@ GIT_EXTERN(int) git_transport_ssh_with_paths(git_transport **out, git_remote *ow
|
|
|
206
206
|
* and git_transport_unregister with other calls to the library that
|
|
207
207
|
* instantiate transports.
|
|
208
208
|
*
|
|
209
|
-
* @param prefix The scheme
|
|
209
|
+
* @param prefix The scheme to match, eg "git" or "https"
|
|
210
210
|
* @param cb The callback used to create an instance of the transport
|
|
211
211
|
* @param param A fixed parameter to pass to cb at creation time
|
|
212
212
|
* @return 0 or an error code
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
#ifndef INCLUDE_git_version_h__
|
|
8
8
|
#define INCLUDE_git_version_h__
|
|
9
9
|
|
|
10
|
+
#include "common.h"
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* @file git2/version.h
|
|
12
14
|
* @brief The version of libgit2
|
|
@@ -19,7 +21,7 @@ GIT_BEGIN_DECL
|
|
|
19
21
|
* The version string for libgit2. This string follows semantic
|
|
20
22
|
* versioning (v2) guidelines.
|
|
21
23
|
*/
|
|
22
|
-
#define LIBGIT2_VERSION "1.9.
|
|
24
|
+
#define LIBGIT2_VERSION "1.9.4"
|
|
23
25
|
|
|
24
26
|
/** The major version number for this version of libgit2. */
|
|
25
27
|
#define LIBGIT2_VERSION_MAJOR 1
|
|
@@ -28,7 +30,7 @@ GIT_BEGIN_DECL
|
|
|
28
30
|
#define LIBGIT2_VERSION_MINOR 9
|
|
29
31
|
|
|
30
32
|
/** The revision ("teeny") version number for this version of libgit2. */
|
|
31
|
-
#define LIBGIT2_VERSION_REVISION
|
|
33
|
+
#define LIBGIT2_VERSION_REVISION 4
|
|
32
34
|
|
|
33
35
|
/** The Windows DLL patch number for this version of libgit2. */
|
|
34
36
|
#define LIBGIT2_VERSION_PATCH 0
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
set(CLI_INCLUDES
|
|
2
|
-
"${libgit2_BINARY_DIR}/src/util"
|
|
3
|
-
"${libgit2_BINARY_DIR}/include"
|
|
4
2
|
"${libgit2_SOURCE_DIR}/src/util"
|
|
5
3
|
"${libgit2_SOURCE_DIR}/src/cli"
|
|
6
4
|
"${libgit2_SOURCE_DIR}/include"
|
|
5
|
+
"${libgit2_BINARY_DIR}/gen_headers"
|
|
7
6
|
"${LIBGIT2_DEPENDENCY_INCLUDES}"
|
|
8
7
|
"${LIBGIT2_SYSTEM_INCLUDES}")
|
|
9
8
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
#include <limits.h>
|
|
20
20
|
#include <assert.h>
|
|
21
21
|
|
|
22
|
-
#if defined(__sun) || defined(__illumos__)
|
|
22
|
+
#if defined(__sun) || defined(__illumos__) || defined(__CYGWIN__)
|
|
23
23
|
# include <alloca.h>
|
|
24
24
|
#endif
|
|
25
25
|
|
|
@@ -50,7 +50,7 @@ GIT_INLINE(const cli_opt_spec *) spec_for_long(
|
|
|
50
50
|
const char *arg)
|
|
51
51
|
{
|
|
52
52
|
const cli_opt_spec *spec;
|
|
53
|
-
char *eql;
|
|
53
|
+
const char *eql;
|
|
54
54
|
size_t eql_pos;
|
|
55
55
|
|
|
56
56
|
eql = strchr(arg, '=');
|
|
@@ -359,7 +359,7 @@ GIT_INLINE(const cli_opt_spec *) spec_for_sort(
|
|
|
359
359
|
const char *arg)
|
|
360
360
|
{
|
|
361
361
|
int is_negated, has_value = 0;
|
|
362
|
-
const char *value;
|
|
362
|
+
const char *value = NULL;
|
|
363
363
|
const cli_opt_spec *spec = NULL;
|
|
364
364
|
size_t idx = 0;
|
|
365
365
|
|
|
@@ -7,11 +7,10 @@ include(PkgBuildConfig)
|
|
|
7
7
|
include(CMakePackageConfigHelpers)
|
|
8
8
|
|
|
9
9
|
set(LIBGIT2_INCLUDES
|
|
10
|
-
"${PROJECT_BINARY_DIR}/src/util"
|
|
11
|
-
"${PROJECT_BINARY_DIR}/include"
|
|
12
10
|
"${PROJECT_SOURCE_DIR}/src/libgit2"
|
|
13
11
|
"${PROJECT_SOURCE_DIR}/src/util"
|
|
14
|
-
"${PROJECT_SOURCE_DIR}/include"
|
|
12
|
+
"${PROJECT_SOURCE_DIR}/include"
|
|
13
|
+
"${PROJECT_BINARY_DIR}/gen_headers")
|
|
15
14
|
|
|
16
15
|
# Collect sourcefiles
|
|
17
16
|
file(GLOB SRC_H
|
|
@@ -41,7 +40,11 @@ ide_split_sources(libgit2)
|
|
|
41
40
|
list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:util> $<TARGET_OBJECTS:libgit2> ${LIBGIT2_DEPENDENCY_OBJECTS})
|
|
42
41
|
list(APPEND LIBGIT2_INCLUDES ${LIBGIT2_DEPENDENCY_INCLUDES})
|
|
43
42
|
|
|
44
|
-
target_include_directories(libgit2
|
|
43
|
+
target_include_directories(libgit2
|
|
44
|
+
PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES}
|
|
45
|
+
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
|
46
|
+
$<INSTALL_INTERFACE:include>)
|
|
47
|
+
|
|
45
48
|
target_include_directories(libgit2 SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
|
|
46
49
|
|
|
47
50
|
set(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
|
|
@@ -55,10 +58,16 @@ set(LIBGIT2_SYSTEM_LIBS ${LIBGIT2_SYSTEM_LIBS} PARENT_SCOPE)
|
|
|
55
58
|
# Compile and link libgit2
|
|
56
59
|
#
|
|
57
60
|
|
|
61
|
+
if (NOT BUILD_SHARED_LIBS AND XCODE_VERSION)
|
|
62
|
+
# This is required for Xcode to actually create the static libgit2 library
|
|
63
|
+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "")
|
|
64
|
+
list(APPEND LIBGIT2_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.c)
|
|
65
|
+
endif()
|
|
66
|
+
|
|
58
67
|
add_library(libgit2package ${SRC_RC} ${LIBGIT2_OBJECTS})
|
|
59
68
|
target_link_libraries(libgit2package ${LIBGIT2_SYSTEM_LIBS})
|
|
60
69
|
target_include_directories(libgit2package SYSTEM PRIVATE ${LIBGIT2_INCLUDES})
|
|
61
|
-
target_include_directories(libgit2package INTERFACE $<INSTALL_INTERFACE
|
|
70
|
+
target_include_directories(libgit2package INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
62
71
|
|
|
63
72
|
set_target_properties(libgit2package PROPERTIES C_STANDARD 90)
|
|
64
73
|
set_target_properties(libgit2package PROPERTIES C_EXTENSIONS OFF)
|
|
@@ -94,14 +103,23 @@ endif()
|
|
|
94
103
|
|
|
95
104
|
# support experimental features and functionality
|
|
96
105
|
|
|
97
|
-
configure_file(experimental.h.in "${PROJECT_BINARY_DIR}/
|
|
106
|
+
configure_file(experimental.h.in "${PROJECT_BINARY_DIR}/gen_headers/experimental.h")
|
|
98
107
|
|
|
99
|
-
# translate filenames in the
|
|
108
|
+
# translate filenames in the headers so that they match the install directory
|
|
100
109
|
# (allows for side-by-side installs of libgit2 and libgit2-experimental.)
|
|
101
110
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
foreach(HEADER_SOURCE ${SRC_H})
|
|
112
|
+
file(RELATIVE_PATH HEADER_RELATIVE ${PROJECT_SOURCE_DIR} ${HEADER_SOURCE})
|
|
113
|
+
string(REGEX REPLACE "^include\/git2" "include/${LIBGIT2_FILENAME}" HEADER_RELATIVE ${HEADER_RELATIVE})
|
|
114
|
+
|
|
115
|
+
file(READ "${HEADER_SOURCE}" HEADER_CONTENTS)
|
|
116
|
+
string(REGEX REPLACE "#include \"git2\/" "#include \"${LIBGIT2_FILENAME}/" HEADER_CONTENTS "${HEADER_CONTENTS}")
|
|
117
|
+
|
|
118
|
+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${HEADER_RELATIVE}.tmp" "${HEADER_CONTENTS}")
|
|
119
|
+
configure_file("${CMAKE_CURRENT_BINARY_DIR}/${HEADER_RELATIVE}.tmp" "${PROJECT_BINARY_DIR}/${HEADER_RELATIVE}" COPYONLY)
|
|
120
|
+
endforeach()
|
|
121
|
+
|
|
122
|
+
configure_file("${PROJECT_BINARY_DIR}/gen_headers/experimental.h" "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}/experimental.h" COPYONLY)
|
|
105
123
|
|
|
106
124
|
# cmake package targets
|
|
107
125
|
|
|
@@ -119,11 +137,11 @@ configure_file(config.cmake.in
|
|
|
119
137
|
install(FILES
|
|
120
138
|
"${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
|
|
121
139
|
"${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
|
|
122
|
-
DESTINATION "
|
|
140
|
+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
|
123
141
|
install(
|
|
124
142
|
EXPORT ${LIBGIT2_TARGETS_EXPORT_NAME}
|
|
125
143
|
NAMESPACE "${PROJECT_NAME}::"
|
|
126
|
-
DESTINATION "
|
|
144
|
+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
|
127
145
|
|
|
128
146
|
# Install
|
|
129
147
|
|
|
@@ -132,9 +150,7 @@ install(TARGETS libgit2package
|
|
|
132
150
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
133
151
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
134
152
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
135
|
-
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2/
|
|
136
|
-
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
|
|
137
|
-
install(FILES ${PROJECT_BINARY_DIR}/include/git2/experimental.h
|
|
138
|
-
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
|
|
139
153
|
install(FILES "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h"
|
|
140
154
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
155
|
+
install(DIRECTORY "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}"
|
|
156
|
+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
@@ -347,7 +347,7 @@ int git_attr_file__parse_buffer(
|
|
|
347
347
|
{
|
|
348
348
|
const char *scan = data, *context = NULL;
|
|
349
349
|
git_attr_rule *rule = NULL;
|
|
350
|
-
int error = 0;
|
|
350
|
+
int ignorecase = 0, error = 0;
|
|
351
351
|
|
|
352
352
|
/* If subdir file path, convert context for file paths */
|
|
353
353
|
if (attrs->entry && git_fs_path_root(attrs->entry->path) < 0 &&
|
|
@@ -379,6 +379,13 @@ int git_attr_file__parse_buffer(
|
|
|
379
379
|
continue;
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
+
if (repo &&
|
|
383
|
+
(error = git_repository__configmap_lookup(&ignorecase, repo, GIT_CONFIGMAP_IGNORECASE)) < 0)
|
|
384
|
+
goto out;
|
|
385
|
+
|
|
386
|
+
if (ignorecase)
|
|
387
|
+
rule->match.flags |= GIT_ATTR_FNMATCH_ICASE;
|
|
388
|
+
|
|
382
389
|
if (rule->match.flags & GIT_ATTR_FNMATCH_MACRO) {
|
|
383
390
|
/* TODO: warning if macro found in file below repo root */
|
|
384
391
|
if (!allow_macros)
|
|
@@ -482,7 +489,7 @@ bool git_attr_fnmatch__match(
|
|
|
482
489
|
*/
|
|
483
490
|
if (match->containing_dir) {
|
|
484
491
|
if (match->flags & GIT_ATTR_FNMATCH_ICASE) {
|
|
485
|
-
if (
|
|
492
|
+
if (git__prefixcmp_icase(path->path, match->containing_dir))
|
|
486
493
|
return 0;
|
|
487
494
|
} else {
|
|
488
495
|
if (git__prefixcmp(path->path, match->containing_dir))
|
|
@@ -804,7 +811,7 @@ int git_attr_fnmatch__parse(
|
|
|
804
811
|
}
|
|
805
812
|
|
|
806
813
|
if (context) {
|
|
807
|
-
char *slash = strrchr(context, '/');
|
|
814
|
+
const char *slash = strrchr(context, '/');
|
|
808
815
|
size_t len;
|
|
809
816
|
if (slash) {
|
|
810
817
|
/* include the slash for easier matching */
|
|
@@ -519,6 +519,12 @@ static int clone_local_into(
|
|
|
519
519
|
return error;
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
/* Propagate the source repository's object format to the target
|
|
523
|
+
* so that it can read the copied object database. */
|
|
524
|
+
if ((error = git_repository__set_objectformat(
|
|
525
|
+
repo, git_repository_oid_type(src))) < 0)
|
|
526
|
+
goto cleanup;
|
|
527
|
+
|
|
522
528
|
if (git_repository__item_path(&src_odb, src, GIT_REPOSITORY_ITEM_OBJECTS) < 0 ||
|
|
523
529
|
git_repository__item_path(&dst_odb, repo, GIT_REPOSITORY_ITEM_OBJECTS) < 0) {
|
|
524
530
|
error = -1;
|
|
@@ -817,8 +817,7 @@ int git_commit_graph_writer_add_index_file(
|
|
|
817
817
|
if (error < 0)
|
|
818
818
|
goto cleanup;
|
|
819
819
|
|
|
820
|
-
|
|
821
|
-
error = git_mwindow_get_pack(&p, idx_path, 0);
|
|
820
|
+
error = git_mwindow_get_pack(&p, idx_path, repo->oid_type);
|
|
822
821
|
if (error < 0)
|
|
823
822
|
goto cleanup;
|
|
824
823
|
|
|
@@ -1447,7 +1447,7 @@ int git_config_parse_bool(int *out, const char *value)
|
|
|
1447
1447
|
return 0;
|
|
1448
1448
|
}
|
|
1449
1449
|
|
|
1450
|
-
git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a boolean
|
|
1450
|
+
git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a boolean", value ? value : "(null)");
|
|
1451
1451
|
return -1;
|
|
1452
1452
|
}
|
|
1453
1453
|
|
|
@@ -1135,7 +1135,8 @@ static int config_file_write(
|
|
|
1135
1135
|
const char *value)
|
|
1136
1136
|
|
|
1137
1137
|
{
|
|
1138
|
-
char *orig_section = NULL, *section = NULL
|
|
1138
|
+
char *orig_section = NULL, *section = NULL;
|
|
1139
|
+
const char *orig_name, *name, *ldot;
|
|
1139
1140
|
git_str buf = GIT_STR_INIT, contents = GIT_STR_INIT;
|
|
1140
1141
|
git_config_parser parser = GIT_CONFIG_PARSER_INIT;
|
|
1141
1142
|
git_filebuf file = GIT_FILEBUF_INIT;
|
|
@@ -199,6 +199,7 @@ static int config_memory_get(git_config_backend *backend, const char *key, git_c
|
|
|
199
199
|
if ((error = git_config_list_get(&entry, memory_backend->config_list, key)) != 0)
|
|
200
200
|
return error;
|
|
201
201
|
|
|
202
|
+
git_config_list_incref(memory_backend->config_list);
|
|
202
203
|
*out = &entry->base;
|
|
203
204
|
return 0;
|
|
204
205
|
}
|
|
@@ -282,7 +282,8 @@ static int skip_bom(git_parse_ctx *parser)
|
|
|
282
282
|
/* '\"' -> '"' etc */
|
|
283
283
|
static int unescape_line(char **out, bool *is_multi, const char *ptr, int *quote_count)
|
|
284
284
|
{
|
|
285
|
-
char *str, *fixed
|
|
285
|
+
char *str, *fixed;
|
|
286
|
+
const char *esc;
|
|
286
287
|
size_t ptr_len = strlen(ptr), alloc_len;
|
|
287
288
|
|
|
288
289
|
*is_multi = false;
|
|
@@ -477,8 +477,12 @@ static int hdr_sz(
|
|
|
477
477
|
return -1;
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
+
if (shift >= (sizeof(size_t) * 8)) {
|
|
481
|
+
git_error_set(GIT_ERROR_INVALID, "delta header overflow");
|
|
482
|
+
return -1;
|
|
483
|
+
}
|
|
480
484
|
c = *d++;
|
|
481
|
-
r |= (c & 0x7f) << shift;
|
|
485
|
+
r |= ((size_t)(c & 0x7f)) << shift;
|
|
482
486
|
shift += 7;
|
|
483
487
|
} while (c & 0x80);
|
|
484
488
|
*delta = d;
|
|
@@ -28,7 +28,6 @@ struct git_diff_stats {
|
|
|
28
28
|
size_t files_changed;
|
|
29
29
|
size_t insertions;
|
|
30
30
|
size_t deletions;
|
|
31
|
-
size_t renames;
|
|
32
31
|
|
|
33
32
|
size_t max_name;
|
|
34
33
|
size_t max_filestat;
|
|
@@ -68,17 +67,19 @@ static int diff_file_stats_full_to_buf(
|
|
|
68
67
|
size_t common_dirlen;
|
|
69
68
|
int error;
|
|
70
69
|
|
|
71
|
-
padding = stats->max_name - strlen(old_path) - strlen(new_path);
|
|
72
|
-
|
|
73
70
|
if ((common_dirlen = git_fs_path_common_dirlen(old_path, new_path)) &&
|
|
74
71
|
common_dirlen <= INT_MAX) {
|
|
75
72
|
error = git_str_printf(out, " %.*s{%s"DIFF_RENAME_FILE_SEPARATOR"%s}",
|
|
76
73
|
(int) common_dirlen, old_path,
|
|
77
74
|
old_path + common_dirlen,
|
|
78
75
|
new_path + common_dirlen);
|
|
76
|
+
padding = stats->max_name + common_dirlen - strlen(old_path)
|
|
77
|
+
- strlen(new_path) - 2 - strlen(DIFF_RENAME_FILE_SEPARATOR);
|
|
79
78
|
} else {
|
|
80
79
|
error = git_str_printf(out, " %s" DIFF_RENAME_FILE_SEPARATOR "%s",
|
|
81
80
|
old_path, new_path);
|
|
81
|
+
padding = stats->max_name - strlen(old_path)
|
|
82
|
+
- strlen(new_path) - strlen(DIFF_RENAME_FILE_SEPARATOR);
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
if (error < 0)
|
|
@@ -89,9 +90,6 @@ static int diff_file_stats_full_to_buf(
|
|
|
89
90
|
goto on_error;
|
|
90
91
|
|
|
91
92
|
padding = stats->max_name - strlen(adddel_path);
|
|
92
|
-
|
|
93
|
-
if (stats->renames > 0)
|
|
94
|
-
padding += strlen(DIFF_RENAME_FILE_SEPARATOR);
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
if (git_str_putcn(out, ' ', padding) < 0 ||
|
|
@@ -210,14 +208,23 @@ int git_diff_get_stats(
|
|
|
210
208
|
if ((error = git_patch_from_diff(&patch, diff, i)) < 0)
|
|
211
209
|
break;
|
|
212
210
|
|
|
213
|
-
/*
|
|
211
|
+
/* Length calculation for renames mirrors the actual presentation format
|
|
212
|
+
* generated in diff_file_stats_full_to_buf; namelen is the full length of
|
|
213
|
+
* what will be printed, taking into account renames and common prefixes.
|
|
214
|
+
*/
|
|
214
215
|
delta = patch->delta;
|
|
215
|
-
|
|
216
|
-
/* TODO ugh */
|
|
217
216
|
namelen = strlen(delta->new_file.path);
|
|
218
|
-
if (delta->old_file.path &&
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
if (delta->old_file.path &&
|
|
218
|
+
strcmp(delta->old_file.path, delta->new_file.path) != 0) {
|
|
219
|
+
size_t common_dirlen;
|
|
220
|
+
if ((common_dirlen = git_fs_path_common_dirlen(delta->old_file.path, delta->new_file.path)) &&
|
|
221
|
+
common_dirlen <= INT_MAX) {
|
|
222
|
+
namelen += strlen(delta->old_file.path) + 2 +
|
|
223
|
+
strlen(DIFF_RENAME_FILE_SEPARATOR) - common_dirlen;
|
|
224
|
+
} else {
|
|
225
|
+
namelen += strlen(delta->old_file.path) +
|
|
226
|
+
strlen(DIFF_RENAME_FILE_SEPARATOR);
|
|
227
|
+
}
|
|
221
228
|
}
|
|
222
229
|
|
|
223
230
|
/* and, of course, count the line stats */
|