rugged 1.5.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +2 -2
  3. data/ext/rugged/rugged_blame.c +2 -0
  4. data/ext/rugged/rugged_blob.c +3 -0
  5. data/ext/rugged/rugged_commit.c +1 -0
  6. data/ext/rugged/rugged_config.c +2 -0
  7. data/ext/rugged/rugged_diff.c +1 -0
  8. data/ext/rugged/rugged_index.c +2 -0
  9. data/ext/rugged/rugged_patch.c +1 -0
  10. data/ext/rugged/rugged_rebase.c +1 -0
  11. data/ext/rugged/rugged_reference.c +1 -0
  12. data/ext/rugged/rugged_remote.c +1 -0
  13. data/ext/rugged/rugged_repo.c +5 -2
  14. data/ext/rugged/rugged_revwalk.c +5 -1
  15. data/ext/rugged/rugged_submodule.c +1 -0
  16. data/ext/rugged/rugged_tag.c +1 -0
  17. data/ext/rugged/rugged_tree.c +4 -0
  18. data/lib/rugged/index.rb +1 -1
  19. data/lib/rugged/tree.rb +1 -1
  20. data/lib/rugged/version.rb +1 -1
  21. data/vendor/libgit2/CMakeLists.txt +5 -1
  22. data/vendor/libgit2/COPYING +30 -0
  23. data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
  24. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
  25. data/vendor/libgit2/include/git2/common.h +13 -6
  26. data/vendor/libgit2/include/git2/deprecated.h +6 -0
  27. data/vendor/libgit2/include/git2/diff.h +1 -1
  28. data/vendor/libgit2/include/git2/experimental.h +20 -0
  29. data/vendor/libgit2/include/git2/indexer.h +29 -0
  30. data/vendor/libgit2/include/git2/object.h +28 -2
  31. data/vendor/libgit2/include/git2/odb.h +58 -7
  32. data/vendor/libgit2/include/git2/odb_backend.h +106 -18
  33. data/vendor/libgit2/include/git2/oid.h +115 -15
  34. data/vendor/libgit2/include/git2/repository.h +20 -1
  35. data/vendor/libgit2/include/git2/stash.h +60 -6
  36. data/vendor/libgit2/include/git2/strarray.h +0 -13
  37. data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
  38. data/vendor/libgit2/include/git2/sys/transport.h +12 -0
  39. data/vendor/libgit2/include/git2/version.h +4 -4
  40. data/vendor/libgit2/include/git2.h +1 -0
  41. data/vendor/libgit2/src/CMakeLists.txt +0 -6
  42. data/vendor/libgit2/src/cli/CMakeLists.txt +6 -2
  43. data/vendor/libgit2/src/cli/cmd_hash_object.c +27 -8
  44. data/vendor/libgit2/src/cli/opt.c +1 -1
  45. data/vendor/libgit2/src/libgit2/CMakeLists.txt +25 -15
  46. data/vendor/libgit2/src/libgit2/annotated_commit.c +1 -1
  47. data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
  48. data/vendor/libgit2/src/libgit2/attr_file.c +1 -1
  49. data/vendor/libgit2/src/libgit2/attrcache.c +1 -1
  50. data/vendor/libgit2/src/libgit2/blame.c +2 -0
  51. data/vendor/libgit2/src/libgit2/blob.c +4 -2
  52. data/vendor/libgit2/src/libgit2/blob.h +2 -2
  53. data/vendor/libgit2/src/libgit2/branch.c +2 -2
  54. data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
  55. data/vendor/libgit2/src/libgit2/clone.c +31 -2
  56. data/vendor/libgit2/src/libgit2/commit.c +52 -17
  57. data/vendor/libgit2/src/libgit2/commit.h +25 -7
  58. data/vendor/libgit2/src/libgit2/commit_graph.c +47 -32
  59. data/vendor/libgit2/src/libgit2/commit_graph.h +3 -0
  60. data/vendor/libgit2/src/libgit2/commit_list.c +6 -2
  61. data/vendor/libgit2/src/libgit2/config.c +1 -1
  62. data/vendor/libgit2/src/libgit2/config_file.c +2 -2
  63. data/vendor/libgit2/src/libgit2/describe.c +8 -8
  64. data/vendor/libgit2/src/libgit2/diff.c +5 -1
  65. data/vendor/libgit2/src/libgit2/diff_file.c +15 -6
  66. data/vendor/libgit2/src/libgit2/diff_generate.c +17 -12
  67. data/vendor/libgit2/src/libgit2/diff_print.c +5 -5
  68. data/vendor/libgit2/src/libgit2/diff_tform.c +4 -0
  69. data/vendor/libgit2/src/libgit2/email.c +2 -2
  70. data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
  71. data/vendor/libgit2/src/libgit2/fetch.c +3 -6
  72. data/vendor/libgit2/src/libgit2/fetchhead.c +4 -4
  73. data/vendor/libgit2/src/libgit2/ident.c +3 -3
  74. data/vendor/libgit2/src/libgit2/index.c +11 -9
  75. data/vendor/libgit2/src/libgit2/indexer.c +107 -44
  76. data/vendor/libgit2/src/libgit2/iterator.c +4 -2
  77. data/vendor/libgit2/src/libgit2/libgit2.c +19 -0
  78. data/vendor/libgit2/src/libgit2/merge.c +3 -3
  79. data/vendor/libgit2/src/libgit2/midx.c +16 -15
  80. data/vendor/libgit2/src/libgit2/mwindow.c +5 -2
  81. data/vendor/libgit2/src/libgit2/mwindow.h +4 -1
  82. data/vendor/libgit2/src/libgit2/notes.c +5 -5
  83. data/vendor/libgit2/src/libgit2/object.c +89 -25
  84. data/vendor/libgit2/src/libgit2/object.h +12 -3
  85. data/vendor/libgit2/src/libgit2/odb.c +194 -50
  86. data/vendor/libgit2/src/libgit2/odb.h +43 -4
  87. data/vendor/libgit2/src/libgit2/odb_loose.c +128 -70
  88. data/vendor/libgit2/src/libgit2/odb_pack.c +96 -44
  89. data/vendor/libgit2/src/libgit2/oid.c +134 -76
  90. data/vendor/libgit2/src/libgit2/oid.h +183 -9
  91. data/vendor/libgit2/src/libgit2/pack-objects.c +15 -4
  92. data/vendor/libgit2/src/libgit2/pack.c +90 -66
  93. data/vendor/libgit2/src/libgit2/pack.h +29 -15
  94. data/vendor/libgit2/src/libgit2/parse.c +4 -3
  95. data/vendor/libgit2/src/libgit2/patch_parse.c +5 -5
  96. data/vendor/libgit2/src/libgit2/push.c +13 -3
  97. data/vendor/libgit2/src/libgit2/reader.c +1 -1
  98. data/vendor/libgit2/src/libgit2/rebase.c +19 -18
  99. data/vendor/libgit2/src/libgit2/refdb_fs.c +70 -39
  100. data/vendor/libgit2/src/libgit2/reflog.c +7 -5
  101. data/vendor/libgit2/src/libgit2/reflog.h +1 -2
  102. data/vendor/libgit2/src/libgit2/refs.c +2 -0
  103. data/vendor/libgit2/src/libgit2/remote.c +38 -37
  104. data/vendor/libgit2/src/libgit2/remote.h +40 -0
  105. data/vendor/libgit2/src/libgit2/repository.c +212 -36
  106. data/vendor/libgit2/src/libgit2/repository.h +9 -0
  107. data/vendor/libgit2/src/libgit2/reset.c +2 -2
  108. data/vendor/libgit2/src/libgit2/revert.c +4 -4
  109. data/vendor/libgit2/src/libgit2/revparse.c +23 -7
  110. data/vendor/libgit2/src/libgit2/revwalk.c +5 -1
  111. data/vendor/libgit2/src/libgit2/stash.c +201 -26
  112. data/vendor/libgit2/src/libgit2/strarray.c +1 -0
  113. data/vendor/libgit2/src/libgit2/strarray.h +25 -0
  114. data/vendor/libgit2/src/libgit2/streams/openssl.c +1 -1
  115. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +7 -3
  116. data/vendor/libgit2/src/libgit2/streams/socket.c +4 -1
  117. data/vendor/libgit2/src/libgit2/submodule.c +6 -2
  118. data/vendor/libgit2/src/libgit2/sysdir.c +294 -7
  119. data/vendor/libgit2/src/libgit2/sysdir.h +39 -9
  120. data/vendor/libgit2/src/libgit2/tag.c +29 -10
  121. data/vendor/libgit2/src/libgit2/tag.h +2 -2
  122. data/vendor/libgit2/src/libgit2/threadstate.h +1 -1
  123. data/vendor/libgit2/src/libgit2/transports/http.c +8 -7
  124. data/vendor/libgit2/src/libgit2/transports/httpclient.c +9 -0
  125. data/vendor/libgit2/src/libgit2/transports/httpclient.h +10 -0
  126. data/vendor/libgit2/src/libgit2/transports/local.c +14 -0
  127. data/vendor/libgit2/src/libgit2/transports/smart.c +35 -0
  128. data/vendor/libgit2/src/libgit2/transports/smart.h +10 -1
  129. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +153 -41
  130. data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +42 -12
  131. data/vendor/libgit2/src/libgit2/transports/ssh.c +62 -65
  132. data/vendor/libgit2/src/libgit2/transports/winhttp.c +9 -4
  133. data/vendor/libgit2/src/libgit2/tree-cache.c +4 -4
  134. data/vendor/libgit2/src/libgit2/tree.c +22 -16
  135. data/vendor/libgit2/src/libgit2/tree.h +2 -2
  136. data/vendor/libgit2/src/libgit2/worktree.c +5 -0
  137. data/vendor/libgit2/src/util/CMakeLists.txt +7 -1
  138. data/vendor/libgit2/src/util/fs_path.c +1 -1
  139. data/vendor/libgit2/src/util/futils.c +0 -3
  140. data/vendor/libgit2/src/util/git2_util.h +2 -2
  141. data/vendor/libgit2/src/util/hash/openssl.c +4 -3
  142. data/vendor/libgit2/src/util/hash/rfc6234/sha.h +0 -112
  143. data/vendor/libgit2/src/util/hash.h +13 -0
  144. data/vendor/libgit2/src/util/net.c +338 -84
  145. data/vendor/libgit2/src/util/net.h +7 -0
  146. data/vendor/libgit2/src/util/posix.h +2 -0
  147. data/vendor/libgit2/src/util/rand.c +4 -0
  148. data/vendor/libgit2/src/util/regexp.c +3 -3
  149. data/vendor/libgit2/src/util/thread.h +20 -19
  150. data/vendor/libgit2/src/util/util.h +1 -0
  151. metadata +7 -5
  152. data/vendor/libgit2/src/util/win32/findfile.c +0 -286
  153. data/vendor/libgit2/src/util/win32/findfile.h +0 -22
  154. /data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +0 -0
