rugged 0.27.1 → 0.27.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '070298452794464c0fc2d749db1a74ac2575362c59ab6fd6f2ab12a60bb105f7'
4
- data.tar.gz: ef7f3d39e4cc27ef65226a7cd86dbd89ff05e1bd1c001df09124a202a0a56552
3
+ metadata.gz: 279547b58b2ddeab2a82b3c8956db7b1ba159ad77a0bd527834ef6a6003ebe9e
4
+ data.tar.gz: 1d941b494b23fd0fe8f0f36f461085a42f1a789d6cf3402ee8885f4623f57975
5
5
  SHA512:
6
- metadata.gz: 6c384b5065c2d66e87e0ad43e969fc1e3afc5a02fdec3fe8a4fab3d37c279cc225dee3246aeb38142ca098500006c28362c6082dceda1f75a9f692921b95188f
7
- data.tar.gz: bf3fff8373c5ce5763374f5ad9133ac8fa754b0787ed44e3b69c2d1e59ff6d379f5e687c20fd0d80178ed366f43bb5337f227c79f4c39511077b84c4764eae78
6
+ metadata.gz: afd3f7404f9888f844e88d345b6c82afecf95c9fbbe9fc7dbb48c8c1c6c8386a14b3711fedec9aaba17357b57ad4a6cc0350e1b72ba356059f84d8343d58db55
7
+ data.tar.gz: 796ead0476883663ba081ef0883d05dec3a2f8f9248327f32c998f96e6fd083329f85f6a9603a004b41a178b6c6dc13e0b463c75f19cd4d52fdf3874254cb07f
@@ -4,5 +4,5 @@
4
4
  # For full terms see the included LICENSE file.
5
5
 
6
6
  module Rugged
7
- Version = VERSION = '0.27.1'
7
+ Version = VERSION = '0.27.2'
8
8
  end
@@ -29,7 +29,7 @@ INCLUDE(CheckFunctionExists)
29
29
  INCLUDE(CheckSymbolExists)
30
30
  INCLUDE(CheckStructHasMember)
31
31
  INCLUDE(AddCFlagIfSupported)
32
- INCLUDE(FindPkgConfig)
32
+ INCLUDE(FindPkgLibraries)
33
33
  INCLUDE(FindThreads)
34
34
  INCLUDE(FindStatNsec)
35
35
  INCLUDE(IdeSplitSources)
@@ -0,0 +1,28 @@
1
+ INCLUDE(FindPkgConfig)
2
+
3
+ # This function will find and set up a pkg-config based module.
4
+ # If a pc-file was found, it will resolve library paths to
5
+ # absolute paths. Furthermore, the function will automatically
6
+ # fall back to use static libraries in case no dynamic libraries
7
+ # were found.
8
+ FUNCTION(FIND_PKGLIBRARIES prefix package)
9
+ PKG_CHECK_MODULES(${prefix} ${package})
10
+ IF(NOT ${prefix}_FOUND)
11
+ RETURN()
12
+ ENDIF()
13
+
14
+ FOREACH(LIBRARY ${${prefix}_LIBRARIES})
15
+ FIND_LIBRARY(${LIBRARY}_RESOLVED ${LIBRARY} PATHS ${${prefix}_LIBRARY_DIRS})
16
+ IF(${${LIBRARY}_RESOLVED} STREQUAL "${LIBRARY}_RESOLVED-NOTFOUND")
17
+ MESSAGE(FATAL_ERROR "could not resolve ${LIBRARY}")
18
+ ENDIF()
19
+ LIST(APPEND RESOLVED_LIBRARIES ${${LIBRARY}_RESOLVED})
20
+ ENDFOREACH(LIBRARY)
21
+
22
+ SET(${prefix}_FOUND 1 PARENT_SCOPE)
23
+ SET(${prefix}_LIBRARIES ${RESOLVED_LIBRARIES} PARENT_SCOPE)
24
+ SET(${prefix}_INCLUDE_DIRS ${${prefix}_INCLUDE_DIRS} PARENT_SCOPE)
25
+ SET(${prefix}_LDFLAGS ${${prefix}_LDFLAGS} PARENT_SCOPE)
26
+
27
+ MESSAGE(STATUS " Resolved libraries: ${RESOLVED_LIBRARIES}")
28
+ ENDFUNCTION()
@@ -7,10 +7,10 @@
7
7
  #ifndef INCLUDE_git_version_h__
