rugged 0.23.0b2 → 0.23.0b4

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.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_blob.c +39 -0
  3. data/ext/rugged/rugged_diff.c +7 -3
  4. data/ext/rugged/rugged_index.c +2 -2
  5. data/ext/rugged/rugged_remote.c +27 -148
  6. data/ext/rugged/rugged_remote_collection.c +134 -12
  7. data/ext/rugged/rugged_repo.c +74 -5
  8. data/ext/rugged/rugged_submodule.c +18 -208
  9. data/ext/rugged/rugged_submodule_collection.c +148 -0
  10. data/lib/rugged/version.rb +1 -1
  11. data/vendor/libgit2/AUTHORS +1 -0
  12. data/vendor/libgit2/CMakeLists.txt +33 -25
  13. data/vendor/libgit2/deps/winhttp/winhttp.def +29 -29
  14. data/vendor/libgit2/include/git2.h +1 -1
  15. data/vendor/libgit2/include/git2/blob.h +4 -6
  16. data/vendor/libgit2/include/git2/checkout.h +10 -1
  17. data/vendor/libgit2/include/git2/clone.h +6 -7
  18. data/vendor/libgit2/include/git2/commit.h +11 -0
  19. data/vendor/libgit2/include/git2/cred_helpers.h +2 -2
  20. data/vendor/libgit2/include/git2/describe.h +1 -1
  21. data/vendor/libgit2/include/git2/diff.h +68 -11
  22. data/vendor/libgit2/include/git2/errors.h +4 -1
  23. data/vendor/libgit2/include/git2/filter.h +16 -0
  24. data/vendor/libgit2/include/git2/index.h +38 -11
  25. data/vendor/libgit2/include/git2/odb.h +1 -1
  26. data/vendor/libgit2/include/git2/odb_backend.h +2 -2
  27. data/vendor/libgit2/include/git2/remote.h +300 -207
  28. data/vendor/libgit2/include/git2/reset.h +1 -0
  29. data/vendor/libgit2/include/git2/stash.h +135 -4
  30. data/vendor/libgit2/include/git2/status.h +1 -0
  31. data/vendor/libgit2/include/git2/submodule.h +46 -75
  32. data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
  33. data/vendor/libgit2/include/git2/sys/stream.h +2 -0
  34. data/vendor/libgit2/include/git2/sys/transport.h +1 -21
  35. data/vendor/libgit2/include/git2/transport.h +27 -0
  36. data/vendor/libgit2/include/git2/types.h +20 -10
  37. data/vendor/libgit2/include/git2/version.h +3 -3
  38. data/vendor/libgit2/libgit2.pc.in +4 -2
  39. data/vendor/libgit2/src/attr.c +2 -1
  40. data/vendor/libgit2/src/attr_file.c +18 -37
  41. data/vendor/libgit2/src/blame.c +2 -2
  42. data/vendor/libgit2/src/blob.c +4 -3
  43. data/vendor/libgit2/src/branch.c +6 -3
  44. data/vendor/libgit2/src/buf_text.c +4 -6
  45. data/vendor/libgit2/src/buf_text.h +1 -2
  46. data/vendor/libgit2/src/buffer.c +8 -6
  47. data/vendor/libgit2/src/buffer.h +1 -1
  48. data/vendor/libgit2/src/cache.c +1 -0
  49. data/vendor/libgit2/src/checkout.c +34 -20
  50. data/vendor/libgit2/src/clone.c +29 -29
  51. data/vendor/libgit2/src/commit.c +65 -0
  52. data/vendor/libgit2/src/common.h +5 -0
  53. data/vendor/libgit2/src/config.c +20 -0
  54. data/vendor/libgit2/src/config.h +6 -0
  55. data/vendor/libgit2/src/config_file.c +2 -2
  56. data/vendor/libgit2/src/crlf.c +39 -17
  57. data/vendor/libgit2/src/curl_stream.c +257 -0
  58. data/vendor/libgit2/src/curl_stream.h +14 -0
  59. data/vendor/libgit2/src/diff.c +223 -88
  60. data/vendor/libgit2/src/diff.h +21 -1
  61. data/vendor/libgit2/src/diff_file.c +23 -13
  62. data/vendor/libgit2/src/diff_file.h +4 -2
  63. data/vendor/libgit2/src/diff_patch.c +266 -71
  64. data/vendor/libgit2/src/diff_patch.h +36 -0
  65. data/vendor/libgit2/src/diff_print.c +156 -126
  66. data/vendor/libgit2/src/diff_tform.c +32 -54
  67. data/vendor/libgit2/src/fetch.c +27 -10
  68. data/vendor/libgit2/src/fetch.h +2 -2
  69. data/vendor/libgit2/src/filebuf.c +1 -1
  70. data/vendor/libgit2/src/fileops.c +6 -2
  71. data/vendor/libgit2/src/filter.c +28 -7
  72. data/vendor/libgit2/src/fnmatch.c +5 -5
  73. data/vendor/libgit2/src/global.c +16 -0
  74. data/vendor/libgit2/src/ident.c +2 -2
  75. data/vendor/libgit2/src/ignore.c +1 -0
  76. data/vendor/libgit2/src/index.c +338 -80
  77. data/vendor/libgit2/src/index.h +4 -1
  78. data/vendor/libgit2/src/indexer.c +19 -5
  79. data/vendor/libgit2/src/iterator.c +118 -11
  80. data/vendor/libgit2/src/iterator.h +25 -0
  81. data/vendor/libgit2/src/merge.c +96 -106
  82. data/vendor/libgit2/src/merge.h +14 -4
  83. data/vendor/libgit2/src/netops.c +3 -3
  84. data/vendor/libgit2/src/odb.c +17 -9
  85. data/vendor/libgit2/src/odb.h +1 -1
  86. data/vendor/libgit2/src/odb_loose.c +2 -2
  87. data/vendor/libgit2/src/odb_pack.c +1 -1
  88. data/vendor/libgit2/src/openssl_stream.c +118 -27
  89. data/vendor/libgit2/src/pack-objects.c +28 -0
  90. data/vendor/libgit2/src/pack-objects.h +1 -0
  91. data/vendor/libgit2/src/pack.c +18 -10
  92. data/vendor/libgit2/src/path.c +16 -11
  93. data/vendor/libgit2/src/path.h +1 -1
  94. data/vendor/libgit2/src/push.c +26 -42
  95. data/vendor/libgit2/src/push.h +2 -34
  96. data/vendor/libgit2/src/rebase.c +1 -1
  97. data/vendor/libgit2/src/refs.c +1 -1
  98. data/vendor/libgit2/src/refspec.c +6 -0
  99. data/vendor/libgit2/src/remote.c +381 -274
  100. data/vendor/libgit2/src/remote.h +0 -4
  101. data/vendor/libgit2/src/repository.c +33 -12
  102. data/vendor/libgit2/src/repository.h +0 -1
  103. data/vendor/libgit2/src/reset.c +1 -0
  104. data/vendor/libgit2/src/stash.c +439 -17
  105. data/vendor/libgit2/src/status.c +6 -0
  106. data/vendor/libgit2/src/stransport_stream.c +58 -21
  107. data/vendor/libgit2/src/stream.h +15 -0
  108. data/vendor/libgit2/src/submodule.c +410 -664
  109. data/vendor/libgit2/src/submodule.h +0 -24
  110. data/vendor/libgit2/src/transaction.c +1 -0
  111. data/vendor/libgit2/src/transports/cred.c +55 -1
  112. data/vendor/libgit2/src/transports/http.c +18 -2
  113. data/vendor/libgit2/src/transports/local.c +60 -59
  114. data/vendor/libgit2/src/transports/smart.h +1 -1
  115. data/vendor/libgit2/src/transports/smart_protocol.c +11 -11
  116. data/vendor/libgit2/src/transports/ssh.c +46 -7
  117. data/vendor/libgit2/src/unix/posix.h +4 -0
  118. data/vendor/libgit2/src/util.c +9 -9
  119. data/vendor/libgit2/src/util.h +9 -0
  120. data/vendor/libgit2/src/win32/posix.h +3 -0
  121. data/vendor/libgit2/src/win32/posix_w32.c +38 -0
  122. data/vendor/libgit2/src/win32/w32_util.h +10 -0
  123. metadata +4 -3
  124. data/vendor/libgit2/include/git2/push.h +0 -94