@@ -1,286 +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
-
8
- #include "findfile.h"
9
-
10
- #include "path_w32.h"
11
- #include "utf-conv.h"
12
- #include "fs_path.h"
13
-
14
- #define REG_GITFORWINDOWS_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1"
15
- #define REG_GITFORWINDOWS_KEY_WOW64 L"SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1"
16
-
17
- static int git_win32__expand_path(git_win32_path dest, const wchar_t *src)
18
- {
19
- DWORD len = ExpandEnvironmentStringsW(src, dest, GIT_WIN_PATH_UTF16);
20
-
21
- if (!len || len > GIT_WIN_PATH_UTF16)
22
- return -1;
23
-
24
- return 0;
25
- }
26
-
27
- static int win32_path_to_8(git_str *dest, const wchar_t *src)
28
- {
29
- git_win32_utf8_path utf8_path;
30
-
31
- if (git_win32_path_to_utf8(utf8_path, src) < 0) {
32
- git_error_set(GIT_ERROR_OS, "unable to convert path to UTF-8");
33
- return -1;
34
- }
35
-
36
- /* Convert backslashes to forward slashes */
37
- git_fs_path_mkposix(utf8_path);
38
-
39
- return git_str_sets(dest, utf8_path);
40
- }
41
-
42
- static git_win32_path mock_registry;
43
- static bool mock_registry_set;
44
-
45
- extern int git_win32__set_registry_system_dir(const wchar_t *mock_sysdir)
46
- {
47
- if (!mock_sysdir) {
48
- mock_registry[0] = L'\0';
49
- mock_registry_set = false;
50
- } else {
51
- size_t len = wcslen(mock_sysdir);
52
-
53
- if (len > GIT_WIN_PATH_MAX) {
54
- git_error_set(GIT_ERROR_INVALID, "mock path too long");
55
- return -1;
56
- }
57
-
58
- wcscpy(mock_registry, mock_sysdir);
59
- mock_registry_set = true;
60
- }
61
-
62
- return 0;
63
- }
64
-
65
- static int lookup_registry_key(
66
- git_win32_path out,
67
- const HKEY hive,
68
- const wchar_t* key,
69
- const wchar_t *value)
70
- {
71
- HKEY hkey;
72
- DWORD type, size;
73
- int error = GIT_ENOTFOUND;
74
-
75
- /*
76
- * Registry data may not be NUL terminated, provide room to do
77
- * it ourselves.
78
- */
79
- size = (DWORD)((sizeof(git_win32_path) - 1) * sizeof(wchar_t));
80
-
81
- if (RegOpenKeyExW(hive, key, 0, KEY_READ, &hkey) != 0)
82
- return GIT_ENOTFOUND;
83
-
84
- if (RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)out, &size) == 0 &&
85
- type == REG_SZ &&
86
- size > 0 &&
87
- size < sizeof(git_win32_path)) {
88
- size_t wsize = size / sizeof(wchar_t);
89
- size_t len = wsize - 1;
90
-
91
- if (out[wsize - 1] != L'\0') {
92
- len = wsize;
93
- out[wsize] = L'\0';
94
- }
95
-
96
- if (out[len - 1] == L'\\')
97
- out[len - 1] = L'\0';
98
-
99
- if (_waccess(out, F_OK) == 0)
100
- error = 0;
101
- }
102
-
103
- RegCloseKey(hkey);
104
- return error;
105
- }
106
-
107
- static int find_sysdir_in_registry(git_win32_path out)
108
- {
109
- if (mock_registry_set) {
110
- if (mock_registry[0] == L'\0')
111
- return GIT_ENOTFOUND;
112
-
113
- wcscpy(out, mock_registry);
114
- return 0;
115
- }
116
-
117
- if (lookup_registry_key(out, HKEY_CURRENT_USER, REG_GITFORWINDOWS_KEY, L"InstallLocation") == 0 ||
118
- lookup_registry_key(out, HKEY_CURRENT_USER, REG_GITFORWINDOWS_KEY_WOW64, L"InstallLocation") == 0 ||
119
- lookup_registry_key(out, HKEY_LOCAL_MACHINE, REG_GITFORWINDOWS_KEY, L"InstallLocation") == 0 ||
120
- lookup_registry_key(out, HKEY_LOCAL_MACHINE, REG_GITFORWINDOWS_KEY_WOW64, L"InstallLocation") == 0)
121
- return 0;
122
-
123
- return GIT_ENOTFOUND;
124
- }
125
-
126
- static int find_sysdir_in_path(git_win32_path out)
127
- {
128
- size_t out_len;
129
-
130
- if (git_win32_path_find_executable(out, L"git.exe") < 0 &&
131
- git_win32_path_find_executable(out, L"git.cmd") < 0)
132
- return GIT_ENOTFOUND;
133
-
134
- out_len = wcslen(out);
135
-
136
- /* Trim the file name */
137
- if (out_len <= CONST_STRLEN(L"git.exe"))
138
- return GIT_ENOTFOUND;
139
-
140
- out_len -= CONST_STRLEN(L"git.exe");
141
-
142
- if (out_len && out[out_len - 1] == L'\\')
143
- out_len--;
144
-
145
- /*
146
- * Git for Windows usually places the command in a 'bin' or
147
- * 'cmd' directory, trim that.
148
- */
149
- if (out_len >= CONST_STRLEN(L"\\bin") &&
150
- wcsncmp(&out[out_len - CONST_STRLEN(L"\\bin")], L"\\bin", CONST_STRLEN(L"\\bin")) == 0)
151
- out_len -= CONST_STRLEN(L"\\bin");
152
- else if (out_len >= CONST_STRLEN(L"\\cmd") &&
153
- wcsncmp(&out[out_len - CONST_STRLEN(L"\\cmd")], L"\\cmd", CONST_STRLEN(L"\\cmd")) == 0)
154
- out_len -= CONST_STRLEN(L"\\cmd");
155
-
156
- if (!out_len)
157
- return GIT_ENOTFOUND;
158
-
159
- out[out_len] = L'\0';
160
- return 0;
161
- }
162
-
163
- static int win32_find_existing_dirs(
164
- git_str* out,
165
- const wchar_t* tmpl[])
166
- {
167
- git_win32_path path16;
168
- git_str buf = GIT_STR_INIT;
169
-
170
- git_str_clear(out);
171
-
172
- for (; *tmpl != NULL; tmpl++) {
173
- if (!git_win32__expand_path(path16, *tmpl) &&
174
- path16[0] != L'%' &&
175
- !_waccess(path16, F_OK)) {
176
- win32_path_to_8(&buf, path16);
177
-
178
- if (buf.size)
179
- git_str_join(out, GIT_PATH_LIST_SEPARATOR, out->ptr, buf.ptr);
180
- }
181
- }
182
-
183
- git_str_dispose(&buf);
184
-
185
- return (git_str_oom(out) ? -1 : 0);
186
- }
187
-
188
- static int append_subdir(git_str *out, git_str *path, const char *subdir)
189
- {
190
- static const char* architecture_roots[] = {
191
- "",
192
- "mingw64",
193
- "mingw32",
194
- NULL
195
- };
196
- const char **root;
197
- size_t orig_path_len = path->size;
198
-
199
- for (root = architecture_roots; *root; root++) {
200
- if ((*root[0] && git_str_joinpath(path, path->ptr, *root) < 0) ||
201
- git_str_joinpath(path, path->ptr, subdir) < 0)
202
- return -1;
203
-
204
- if (git_fs_path_exists(path->ptr) &&
205
- git_str_join(out, GIT_PATH_LIST_SEPARATOR, out->ptr, path->ptr) < 0)
206
- return -1;
207
-
208
- git_str_truncate(path, orig_path_len);
209
- }
210
-
211
- return 0;
212
- }
213
-
214
- int git_win32__find_system_dirs(git_str *out, const char *subdir)
215
- {
216
- git_win32_path pathdir, regdir;
217
- git_str path8 = GIT_STR_INIT;
218
- bool has_pathdir, has_regdir;
219
- int error;
220
-
221
- has_pathdir = (find_sysdir_in_path(pathdir) == 0);
222
- has_regdir = (find_sysdir_in_registry(regdir) == 0);
223
-
224
- if (!has_pathdir && !has_regdir)
225
- return 0;
226
-
227
- /*
228
- * Usually the git in the path is the same git in the registry,
229
- * in this case there's no need to duplicate the paths.
230
- */
231
- if (has_pathdir && has_regdir && wcscmp(pathdir, regdir) == 0)
232
- has_regdir = false;
233
-
234
- if (has_pathdir) {
235
- if ((error = win32_path_to_8(&path8, pathdir)) < 0 ||
236
- (error = append_subdir(out, &path8, subdir)) < 0)
237
- goto done;
238
- }
239
-
240
- if (has_regdir) {
241
- if ((error = win32_path_to_8(&path8, regdir)) < 0 ||
242
- (error = append_subdir(out, &path8, subdir)) < 0)
243
- goto done;
244
- }
245
-
246
- done:
247
- git_str_dispose(&path8);
248
- return error;
249
- }
250
-
251
- int git_win32__find_global_dirs(git_str *out)
252
- {
253
- static const wchar_t *global_tmpls[4] = {
254
- L"%HOME%\\",
255
- L"%HOMEDRIVE%%HOMEPATH%\\",
256
- L"%USERPROFILE%\\",
257
- NULL,
258
- };
259
-
260
- return win32_find_existing_dirs(out, global_tmpls);
261
- }
262
-
263
- int git_win32__find_xdg_dirs(git_str *out)
264
- {
265
- static const wchar_t *global_tmpls[7] = {
266
- L"%XDG_CONFIG_HOME%\\git",
267
- L"%APPDATA%\\git",
268
- L"%LOCALAPPDATA%\\git",
269
- L"%HOME%\\.config\\git",
270
- L"%HOMEDRIVE%%HOMEPATH%\\.config\\git",
271
- L"%USERPROFILE%\\.config\\git",
272
- NULL,
273
- };
274
-
275
- return win32_find_existing_dirs(out, global_tmpls);
276
- }
277
-
278
- int git_win32__find_programdata_dirs(git_str *out)
279
- {
280
- static const wchar_t *programdata_tmpls[2] = {
281
- L"%PROGRAMDATA%\\Git",
282
- NULL,
283
- };
284
-
285
- return win32_find_existing_dirs(out, programdata_tmpls);
286
- }
@@ -1,22 +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
-
8
- #ifndef INCLUDE_win32_findfile_h__
9
- #define INCLUDE_win32_findfile_h__
10
-
11
- #include "git2_util.h"
12
-
13
- /** Sets the mock registry root for Git for Windows for testing. */
14
- extern int git_win32__set_registry_system_dir(const wchar_t *mock_sysdir);
15
-
16
- extern int git_win32__find_system_dirs(git_str *out, const char *subpath);
17
- extern int git_win32__find_global_dirs(git_str *out);
18
- extern int git_win32__find_xdg_dirs(git_str *out);
19
- extern int git_win32__find_programdata_dirs(git_str *out);
20
-
21
- #endif
22
-