8
8
  #define INCLUDE_git_version_h__
9
9
 
10
- #define LIBGIT2_VERSION "0.27.1"
10
+ #define LIBGIT2_VERSION "0.27.2"
11
11
  #define LIBGIT2_VER_MAJOR 0
12
12
  #define LIBGIT2_VER_MINOR 27
13
- #define LIBGIT2_VER_REVISION 1
13
+ #define LIBGIT2_VER_REVISION 2
14
14
  #define LIBGIT2_VER_PATCH 0
15
15
 
16
16
  #define LIBGIT2_SOVERSION 27
@@ -17,7 +17,6 @@ SET(LIBGIT2_INCLUDES
17
17
  "${libgit2_SOURCE_DIR}/src"
18
18
  "${libgit2_SOURCE_DIR}/include")
19
19
  SET(LIBGIT2_LIBS "")
20
- SET(LIBGIT2_LIBDIRS "")
21
20
 
22
21
  # Installation paths
23
22
  #
@@ -109,7 +108,6 @@ IF (WIN32 AND WINHTTP)
109
108
  ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/winhttp" "${libgit2_BINARY_DIR}/deps/winhttp")
110
109
  LIST(APPEND LIBGIT2_LIBS winhttp)
111
110
  LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/winhttp")
112
- LIST(APPEND LIBGIT2_LIBDIRS ${LIBWINHTTP_PATH})
113
111
  ELSE()
114
112
  LIST(APPEND LIBGIT2_LIBS "winhttp")
115
113
  LIST(APPEND LIBGIT2_PC_LIBS "-lwinhttp")
@@ -119,13 +117,11 @@ IF (WIN32 AND WINHTTP)
119
117
  LIST(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32")
120
118
  ELSE ()
121
119
  IF (CURL)
122
- PKG_CHECK_MODULES(CURL libcurl)
120
+ FIND_PKGLIBRARIES(CURL libcurl)
123
121
  ENDIF ()
124
-
125
122
  IF (CURL_FOUND)
126
123
  SET(GIT_CURL 1)
127
124
  LIST(APPEND LIBGIT2_INCLUDES ${CURL_INCLUDE_DIRS})
128
- LIST(APPEND LIBGIT2_LIBDIRS ${CURL_LIBRARY_DIRS})
129
125
  LIST(APPEND LIBGIT2_LIBS ${CURL_LIBRARIES})
130
126
  LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
131
127
  ENDIF()
@@ -282,15 +278,13 @@ ENDIF()
282
278
 
283
279
  # Optional external dependency: libssh2
284
280
  IF (USE_SSH)
285
- PKG_CHECK_MODULES(LIBSSH2 libssh2)
281
+ FIND_PKGLIBRARIES(LIBSSH2 libssh2)
286
282
  ENDIF()
287
283
  IF (LIBSSH2_FOUND)
288
284
  SET(GIT_SSH 1)
289
285
  LIST(APPEND LIBGIT2_INCLUDES ${LIBSSH2_INCLUDE_DIRS})
290
286
  LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES})
291
- LIST(APPEND LIBGIT2_LIBDIRS ${LIBSSH2_LIBRARY_DIRS})
292
287
  LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
293
- #SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} ${LIBSSH2_LDFLAGS}")
294
288
 
295
289
  CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
296
290
  IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS)
@@ -404,7 +398,6 @@ ENDIF()
404
398
  SET(LIBGIT2_OBJECTS ${LIBGIT2_OBJECTS} PARENT_SCOPE)
405
399
  SET(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
406
400
  SET(LIBGIT2_LIBS ${LIBGIT2_LIBS} PARENT_SCOPE)
407
- SET(LIBGIT2_LIBDIRS ${LIBGIT2_LIBDIRS} PARENT_SCOPE)
408
401
 
409
402
  IF(XCODE_VERSION)
410
403
  # This is required for Xcode to actually link the libgit2 library
@@ -414,7 +407,6 @@ IF(XCODE_VERSION)
414
407
  ENDIF()
415
408
 
416
409
  # Compile and link libgit2
417
- LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
418
410
  ADD_LIBRARY(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})
419
411
  TARGET_LINK_LIBRARIES(git2 ${LIBGIT2_LIBS})