@@ -125,10 +125,21 @@ static int ssh_stream_read(
125
125
  return -1;
126
126
 
127
127
  if ((rc = libssh2_channel_read(s->channel, buffer, buf_size)) < LIBSSH2_ERROR_NONE) {
128
- ssh_error(s->session, "SSH could not read data");;
128
+ ssh_error(s->session, "SSH could not read data");
129
129
  return -1;
130
130
  }
131
131
 
132
+ /*
133
+ * If we can't get anything out of stdout, it's typically a
134
+ * not-found error, so read from stderr and signal EOF on
135
+ * stderr.
136
+ */
137
+ if (rc == 0 && (rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) {
138
+ giterr_set(GITERR_SSH, "%*s", rc, buffer);
139
+ return GIT_EEOF;
140
+ }
141
+
142
+
132
143
  *bytes_read = rc;
133
144
 
134
145
  return 0;
@@ -166,11 +177,12 @@ static int ssh_stream_write(
166
177
  static void ssh_stream_free(git_smart_subtransport_stream *stream)
167
178
  {
168
179
  ssh_stream *s = (ssh_stream *)stream;
169
- ssh_subtransport *t = OWNING_SUBTRANSPORT(s);
170
- int ret;
180
+ ssh_subtransport *t;
171
181
 
172
- GIT_UNUSED(ret);
182
+ if (!stream)
183
+ return;
173
184
 
185
+ t = OWNING_SUBTRANSPORT(s);
174
186
  t->current_stream = NULL;
175
187
 
176
188
  if (s->channel) {
@@ -282,8 +294,14 @@ static int ssh_agent_auth(LIBSSH2_SESSION *session, git_cred_ssh_key *c) {
282
294
  if (rc < 0)
283
295
  goto shutdown;
284
296
 
285
- if (rc == 1)
297
+ /* rc is set to 1 whenever the ssh agent ran out of keys to check.
298
+ * Set the error code to authentication failure rather than erroring
299
+ * out with an untranslatable error code.
300
+ */
301
+ if (rc == 1) {
302
+ rc = LIBSSH2_ERROR_AUTHENTICATION_FAILED;
286
303
  goto shutdown;
304
+ }
287
305
 
288
306
  rc = libssh2_agent_userauth(agent, c->username, curr);
289
307
 
@@ -359,6 +377,25 @@ static int _git_ssh_authenticate_session(
359
377
  session, c->username, c->prompt_callback);
360
378
  break;
361
379
  }
380
+ #ifdef GIT_SSH_MEMORY_CREDENTIALS
381
+ case GIT_CREDTYPE_SSH_MEMORY: {
382
+ git_cred_ssh_key *c = (git_cred_ssh_key *)cred;
383
+
384
+ assert(c->username);
385
+ assert(c->privatekey);
386
+
387
+ rc = libssh2_userauth_publickey_frommemory(
388
+ session,
389
+ c->username,
390
+ strlen(c->username),
391
+ c->publickey,
392
+ c->publickey ? strlen(c->publickey) : 0,
393
+ c->privatekey,
394
+ strlen(c->privatekey),
395
+ c->passphrase);
396
+ break;
397
+ }
398
+ #endif
362
399
  default:
363
400
  rc = LIBSSH2_ERROR_AUTHENTICATION_FAILED;
364
401
  }
@@ -585,8 +622,7 @@ static int _git_ssh_setup_conn(
585
622
 
586
623
  done:
587
624
  if (error < 0) {
588
- if (*stream)
589
- ssh_stream_free(*stream);
625
+ ssh_stream_free(*stream);
590
626
 
591
627
  if (session)
592
628
  libssh2_session_free(session);
@@ -729,6 +765,9 @@ static int list_auth_methods(int *out, LIBSSH2_SESSION *session, const char *use
729
765
  if (!git__prefixcmp(ptr, SSH_AUTH_PUBLICKEY)) {
730
766
  *out |= GIT_CREDTYPE_SSH_KEY;
731
767
  *out |= GIT_CREDTYPE_SSH_CUSTOM;
768
+ #ifdef GIT_SSH_MEMORY_CREDENTIALS
769
+ *out |= GIT_CREDTYPE_SSH_MEMORY;
770
+ #endif
732
771
  ptr += strlen(SSH_AUTH_PUBLICKEY);
733
772
  continue;
734
773
  }
@@ -10,6 +10,7 @@
10
10
  #include <stdio.h>
11
11
  #include <dirent.h>
12
12
  #include <sys/param.h>
13
+ #include <sys/time.h>
13
14
 
14
15
  typedef int GIT_SOCKET;
15
16
  #define INVALID_SOCKET -1
@@ -19,6 +20,9 @@ typedef int GIT_SOCKET;
19
20
  #define p_lstat(p,b) lstat(p,b)
20
21
  #define p_stat(p,b) stat(p, b)
21
22
 
23
+ #define p_utimes(f, t) utimes(f, t)
24
+ #define p_futimes(f, t) futimes(f, t)
25
+
22
26
  #define p_readlink(a, b, c) readlink(a, b, c)
23
27
  #define p_symlink(o,n) symlink(o, n)
24
28
  #define p_link(o,n) link(o, n)
@@ -171,9 +171,9 @@ int git__strcmp(const char *a, const char *b)
171
171
 
172
172
  int git__strcasecmp(const char *a, const char *b)
173
173
  {
174
- while (*a && *b && tolower(*a) == tolower(*b))
174
+ while (*a && *b && git__tolower(*a) == git__tolower(*b))
175
175
  ++a, ++b;
176
- return (tolower(*a) - tolower(*b));
176
+ return ((unsigned char)git__tolower(*a) - (unsigned char)git__tolower(*b));
177
177
  }
178
178
 
179
179
  int git__strcasesort_cmp(const char *a, const char *b)
@@ -182,7 +182,7 @@ int git__strcasesort_cmp(const char *a, const char *b)
182
182
 
183
183
  while (*a && *b) {
184
184
  if (*a != *b) {
185
- if (tolower(*a) != tolower(*b))
185
+ if (git__tolower(*a) != git__tolower(*b))
186
186
  break;
187
187
  /* use case in sort order even if not in equivalence */
188
188
  if (!cmp)
@@ -193,7 +193,7 @@ int git__strcasesort_cmp(const char *a, const char *b)
193
193
  }
194
194
 
195
195
  if (*a || *b)
196
- return tolower(*a) - tolower(*b);
196
+ return (unsigned char)git__tolower(*a) - (unsigned char)git__tolower(*b);
197
197
 
198
198
  return cmp;
199
199
  }
@@ -212,8 +212,8 @@ int git__strncasecmp(const char *a, const char *b, size_t sz)
212
212
  int al, bl;
213
213
 
214
214
  do {
215
- al = (unsigned char)tolower(*a);
216
- bl = (unsigned char)tolower(*b);
215
+ al = (unsigned char)git__tolower(*a);
216
+ bl = (unsigned char)git__tolower(*b);
217
217
  ++a, ++b;
218
218
  } while (--sz && al && al == bl);
219
219
 
@@ -225,7 +225,7 @@ void git__strntolower(char *str, size_t len)
225
225
  size_t i;
226
226
 
227
227
  for (i = 0; i < len; ++i) {
228
- str[i] = (char) tolower(str[i]);
228
+ str[i] = (char)git__tolower(str[i]);
229
229
  }
230
230
  }
231
231
 
@@ -255,8 +255,8 @@ int git__prefixncmp_icase(const char *str, size_t str_n, const char *prefix)
255
255
  int s, p;
256
256
 
257
257
  while(str_n--) {
258
- s = (unsigned char)tolower(*str++);
259
- p = (unsigned char)tolower(*prefix++);
258
+ s = (unsigned char)git__tolower(*str++);
259
+ p = (unsigned char)git__tolower(*prefix++);
260
260
 
261
261
  if (s != p)
262
262
  return s - p;
@@ -275,6 +275,15 @@ extern char *git__strsep(char **end, const char *sep);
275
275
  extern void git__strntolower(char *str, size_t len);
276
276
  extern void git__strtolower(char *str);
277
277
 
278
+ #ifdef GIT_WIN32
279
+ GIT_INLINE(int) git__tolower(int c)
280
+ {
281
+ return (c >= 'A' && c <= 'Z') ? (c + 32) : c;
282
+ }
283
+ #else
284
+ # define git__tolower(a) tolower(a)
285
+ #endif
286
+
278
287
  GIT_INLINE(const char *) git__next_line(const char *s)
279
288
  {
280
289
  while (*s && *s != '\n') s++;
@@ -20,6 +20,9 @@ typedef SOCKET GIT_SOCKET;
20
20
  extern int p_lstat(const char *file_name, struct stat *buf);
21
21
  extern int p_stat(const char* path, struct stat* buf);
22
22
 
23
+ extern int p_utimes(const char *filename, const struct timeval times[2]);
24
+ extern int p_futimes(int fd, const struct timeval times[2]);
25
+
23
26
  extern int p_readlink(const char *path, char *buf, size_t bufsiz);
24
27
  extern int p_symlink(const char *old, const char *new);
25
28
  extern int p_link(const char *old, const char *new);
@@ -201,6 +201,44 @@ int p_lstat_posixly(const char *filename, struct stat *buf)
201
201
  return do_lstat(filename, buf, true);
202
202
  }
203
203
 
204
+ int p_utimes(const char *filename, const struct timeval times[2])
205
+ {
206
+ int fd, error;
207
+
208
+ if ((fd = p_open(filename, O_RDWR)) < 0)
209
+ return fd;
210
+
211
+ error = p_futimes(fd, times);
212
+
213
+ close(fd);
214
+ return error;
215
+ }
216
+
217
+ int p_futimes(int fd, const struct timeval times[2])
218
+ {
219
+ HANDLE handle;
220
+ FILETIME atime = {0}, mtime = {0};
221
+
222
+ if (times == NULL) {
223
+ SYSTEMTIME st;
224
+
225
+ GetSystemTime(&st);
226
+ SystemTimeToFileTime(&st, &atime);
227
+ SystemTimeToFileTime(&st, &mtime);
228
+ } else {
229
+ git_win32__timeval_to_filetime(&atime, times[0]);
230
+ git_win32__timeval_to_filetime(&mtime, times[1]);
231
+ }
232
+
233
+ if ((handle = (HANDLE)_get_osfhandle(fd)) == INVALID_HANDLE_VALUE)
234
+ return -1;
235
+
236
+ if (SetFileTime(handle, NULL, &atime, &mtime) == 0)
237
+ return -1;
238
+
239
+ return 0;
240
+ }
241
+
204
242
  int p_readlink(const char *path, char *buf, size_t bufsiz)
205
243
  {
206
244
  git_win32_path path_w, target_w;
@@ -79,6 +79,16 @@ GIT_INLINE(time_t) git_win32__filetime_to_time_t(const FILETIME *ft)
79
79
  return (time_t)winTime;
80
80
  }
81
81
 
82
+ GIT_INLINE(void) git_win32__timeval_to_filetime(
83
+ FILETIME *ft, const struct timeval tv)
84
+ {
85
+ long long ticks = (tv.tv_sec * 10000000LL) +
86
+ (tv.tv_usec * 10LL) + 116444736000000000LL;
87
+
88
+ ft->dwHighDateTime = ((ticks >> 32) & 0xffffffffLL);
89
+ ft->dwLowDateTime = (ticks & 0xffffffffLL);
90
+ }
91
+
82
92
  GIT_INLINE(int) git_win32__file_attribute_to_stat(
83
93
  struct stat *st,
84
94
  const WIN32_FILE_ATTRIBUTE_DATA *attrdata,
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.23.0b2
4
+ version: 0.23.0b4
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-05-17 00:00:00.000000000 Z
12
+ date: 2015-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -197,7 +197,6 @@ files:
197
197
  - vendor/libgit2/include/git2/pack.h
198
198
  - vendor/libgit2/include/git2/patch.h
199
199
  - vendor/libgit2/include/git2/pathspec.h
200
- - vendor/libgit2/include/git2/push.h
201
200
  - vendor/libgit2/include/git2/rebase.h
202
201
  - vendor/libgit2/include/git2/refdb.h
203
202
  - vendor/libgit2/include/git2/reflog.h
@@ -279,6 +278,8 @@ files:
279
278
  - vendor/libgit2/src/config_file.c
280
279
  - vendor/libgit2/src/config_file.h
281
280
  - vendor/libgit2/src/crlf.c
281
+ - vendor/libgit2/src/curl_stream.c
282
+ - vendor/libgit2/src/curl_stream.h
282
283
  - vendor/libgit2/src/date.c
283
284
  - vendor/libgit2/src/delta-apply.c
284
285
  - vendor/libgit2/src/delta-apply.h
@@ -1,94 +0,0 @@
1
- /*
2
- * Copyright (C) the libgit2 contributors. All rights reserved.
3
- *
4
- * This file is part of libgit2, distributed under the GNU GPL v2 with
5
- * a Linking Exception. For full terms see the included COPYING file.
6
- */
7
- #ifndef INCLUDE_git_push_h__
8
- #define INCLUDE_git_push_h__
9
-
10
- #include "common.h"
11
- #include "pack.h"
12
-
13
- /**
14
- * @file git2/push.h
15
- * @brief Git push management functions
16
- * @defgroup git_push push management functions
17
- * @ingroup Git
18
- * @{
19
- */
20
- GIT_BEGIN_DECL
21
-
22
- /**
23
- * Controls the behavior of a git_push object.
24
- */
25
- typedef struct {
26
- unsigned int version;
27
-
28
- /**
29
- * If the transport being used to push to the remote requires the creation
30
- * of a pack file, this controls the number of worker threads used by
31
- * the packbuilder when creating that pack file to be sent to the remote.
32
- *
33
- * If set to 0, the packbuilder will auto-detect the number of threads
34
- * to create. The default value is 1.
35
- */
36
- unsigned int pb_parallelism;
37
- } git_push_options;
38
-
39
- #define GIT_PUSH_OPTIONS_VERSION 1
40
- #define GIT_PUSH_OPTIONS_INIT { GIT_PUSH_OPTIONS_VERSION }
41
-
42
- /**
43
- * Initializes a `git_push_options` with default values. Equivalent to
44
- * creating an instance with GIT_PUSH_OPTIONS_INIT.
45
- *
46
- * @param opts the `git_push_options` instance to initialize.
47
- * @param version the version of the struct; you should pass
48
- * `GIT_PUSH_OPTIONS_VERSION` here.
49
- * @return Zero on success; -1 on failure.
50
- */
51
- GIT_EXTERN(int) git_push_init_options(
52
- git_push_options *opts,
53
- unsigned int version);
54
-
55
- /** Push network progress notification function */
56
- typedef int (*git_push_transfer_progress)(
57
- unsigned int current,
58
- unsigned int total,
59
- size_t bytes,
60
- void* payload);
61
-
62
- /**
63
- * Represents an update which will be performed on the remote during push
64
- */
65
- typedef struct {
66
- /**
67
- * The source name of the reference
68
- */
69
- char *src_refname;
70
- /**
71
- * The name of the reference to update on the server
72
- */
73
- char *dst_refname;
74
- /**
75
- * The current target of the reference
76
- */
77
- git_oid src;
78
- /**
79
- * The new target for the reference
80
- */
81
- git_oid dst;
82
- } git_push_update;
83
-
84
- /**
85
- * @param updates an array containing the updates which will be sent
86
- * as commands to the destination.
87
- * @param len number of elements in `updates`
88
- * @param payload Payload provided by the caller
89
- */
90
- typedef int (*git_push_negotiation)(const git_push_update **updates, size_t len, void *payload);
91
-
92
- /** @} */
93
- GIT_END_DECL
94
- #endif