rugged 0.22.1b1 → 0.22.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
  SHA1:
3
- metadata.gz: a920e7f6ad886a0730f1b80b91990956469eb3c8
4
- data.tar.gz: bc69152690eeea81ab3f2e0749a967de27b3107c
3
+ metadata.gz: abca236e3268bc314b36598c2745031738e9711b
4
+ data.tar.gz: dd4156ca02aff6e7cec599fd53f99d945080e7cc
5
5
  SHA512:
6
- metadata.gz: f26e34ae5df319b467d5348039255f0d4e1c8d885b6d11ec65511664b1e2a1d468369305dd383ab8084bc8566f12ab95caa2cade4698f9742d0d69ffff338323
7
- data.tar.gz: e38f35f6abf4d6f08797c966c7e3a40508b771ed3f29c72e1dac56f4787c981ff9848a25142ff057924a2a53d139f22f33fa84f0b0e4a546951697e0c6917330
6
+ metadata.gz: 6d673c0721ec99e5589219ce2c6a21791d6ae37536888c36c17ff888dc6760d08f5d7f0c6d8fc91a1558ebecb1ba33fdb63c6e67ce744bdb63d5c3b3a3da1a8f
7
+ data.tar.gz: ca34fafae0486a29f7a015f12fc7f0a51fca43ad3251231d9f109966c327601f5736a4d2f9c0db2891ad86ceb6d985f17ab524afb75f6b093c7af82084d07bcc
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.22.1b1'
2
+ Version = VERSION = '0.22.2'
3
3
  end
@@ -42,7 +42,6 @@ OPTION( VALGRIND "Configure build for valgrind" OFF )
42
42
 
43
43
  IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
44
44
  SET( USE_ICONV ON )
45
- ADD_DEFINITIONS(-DGIT_COMMON_CRYPTO)
46
45
  ENDIF()
47
46
 
48
47
  IF(MSVC)
@@ -172,6 +171,8 @@ ENDIF()
172
171
  IF (WIN32 AND NOT MINGW AND NOT SHA1_TYPE STREQUAL "builtin")
173
172
  ADD_DEFINITIONS(-DWIN32_SHA1)
174
173
  FILE(GLOB SRC_SHA1 src/hash/hash_win32.c)
174
+ ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
175
+ ADD_DEFINITIONS(-DGIT_COMMON_CRYPTO)
175
176
  ELSEIF (OPENSSL_FOUND AND NOT SHA1_TYPE STREQUAL "builtin")
176
177
  ADD_DEFINITIONS(-DOPENSSL_SHA1)
177
178
  IF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
@@ -217,7 +218,8 @@ IF (USE_SSH)
217
218
  ENDIF()
218
219
  IF (LIBSSH2_FOUND)
219
220
  ADD_DEFINITIONS(-DGIT_SSH)
220
- INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIR})
221
+ INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIRS})
222
+ LINK_DIRECTORIES(${LIBSSH2_LIBRARY_DIRS})
221
223
  SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} libssh2")
222
224
  SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
223
225
  ENDIF()
@@ -342,8 +342,8 @@ GIT_EXTERN(int) git_repository_head_unborn(git_repository *repo);
342
342
  /**
343
343
  * Check if a repository is empty
344
344
  *
345
- * An empty repository has just been initialized and contains
346
- * no references.
345
+ * An empty repository has just been initialized and contains no references
346
+ * apart from HEAD, which must be pointing to the unborn master branch.
347
347
  *
348
348
  * @param repo Repo to test
349
349
  * @return 1 if the repository is empty, 0 if it isn't, error code
@@ -7,6 +7,9 @@
7
7
  #ifndef INCLUDE_sys_git_repository_h__
8
8
  #define INCLUDE_sys_git_repository_h__
9
9
 
10
+ #include "git2/common.h"
11
+ #include "git2/types.h"
12
+
10
13
  /**
11
14
  * @file git2/sys/repository.h
12
15
  * @brief Git repository custom implementation routines
@@ -53,7 +56,7 @@ GIT_EXTERN(void) git_repository__cleanup(git_repository *repo);
53
56
  *
54
57
  * @param repo A repository object
55
58
  * @param recurse_submodules Should submodules be updated recursively
56
- * @returrn 0 on success, < 0 on error
59
+ * @return 0 on success, < 0 on error
57
60
  */