420
412
 
@@ -633,6 +633,11 @@ int git_attr_fnmatch__parse(
633
633
  if (--spec->length == 0)
634
634
  return GIT_ENOTFOUND;
635
635
 
636
+ /* Remove trailing spaces. */
637
+ while (pattern[spec->length - 1] == ' ' || pattern[spec->length - 1] == '\t')
638
+ if (--spec->length == 0)
639
+ return GIT_ENOTFOUND;
640
+
636
641
  if (pattern[spec->length - 1] == '/') {
637
642
  spec->length--;
638
643
  spec->flags = spec->flags | GIT_ATTR_FNMATCH_DIRECTORY;
@@ -130,6 +130,7 @@ char git_diff_status_char(git_delta_t status)
130
130
  case GIT_DELTA_COPIED: code = 'C'; break;
131
131
  case GIT_DELTA_IGNORED: code = 'I'; break;
132
132
  case GIT_DELTA_UNTRACKED: code = '?'; break;
133
+ case GIT_DELTA_TYPECHANGE: code = 'T'; break;
133
134
  case GIT_DELTA_UNREADABLE: code = 'X'; break;
134
135
  default: code = ' '; break;
135
136
  }
@@ -10,6 +10,9 @@
10
10
  #include <memory.h>
11
11
  #include <stdio.h>
12
12
  #include <stdlib.h>
13
+ #ifdef __unix__
14
+ #include <sys/types.h> /* make sure macros like _BIG_ENDIAN visible */
15
+ #endif
13
16
  #endif
14
17
 
15
18
  #ifdef SHA1DC_CUSTOM_INCLUDE_SHA1_C
@@ -23,6 +26,13 @@
23
26
  #include "sha1.h"
24
27
  #include "ubc_check.h"
25
28
 
29
+ #if (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \
30
+ defined(i386) || defined(__i386) || defined(__i386__) || defined(__i486__) || \
31
+ defined(__i586__) || defined(__i686__) || defined(_M_IX86) || defined(__X86__) || \
32
+ defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__) || \
33
+ defined(__386) || defined(_M_X64) || defined(_M_AMD64))
34
+ #define SHA1DC_ON_INTEL_LIKE_PROCESSOR
35
+ #endif
26
36
 
27
37
  /*
28
38
  Because Little-Endian architectures are most common,
@@ -32,29 +42,70 @@
32
42
  If you are compiling on a big endian platform and your compiler does not define one of these,
33
43
  you will have to add whatever macros your tool chain defines to indicate Big-Endianness.
34
44
  */
35
- #ifdef SHA1DC_BIGENDIAN
36
- #undef SHA1DC_BIGENDIAN
37
- #endif
38
45
 
39
- #if (defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || defined(__BYTE_ORDER__))
40
-
41
- #if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \
42
- (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
43
- (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) )
46
+ #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
47
+ /*
48
+ * Should detect Big Endian under GCC since at least 4.6.0 (gcc svn
49
+ * rev #165881). See
50
+ * https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
51
+ *
52
+ * This also works under clang since 3.2, it copied the GCC-ism. See
53
+ * clang.git's 3b198a97d2 ("Preprocessor: add __BYTE_ORDER__
54
+ * predefined macro", 2012-07-27)
55
+ */
56
+ #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
44
57
  #define SHA1DC_BIGENDIAN
45
58
  #endif
46
59
 
47
- #else
48
-
49
- #if (defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \
50
- defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
51
- defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \
52
- defined(__sparc))
60
+ /* Not under GCC-alike */
61
+ #elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN)
62
+ /*
63
+ * Should detect Big Endian under glibc.git since 14245eb70e ("entered
64
+ * into RCS", 1992-11-25). Defined in <endian.h> which will have been
65
+ * brought in by standard headers. See glibc.git and
66
+ * https://sourceforge.net/p/predef/wiki/Endianness/
67
+ */
68
+ #if __BYTE_ORDER == __BIG_ENDIAN
53
69
  #define SHA1DC_BIGENDIAN
54
70
  #endif
55
71
 
72
+ /* Not under GCC-alike or glibc */
73
+ #elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
74
+ /*
75
+ * *BSD and newlib (embeded linux, cygwin, etc).
76
+ * the defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN) part prevents
77
+ * this condition from matching with Solaris/sparc.
78
+ * (Solaris defines only one endian macro)
79
+ */
80
+ #if _BYTE_ORDER == _BIG_ENDIAN
81
+ #define SHA1DC_BIGENDIAN
56
82
  #endif
57
83
 
84
+ /* Not under GCC-alike or glibc or *BSD or newlib */
85
+ #elif (defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
86
+ defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \
87
+ defined(__sparc))
88
+ /*
89
+ * Should define Big Endian for a whitelist of known processors. See
90
+ * https://sourceforge.net/p/predef/wiki/Endianness/ and
91
+ * http://www.oracle.com/technetwork/server-storage/solaris/portingtosolaris-138514.html
92
+ */
93
+ #define SHA1DC_BIGENDIAN
94
+
95
+ /* Not under GCC-alike or glibc or *BSD or newlib or <processor whitelist> */
96
+ #elif defined(SHA1DC_ON_INTEL_LIKE_PROCESSOR)
97
+ /*
98
+ * As a last resort before we do anything else we're not 100% sure
99
+ * about below, we blacklist specific processors here. We could add
100
+ * more, see e.g. https://wiki.debian.org/ArchitectureSpecificsMemo
101
+ */
102
+ #else /* Not under GCC-alike or glibc or *BSD or newlib or <processor whitelist> or <processor blacklist> */
103
+
104
+ /* We do nothing more here for now */
105
+ /*#error "Uncomment this to see if you fall through all the detection"*/
106
+
107
+ #endif /* Big Endian detection */
108
+
58
109
  #if (defined(SHA1DC_FORCE_LITTLEENDIAN) && defined(SHA1DC_BIGENDIAN))
59
110
  #undef SHA1DC_BIGENDIAN
60
111
  #endif
@@ -63,15 +114,8 @@
63
114
  #endif
64
115
  /*ENDIANNESS SELECTION*/
65
116
 
66
- #if (defined SHA1DC_FORCE_UNALIGNED_ACCESS || \
67
- defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \
68
- defined(i386) || defined(__i386) || defined(__i386__) || defined(__i486__) || \
69
- defined(__i586__) || defined(__i686__) || defined(_M_IX86) || defined(__X86__) || \
70
- defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__) || \
71
- defined(__386) || defined(_M_X64) || defined(_M_AMD64))
72
-
117
+ #if defined(SHA1DC_FORCE_UNALIGNED_ACCESS) || defined(SHA1DC_ON_INTEL_LIKE_PROCESSOR)
73
118
  #define SHA1DC_ALLOW_UNALIGNED_ACCESS
74
-
75
119
  #endif /*UNALIGNMENT DETECTION*/
76
120
 
77
121
 
@@ -918,7 +962,7 @@ static void sha1recompress_fast_ ## t (uint32_t ihvin[5], uint32_t ihvout[5], co
918
962
 
919
963
  #ifdef _MSC_VER
920
964
  #pragma warning(push)
921
- #pragma warning(disable: 4127) /* Complier complains about the checks in the above macro being constant. */
965
+ #pragma warning(disable: 4127) /* Compiler complains about the checks in the above macro being constant. */
922
966
  #endif
923
967
 
924
968
  #ifdef DOSTORESTATE0