58
61
  GIT_EXTERN(int) git_repository_reinit_filesystem(
59
62
  git_repository *repo,
@@ -37,4 +37,6 @@ typedef struct git_stream {
37
37
  void (*free)(struct git_stream *);
38
38
  } git_stream;
39
39
 
40
+ GIT_END_DECL
41
+
40
42
  #endif
@@ -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.22.0"
10
+ #define LIBGIT2_VERSION "0.22.2"
11
11
  #define LIBGIT2_VER_MAJOR 0
12
12
  #define LIBGIT2_VER_MINOR 22
13
- #define LIBGIT2_VER_REVISION 0
13
+ #define LIBGIT2_VER_REVISION 2
14
14
 
15
15
  #define LIBGIT2_SOVERSION 22
16
16
 
@@ -138,8 +138,13 @@ int git_branch_delete(git_reference *branch)
138
138
  if (git_reference_delete(branch) < 0)
139
139
  goto on_error;
140
140
 
141
- if (git_reflog_delete(git_reference_owner(branch), git_reference_name(branch)) < 0)
141
+ if ((error = git_reflog_delete(git_reference_owner(branch), git_reference_name(branch))) < 0) {
142
+ if (error == GIT_ENOTFOUND) {
143
+ giterr_clear();
144
+ error = 0;
145
+ }
142
146
  goto on_error;
147
+ }
143
148
 
144
149
  error = 0;
145
150
 
@@ -191,7 +191,10 @@ bool git_buf_text_is_binary(const git_buf *buf)
191
191
  while (scan < end) {
192
192
  unsigned char c = *scan++;
193
193
 
194
- if (c > 0x1F && c < 0x7F)
194
+ /* Printable characters are those above SPACE (0x1F) excluding DEL,
195
+ * and including BS, ESC and FF.
196
+ */
197
+ if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014')
195
198
  printable++;
196
199
  else if (c == '\0')
197
200
  return true;
@@ -1190,7 +1190,7 @@ static int checkout_verify_paths(
1190
1190
 
1191
1191
  if (action & ~CHECKOUT_ACTION__REMOVE) {
1192
1192
  if (!git_path_isvalid(repo, delta->new_file.path, flags)) {
1193
- giterr_set(GITERR_CHECKOUT, "Cannot checkout to invalid path '%s'", delta->old_file.path);
1193
+ giterr_set(GITERR_CHECKOUT, "Cannot checkout to invalid path '%s'", delta->new_file.path);
1194
1194
  return -1;
1195
1195
  }
1196
1196
  }
@@ -2212,6 +2212,7 @@ static void checkout_data_clear(checkout_data *data)
2212
2212
  git__free(data->pfx);
2213
2213
  data->pfx = NULL;
2214
2214
 
2215
+ git_buf_free(&data->last_mkdir);
2215
2216
  git_buf_free(&data->path);
2216
2217
  git_buf_free(&data->tmp);
2217
2218
 
@@ -33,6 +33,7 @@
33
33
  # include <direct.h>
34
34
  # include <winsock2.h>
35
35
  # include <windows.h>
36
+ # include <ws2tcpip.h>
36
37
  # include "win32/msvc-compat.h"
37
38
  # include "win32/mingw-compat.h"
38
39
  # include "win32/error.h"
@@ -1284,6 +1284,7 @@ static int config_parse(git_strmap *values, diskfile_backend *cfg_file, struct r
1284
1284
  if (result == 0) {
1285
1285
  result = config_parse(values, cfg_file, r, level, depth+1);
1286
1286
  r = git_array_get(cfg_file->readers, index);
1287
+ reader = git_array_get(cfg_file->readers, reader_idx);
1287
1288
  }
1288
1289
  else if (result == GIT_ENOTFOUND) {
1289
1290
  giterr_clear();
@@ -822,7 +822,8 @@ int git_patch__invoke_callbacks(
822
822
  for (i = 0; !error && i < git_array_size(patch->hunks); ++i) {
823
823
  diff_patch_hunk *h = git_array_get(patch->hunks, i);
824
824
 
825
- error = hunk_cb(patch->delta, &h->hunk, payload);
825
+ if (hunk_cb)
826
+ error = hunk_cb(patch->delta, &h->hunk, payload);
826
827
 
827
828
  if (!line_cb)
828
829
  continue;
@@ -330,7 +330,7 @@ int git_futils_mkdir_withperf(
330
330
  {
331
331
  int error = -1;
332
332
  git_buf make_path = GIT_BUF_INIT;
333
- ssize_t root = 0, min_root_len;
333
+ ssize_t root = 0, min_root_len, root_len;
334
334
  char lastch = '/', *tail;
335
335
  struct stat st;
336
336
 
@@ -343,22 +343,29 @@ int git_futils_mkdir_withperf(
343
343
  goto done;
344
344
  }
345
345
 
346
- /* remove trailing slashes on path */
347
- while (make_path.ptr[make_path.size - 1] == '/') {
348
- make_path.size--;
349
- make_path.ptr[make_path.size] = '\0';
350
- }
346
+ /* Trim trailing slashes (except the root) */
347
+ if ((root_len = git_path_root(make_path.ptr)) < 0)
348
+ root_len = 0;
349
+ else
350
+ root_len++;
351
+
352
+ while (make_path.size > (size_t)root_len &&
353
+ make_path.ptr[make_path.size - 1] == '/')
354
+ make_path.ptr[--make_path.size] = '\0';
351
355
 
352
356
  /* if we are not supposed to made the last element, truncate it */
353
357
  if ((flags & GIT_MKDIR_SKIP_LAST2) != 0) {
354
- git_buf_rtruncate_at_char(&make_path, '/');
358
+ git_path_dirname_r(&make_path, make_path.ptr);
355
359
  flags |= GIT_MKDIR_SKIP_LAST;
356
360
  }
357
- if ((flags & GIT_MKDIR_SKIP_LAST) != 0)
358
- git_buf_rtruncate_at_char(&make_path, '/');
361
+ if ((flags & GIT_MKDIR_SKIP_LAST) != 0) {
362
+ git_path_dirname_r(&make_path, make_path.ptr);
363
+ }
359
364
 
360
- /* if nothing left after truncation, then we're done! */
361
- if (!make_path.size) {
365
+ /* We were either given the root path (or trimmed it to
366
+ * the root), we don't have anything to do.
367
+ */
368
+ if (make_path.size <= (size_t)root_len) {
362
369
  error = 0;
363
370
  goto done;
364
371
  }
@@ -292,6 +292,9 @@ static void index_entry_reuc_free(git_index_reuc_entry *reuc)
292
292
 
293
293
  static void index_entry_free(git_index_entry *entry)
294
294
  {
295
+ if (!entry)
296
+ return;
297
+
295
298
  memset(&entry->id, 0, sizeof(entry->id));
296
299
  git__free(entry);
297
300
  }
@@ -289,6 +289,7 @@ static int store_object(git_indexer *idx)
289
289
  k = kh_put(oid, idx->pack->idx_cache, &pentry->sha1, &error);
290
290
  if (!error) {
291
291
  git__free(pentry);
292
+ giterr_set(GITERR_INDEXER, "cannot handle duplicate objects in pack");
292
293
  goto on_error;
293
294
  }
294
295
 
@@ -7,11 +7,10 @@
7
7
 
8
8
  #ifdef GIT_SSL
9
9
 
10
- #include <openssl/ssl.h>
11
- #include <openssl/err.h>
12
- #include <openssl/x509v3.h>
13
-
14
10
  #include <ctype.h>
11
+ #include <sys/types.h>
12
+ #include <sys/socket.h>
13
+ #include <netinet/in.h>
15
14
 
16
15
  #include "global.h"
17
16
  #include "posix.h"
@@ -20,6 +19,10 @@
20
19
  #include "netops.h"
21
20
  #include "git2/transport.h"
22
21
 
22
+ #include <openssl/ssl.h>
23
+ #include <openssl/err.h>
24
+ #include <openssl/x509v3.h>
25
+
23
26
  static int ssl_set_error(SSL *ssl, int error)
24
27
  {
25
28
  int err;
@@ -56,6 +56,7 @@ static git_pack_cache_entry *new_cache_object(git_rawobj *source)
56
56
  if (!e)
57
57
  return NULL;
58
58
 
59
+ git_atomic_inc(&e->refcount);
59
60
  memcpy(&e->raw, source, sizeof(git_rawobj));
60
61
 
61
62
  return e;
@@ -145,7 +146,11 @@ static void free_lowest_entry(git_pack_cache *cache)
145
146
  }
146
147
  }
147
148
 
148
- static int cache_add(git_pack_cache *cache, git_rawobj *base, git_off_t offset)
149
+ static int cache_add(
150
+ git_pack_cache_entry **cached_out,
151
+ git_pack_cache *cache,
152
+ git_rawobj *base,
153
+ git_off_t offset)
149
154
  {
150
155
  git_pack_cache_entry *entry;
151
156
  int error, exists = 0;
@@ -171,6 +176,8 @@ static int cache_add(git_pack_cache *cache, git_rawobj *base, git_off_t offset)
171
176
  assert(error != 0);
172
177
  kh_value(cache->entries, k) = entry;
173
178
  cache->memory_used += entry->raw.len;
179
+
180
+ *cached_out = entry;
174
181
  }
175
182
  git_mutex_unlock(&cache->lock);
176
183
  /* Somebody beat us to adding it into the cache */
@@ -699,7 +706,7 @@ int git_packfile_unpack(
699
706
  * long as it's not already the cached one.
700
707
  */
701
708
  if (!cached)
702
- free_base = !!cache_add(&p->bases, obj, elem->base_key);
709
+ free_base = !!cache_add(&cached, &p->bases, obj, elem->base_key);
703
710
 
704
711
  elem = &stack[elem_pos - 1];
705
712
  curpos = elem->offset;
@@ -296,6 +296,9 @@ int git_pathspec_matches_path(
296
296
 
297
297
  static void pathspec_match_free(git_pathspec_match_list *m)
298
298
  {
299
+ if (!m)
300
+ return;
301
+
299
302
  git_pathspec_free(m->pathspec);
300
303
  m->pathspec = NULL;
301
304
 
@@ -634,7 +634,7 @@ int git_rebase_init(
634
634
 
635
635
  *out = NULL;
636
636
 
637
- GITERR_CHECK_VERSION(given_opts, GIT_MERGE_OPTIONS_VERSION, "git_merge_options");
637
+ GITERR_CHECK_VERSION(given_opts, GIT_REBASE_OPTIONS_VERSION, "git_rebase_options");
638
638
 
639
639
  if (!onto)
640
640
  onto = upstream;
@@ -1058,6 +1058,8 @@ int git_rebase_finish(
1058
1058
 
1059
1059
  assert(rebase);
1060
1060
 
1061
+ GITERR_CHECK_VERSION(given_opts, GIT_REBASE_OPTIONS_VERSION, "git_rebase_options");
1062
+
1061
1063
  if ((error = rebase_normalize_opts(rebase->repo, &opts, given_opts)) < 0)
1062
1064
  goto done;
1063
1065
 
@@ -1771,6 +1771,15 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
1771
1771
  goto cleanup;
1772
1772
  }
1773
1773
 
1774
+ /* If the new branch matches part of the namespace of a previously deleted branch,
1775
+ * there maybe an obsolete/unused directory (or directory hierarchy) in the way.
1776
+ */
1777
+ if (git_path_isdir(git_buf_cstr(&path)) &&
1778
+ (git_futils_rmdir_r(git_buf_cstr(&path), NULL, GIT_RMDIR_SKIP_NONEMPTY) < 0)) {
1779
+ error = -1;
1780
+ goto cleanup;
1781
+ }
1782
+
1774
1783
  error = git_futils_writebuffer(&buf, git_buf_cstr(&path), O_WRONLY|O_CREAT|O_APPEND, GIT_REFLOG_FILE_MODE);
1775
1784
 
1776
1785
  cleanup:
@@ -1459,7 +1459,7 @@ int git_remote_update_tips(
1459
1459
  const char *reflog_message)
1460
1460
  {
1461
1461
  git_refspec *spec, tagspec;
1462
- git_vector refs;
1462
+ git_vector refs = GIT_VECTOR_INIT;
1463
1463
  int error;
1464
1464
  size_t i;
1465
1465
 
@@ -2330,6 +2330,10 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
2330
2330
  (error = git_remote_connect(remote, GIT_DIRECTION_PUSH)) < 0)
2331
2331
  goto cleanup;
2332
2332
 
2333
+ free_refspecs(&remote->active_refspecs);
2334
+ if (dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs) < 0)
2335
+ goto cleanup;
2336
+
2333
2337
  if (remote->push) {
2334
2338
  git_push_free(remote->push);
2335
2339
  remote->push = NULL;
@@ -808,7 +808,8 @@ const char *git_repository__8dot3_name(git_repository *repo)
808
808
 
809
809
  /* We anticipate the 8.3 name is "GIT~1", so use a static for
810
810
  * easy testing in the common case */
811
- if (strcasecmp(repo->name_8dot3, git_repository__8dot3_default) == 0)
811
+ if (repo->name_8dot3 &&
812
+ strcasecmp(repo->name_8dot3, git_repository__8dot3_default) == 0)
812
813
  repo->has_8dot3_default = 1;
813
814
  }
814
815
  #endif
@@ -1723,7 +1724,7 @@ int git_repository_set_bare(git_repository *repo)
1723
1724
  if ((error = git_repository_config__weakptr(&config, repo)) < 0)
1724
1725
  return error;
1725
1726
 
1726
- if ((error = git_config_set_bool(config, "core.bare", false)) < 0)
1727
+ if ((error = git_config_set_bool(config, "core.bare", true)) < 0)
1727
1728
  return error;
1728
1729
 
1729
1730
  if ((error = git_config__update_entry(config, "core.worktree", NULL, true, true)) < 0)
@@ -15,6 +15,11 @@ GIT_INLINE(int) git_stream_connect(git_stream *st)
15
15
  return st->connect(st);
16
16
  }
17
17
 
18
+ GIT_INLINE(int) git_stream_is_encrypted(git_stream *st)
19
+ {
20
+ return st->encrypted;
21
+ }
22
+
18
23
  GIT_INLINE(int) git_stream_certificate(git_cert **out, git_stream *st)
19
24
  {
20
25
  if (!st->encrypted) {
@@ -136,6 +136,7 @@ static void git_proto_stream_free(git_smart_subtransport_stream *stream)
136
136
 
137
137
  t->current_stream = NULL;
138
138
 
139
+ git_stream_close(s->io);
139
140
  git_stream_free(s->io);
140
141
  git__free(s->url);
141
142
  git__free(s);
@@ -350,6 +350,11 @@ static int on_headers_complete(http_parser *parser)
350
350
  } else {
351
351
  assert(t->cred);
352
352
 
353
+ if (!(t->cred->credtype & allowed_auth_types)) {
354
+ giterr_set(GITERR_NET, "credentials callback returned an invalid cred type");
355
+ return t->parse_error = PARSE_ERROR_GENERIC;
356
+ }
357
+
353
358
  /* Successfully acquired a credential. */
354
359
  t->parse_error = PARSE_ERROR_REPLAY;
355
360
  return 0;
@@ -553,7 +558,8 @@ static int http_connect(http_subtransport *t)
553
558
  error = git_stream_connect(t->io);
554
559
 
555
560
  #ifdef GIT_SSL
556
- if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL) {
561
+ if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL &&
562
+ git_stream_is_encrypted(t->io)) {
557
563
  git_cert *cert;
558
564
  int is_valid;
559
565
 
@@ -448,12 +448,8 @@ int p_stat(const char* path, struct stat* buf)
448
448
  git_win32_path path_w;
449
449
  int len;
450
450
 
451
- if ((len = git_win32_path_from_utf8(path_w, path)) < 0)
452
- return -1;
453
-
454
- git_win32__path_trim_end(path_w, len);
455
-
456
- if (lstat_w(path_w, buf, false) < 0)
451
+ if ((len = git_win32_path_from_utf8(path_w, path)) < 0 ||
452
+ lstat_w(path_w, buf, false) < 0)
457
453
  return -1;
458
454
 
459
455
  /* The item is a symbolic link or mount point. No need to iterate
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.22.1b1
4
+ version: 0.22.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: 2015-03-10 00:00:00.000000000 Z
12
+ date: 2015-05-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -506,9 +506,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
506
506
  version: 1.9.3
507
507
  required_rubygems_version: !ruby/object:Gem::Requirement
508
508
  requirements:
509
- - - ">"
509
+ - - ">="
510
510
  - !ruby/object:Gem::Version
511
- version: 1.3.1
511
+ version: '0'
512
512
  requirements: []
513
513
  rubyforge_project:
514
514
  rubygems_version: 2.2.2