@@ -213,16 +213,6 @@ static int parse_ignore_file(
213
213
  if (ignore_case)
214
214
  match->flags |= GIT_ATTR_FNMATCH_ICASE;
215
215
 
216
- while (match->length > 0) {
217
- if (match->pattern[match->length - 1] == ' ' ||
218
- match->pattern[match->length - 1] == '\t') {
219
- match->pattern[match->length - 1] = 0;
220
- match->length --;
221
- } else {
222
- break;
223
- }
224
- }
225
-
226
216
  scan = git__next_line(scan);
227
217
 
228
218
  /*
@@ -157,6 +157,7 @@ static void impl__free(git_odb_backend *_backend)
157
157
  {
158
158
  struct memory_packer_db *db = (struct memory_packer_db *)_backend;
159
159
 
160
+ git_mempack_reset(_backend);
160
161
  git_oidmap_free(db->objects);
161
162
  git__free(db);
162
163
  }
@@ -1603,6 +1603,8 @@ static int create_new_reflog_file(const char *filepath)
1603
1603
 
1604
1604
  GIT_INLINE(int) retrieve_reflog_path(git_buf *path, git_repository *repo, const char *name)
1605
1605
  {
1606
+ if (strcmp(name, GIT_HEAD_FILE) == 0)
1607
+ return git_buf_join3(path, '/', repo->gitdir, GIT_REFLOG_DIR, name);
1606
1608
  return git_buf_join3(path, '/', repo->commondir, GIT_REFLOG_DIR, name);
1607
1609
  }
1608
1610
 
@@ -115,6 +115,9 @@ int git_reference_dup(git_reference **dest, git_reference *source)
115
115
 
116
116
  GITERR_CHECK_ALLOC(*dest);
117
117
 
118
+ (*dest)->db = source->db;
119
+ GIT_REFCOUNT_INC((*dest)->db);
120
+
118
121
  return 0;
119
122
  }
120
123
 
@@ -116,6 +116,10 @@ int git_reference_lookup_resolved(
116
116
  * with the given name pointing to the reference pointed to by
117
117
  * the file. If it is not a symbolic reference, it will return
118
118
  * the resolved reference.
119
+ *
120
+ * Note that because the refdb is not involved for symbolic references, they
121
+ * won't be owned, hence you should either not make the returned reference
122
+ * 'externally visible', or perform the lookup before returning it to the user.
119
123
  */
120
124
  int git_reference__read_head(
121
125
  git_reference **out,
@@ -304,6 +304,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
304
304
  git_buf buf = GIT_BUF_INIT;
305
305
  size_t j, pos;
306
306
  git_remote_head key;
307
+ git_refspec *cur;
307
308
 
308
309
  const char* formatters[] = {
309
310
  GIT_REFS_DIR "%s",
@@ -312,7 +313,9 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
312
313
  NULL
313
314
  };
314
315
 
315
- git_refspec *cur = git__calloc(1, sizeof(git_refspec));
316
+ assert(out && spec && refs);
317
+
318
+ cur = git__calloc(1, sizeof(git_refspec));
316
319
  GITERR_CHECK_ALLOC(cur);
317
320
 
318
321
  cur->force = spec->force;
@@ -237,7 +237,7 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
237
237
  goto on_error;
238
238
 
239
239
  /* only write for non-anonymous remotes */
240
- if (name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
240
+ if (repo && name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
241
241
  goto on_error;
242
242
 
243
243
  if (repo && (error = lookup_remote_prune_config(remote, config_ro, name)) < 0)
@@ -375,20 +375,6 @@ static int add_parents_to_list(git_revwalk *walk, git_commit_list_node *commit,
375
375
  return 0;
376
376
  }
377
377
 
378
- static int everybody_uninteresting(git_commit_list *orig)
379
- {
380
- git_commit_list *list = orig;
381
-
382
- while (list) {
383
- git_commit_list_node *commit = list->item;
384
- list = list->next;
385
- if (!commit->uninteresting)
386
- return 0;
387
- }
388
-
389
- return 1;
390
- }
391
-
392
378
  /* How many unintersting commits we want to look at after we run out of interesting ones */
393
379
  #define SLOP 5
394
380
 
@@ -398,16 +384,15 @@ static int still_interesting(git_commit_list *list, int64_t time, int slop)
398
384
  if (!list)
399
385
  return 0;
400
386
 
401
- /*
402
- * If the destination list has commits with an earlier date
403
- * than our source we want to continue looking.
404
- */
405
- if (time <= list->item->time)
406
- return SLOP;
407
-
408
- /* If we find interesting commits, we reset the slop count */
409
- if (!everybody_uninteresting(list))
410
- return SLOP;
387
+ for (; list; list = list->next) {
388
+ /*
389
+ * If the destination list has commits with an earlier date than
390
+ * our source or if it still contains interesting commits we
391
+ * want to continue looking.
392
+ */
393
+ if (!list->item->uninteresting || list->item->time > time)
394
+ return SLOP;
395
+ }
411
396
 
412
397
  /* Everything's uninteresting, reduce the count */
413
398
  return slop - 1;
@@ -104,7 +104,8 @@ int git_openssl_stream_global_init(void)
104
104
  ssl_opts |= SSL_OP_NO_COMPRESSION;
105
105
  #endif
106
106
 
107
- #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
107
+ #if OPENSSL_VERSION_NUMBER < 0x10100000L || \
108
+ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
108
109
  SSL_load_error_strings();
109
110
  OpenSSL_add_ssl_algorithms();
110
111
  #else
@@ -31,7 +31,8 @@ extern int git_openssl__set_cert_location(const char *file, const char *path);
31
31
 
32
32
 
33
33
 
34
- # if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
34
+ # if OPENSSL_VERSION_NUMBER < 0x10100000L || \
35
+ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
35
36
 
36
37
  GIT_INLINE(BIO_METHOD*) BIO_meth_new(int type, const char *name)
37
38
  {
@@ -91,7 +91,7 @@ __KHASH_IMPL(
91
91
 
92
92
  static int submodule_alloc(git_submodule **out, git_repository *repo, const char *name);
93
93
  static git_config_backend *open_gitmodules(git_repository *repo, int gitmod);
94
- static git_config *gitmodules_snapshot(git_repository *repo);
94
+ static int gitmodules_snapshot(git_config **snap, git_repository *repo);
95
95
  static int get_url_base(git_buf *url, git_repository *repo);
96
96
  static int lookup_head_remote_key(git_buf *remote_key, git_repository *repo);
97
97
  static int lookup_default_remote(git_remote **remote, git_repository *repo);
@@ -186,6 +186,13 @@ static int load_submodule_names(git_strmap *out, git_repository *repo, git_confi
186
186
  fdot = strchr(entry->name, '.');
187
187
  ldot = strrchr(entry->name, '.');
188
188
 
189
+ if (git_strmap_exists(out, entry->value)) {
190
+ giterr_set(GITERR_SUBMODULE,
191
+ "duplicated submodule path '%s'", entry->value);
192
+ error = -1;
193
+ goto out;
194
+ }
195
+
189
196
  git_buf_clear(&buf);
190
197
  git_buf_put(&buf, fdot + 1, ldot - fdot - 1);
191
198
  isvalid = git_submodule_name_is_valid(repo, buf.ptr, 0);
@@ -544,8 +551,11 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
544
551
  data.map = map;
545
552
  data.repo = repo;
546
553
 
547
- if ((mods = gitmodules_snapshot(repo)) == NULL)
554
+ if ((error = gitmodules_snapshot(&mods, repo)) < 0) {
555
+ if (error == GIT_ENOTFOUND)
556
+ error = 0;
548
557
  goto cleanup;
558
+ }
549
559
 
550
560
  data.mods = mods;
551
561
  if ((error = git_config_foreach(
@@ -1552,7 +1562,8 @@ int git_submodule_reload(git_submodule *sm, int force)
1552
1562
 
1553
1563
  if (!git_repository_is_bare(sm->repo)) {
1554
1564
  /* refresh config data */
1555
- mods = gitmodules_snapshot(sm->repo);
1565
+ if ((error = gitmodules_snapshot(&mods, sm->repo)) < 0 && error != GIT_ENOTFOUND)
1566
+ return error;
1556
1567
  if (mods != NULL) {
1557
1568
  error = submodule_read_config(sm, mods);
1558
1569
  git_config_free(mods);
@@ -1962,32 +1973,37 @@ static int submodule_load_from_wd_lite(git_submodule *sm)
1962
1973
  }
1963
1974
 
1964
1975
  /**
1965
- * Returns a snapshot of $WORK_TREE/.gitmodules.
1976
+ * Requests a snapshot of $WORK_TREE/.gitmodules.
1966
1977
  *
1967
- * We ignore any errors and just pretend the file isn't there.
1978
+ * Returns GIT_ENOTFOUND in case no .gitmodules file exist
1968
1979
  */
1969
- static git_config *gitmodules_snapshot(git_repository *repo)
1980
+ static int gitmodules_snapshot(git_config **snap, git_repository *repo)
1970
1981
  {
1971
1982
  const char *workdir = git_repository_workdir(repo);
1972
- git_config *mods = NULL, *snap = NULL;
1983
+ git_config *mods = NULL;
1973
1984
  git_buf path = GIT_BUF_INIT;
1985
+ int error;
1974
1986
 
1975
- if (workdir != NULL) {
1976
- if (git_buf_joinpath(&path, workdir, GIT_MODULES_FILE) != 0)
1977
- return NULL;
1987
+ if (!workdir)
1988
+ return GIT_ENOTFOUND;
1978
1989
 
1979
- if (git_config_open_ondisk(&mods, path.ptr) < 0)
1980
- mods = NULL;
1981
- }
1990
+ if ((error = git_buf_joinpath(&path, workdir, GIT_MODULES_FILE)) < 0)
1991
+ return error;
1982
1992
 
1983
- git_buf_free(&path);
1993
+ if ((error = git_config_open_ondisk(&mods, path.ptr)) < 0)
1994
+ goto cleanup;
1984
1995
 
1985
- if (mods) {
1986
- git_config_snapshot(&snap, mods);
1996
+ if ((error = git_config_snapshot(snap, mods)) < 0)
1997
+ goto cleanup;
1998
+
1999
+ error = 0;
2000
+
2001
+ cleanup:
2002
+ if (mods)
1987
2003
  git_config_free(mods);
1988
- }
2004
+ git_buf_free(&path);
1989
2005
 
1990
- return snap;
2006
+ return error;
1991
2007
  }
1992
2008
 
1993
2009
  static git_config_backend *open_gitmodules(
@@ -510,8 +510,14 @@ static int local_counting(int stage, unsigned int current, unsigned int total, v
510
510
  static int foreach_reference_cb(git_reference *reference, void *payload)
511
511
  {
512
512
  git_revwalk *walk = (git_revwalk *)payload;
513
+ int error;
514
+
515
+ if (git_reference_type(reference) != GIT_REF_OID) {
516
+ git_reference_free(reference);
517
+ return 0;
518
+ }
513
519
 
514
- int error = git_revwalk_hide(walk, git_reference_target(reference));
520
+ error = git_revwalk_hide(walk, git_reference_target(reference));
515
521
  /* The reference is in the local repository, so the target may not
516
522
  * exist on the remote. It also may not be a commit. */
517
523
  if (error == GIT_ENOTFOUND || error == GITERR_INVALID) {
@@ -212,6 +212,7 @@ static void ssh_stream_free(git_smart_subtransport_stream *stream)
212
212
  }
213
213
 
214
214
  if (s->session) {
215
+ libssh2_session_disconnect(s->session, "closing transport");
215
216
  libssh2_session_free(s->session);
216
217
  s->session = NULL;
217
218
  }
@@ -489,7 +490,7 @@ static int _git_ssh_session_create(
489
490
  }
490
491
 
491
492
  do {
492
- rc = libssh2_session_startup(s, socket->s);
493
+ rc = libssh2_session_handshake(s, socket->s);
493
494
  } while (LIBSSH2_ERROR_EAGAIN == rc || LIBSSH2_ERROR_TIMEOUT == rc);
494
495
 
495
496
  if (rc != LIBSSH2_ERROR_NONE) {
@@ -10,7 +10,12 @@
10
10
  #include "common.h"
11
11
 
12
12
  #ifdef GIT_WIN32
13
+ # include "win32/utf-conv.h"
13
14
  # include "win32/w32_buffer.h"
15
+
16
+ # ifdef HAVE_QSORT_S
17
+ # include <search.h>
18
+ # endif
14
19
  #endif
15
20
 
16
21
  #ifdef _MSC_VER
@@ -131,7 +131,7 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
131
131
  goto out;
132
132
  }
133
133
 
134
- if ((wt = git__calloc(1, sizeof(struct git_repository))) == NULL) {
134
+ if ((wt = git__calloc(1, sizeof(*wt))) == NULL) {
135
135
  error = -1;
136
136
  goto out;
137
137
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugged
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.1
4
+ version: 0.27.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-29 00:00:00.000000000 Z
12
+ date: 2018-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -128,6 +128,7 @@ files:
128
128
  - vendor/libgit2/cmake/Modules/FindGSSAPI.cmake
129
129
  - vendor/libgit2/cmake/Modules/FindHTTP_Parser.cmake
130
130
  - vendor/libgit2/cmake/Modules/FindIconv.cmake
131
+ - vendor/libgit2/cmake/Modules/FindPkgLibraries.cmake
131
132
  - vendor/libgit2/cmake/Modules/FindSecurity.cmake
132
133
  - vendor/libgit2/cmake/Modules/FindStatNsec.cmake
133
134
  - vendor/libgit2/cmake/Modules/IdeSplitSources.cmake