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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +4 -4
  3. data/ext/rugged/rugged.c +12 -1
  4. data/ext/rugged/rugged_blame.c +22 -6
  5. data/ext/rugged/rugged_blob.c +24 -9
  6. data/ext/rugged/rugged_branch.c +10 -7
  7. data/ext/rugged/rugged_branch_collection.c +8 -6
  8. data/ext/rugged/rugged_commit.c +7 -6
  9. data/ext/rugged/rugged_config.c +20 -11
  10. data/ext/rugged/rugged_diff.c +26 -12
  11. data/ext/rugged/rugged_diff_hunk.c +2 -1
  12. data/ext/rugged/rugged_index.c +39 -29
  13. data/ext/rugged/rugged_note.c +7 -6
  14. data/ext/rugged/rugged_object.c +3 -2
  15. data/ext/rugged/rugged_patch.c +23 -9
  16. data/ext/rugged/rugged_rebase.c +22 -10
  17. data/ext/rugged/rugged_reference.c +22 -13
  18. data/ext/rugged/rugged_reference_collection.c +9 -7
  19. data/ext/rugged/rugged_remote.c +23 -12
  20. data/ext/rugged/rugged_remote_collection.c +11 -9
  21. data/ext/rugged/rugged_repo.c +60 -45
  22. data/ext/rugged/rugged_revwalk.c +22 -12
  23. data/ext/rugged/rugged_submodule.c +23 -20
  24. data/ext/rugged/rugged_submodule_collection.c +20 -9
  25. data/ext/rugged/rugged_tag.c +6 -4
  26. data/ext/rugged/rugged_tag_collection.c +7 -5
  27. data/ext/rugged/rugged_tree.c +27 -15
  28. data/lib/rugged/version.rb +1 -1
  29. data/vendor/libgit2/AUTHORS +2 -0
  30. data/vendor/libgit2/CMakeLists.txt +1 -1
  31. data/vendor/libgit2/cmake/DefaultCFlags.cmake +4 -1
  32. data/vendor/libgit2/cmake/SelectSSH.cmake +9 -3
  33. data/vendor/libgit2/deps/pcre/CMakeLists.txt +2 -3
  34. data/vendor/libgit2/deps/xdiff/CMakeLists.txt +1 -1
  35. data/vendor/libgit2/deps/xdiff/xmerge.c +14 -10
  36. data/vendor/libgit2/include/git2/deprecated.h +1 -1
  37. data/vendor/libgit2/include/git2/index.h +1 -1
  38. data/vendor/libgit2/include/git2/merge.h +4 -2
  39. data/vendor/libgit2/include/git2/oid.h +0 -1
  40. data/vendor/libgit2/include/git2/proxy.h +2 -3
  41. data/vendor/libgit2/include/git2/remote.h +19 -7
  42. data/vendor/libgit2/include/git2/stdint.h +1 -1
  43. data/vendor/libgit2/include/git2/sys/transport.h +1 -1
  44. data/vendor/libgit2/include/git2/version.h +4 -2
  45. data/vendor/libgit2/src/cli/CMakeLists.txt +1 -2
  46. data/vendor/libgit2/src/cli/opt.c +3 -3
  47. data/vendor/libgit2/src/cli/opt_usage.c +1 -1
  48. data/vendor/libgit2/src/libgit2/CMakeLists.txt +32 -16
  49. data/vendor/libgit2/src/libgit2/attr_file.c +10 -3
  50. data/vendor/libgit2/src/libgit2/clone.c +6 -0
  51. data/vendor/libgit2/src/libgit2/commit.c +1 -1
  52. data/vendor/libgit2/src/libgit2/commit_graph.c +1 -2
  53. data/vendor/libgit2/src/libgit2/config.c +1 -1
  54. data/vendor/libgit2/src/libgit2/config_file.c +2 -1
  55. data/vendor/libgit2/src/libgit2/config_mem.c +1 -0
  56. data/vendor/libgit2/src/libgit2/config_parse.c +2 -1
  57. data/vendor/libgit2/src/libgit2/delta.c +5 -1
  58. data/vendor/libgit2/src/libgit2/diff_driver.c +1 -1
  59. data/vendor/libgit2/src/libgit2/diff_stats.c +19 -12
  60. data/vendor/libgit2/src/libgit2/fetchhead.c +1 -1
  61. data/vendor/libgit2/src/libgit2/index.c +8 -8
  62. data/vendor/libgit2/src/libgit2/index.h +3 -0
  63. data/vendor/libgit2/src/libgit2/indexer.c +2 -2
  64. data/vendor/libgit2/src/libgit2/merge.c +1 -1
  65. data/vendor/libgit2/src/libgit2/merge.h +4 -0
  66. data/vendor/libgit2/src/libgit2/merge_file.c +43 -30
  67. data/vendor/libgit2/src/libgit2/message.c +1 -1
  68. data/vendor/libgit2/src/libgit2/midx.c +2 -3
  69. data/vendor/libgit2/src/libgit2/odb.c +2 -6
  70. data/vendor/libgit2/src/libgit2/odb_loose.c +24 -14
  71. data/vendor/libgit2/src/libgit2/oid.c +4 -5
  72. data/vendor/libgit2/src/libgit2/pack-objects.c +2 -4
  73. data/vendor/libgit2/src/libgit2/pack.c +3 -0
  74. data/vendor/libgit2/src/libgit2/refs.c +15 -6
  75. data/vendor/libgit2/src/libgit2/remote.c +4 -1
  76. data/vendor/libgit2/src/libgit2/remote.h +0 -1
  77. data/vendor/libgit2/src/libgit2/repository.c +5 -4
  78. data/vendor/libgit2/src/libgit2/streams/socket.c +30 -0
  79. data/vendor/libgit2/src/libgit2/submodule.c +12 -5
  80. data/vendor/libgit2/src/libgit2/tag.c +3 -1
  81. data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +2 -0
  82. data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
  83. data/vendor/libgit2/src/libgit2/transports/git.c +1 -1
  84. data/vendor/libgit2/src/libgit2/transports/httpclient.c +12 -9
  85. data/vendor/libgit2/src/libgit2/transports/local.c +8 -1
  86. data/vendor/libgit2/src/libgit2/transports/smart.c +5 -5
  87. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +3 -3
  88. data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +57 -18
  89. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +3 -3
  90. data/vendor/libgit2/src/util/CMakeLists.txt +3 -4
  91. data/vendor/libgit2/src/util/fs_path.c +66 -6
  92. data/vendor/libgit2/src/util/fs_path.h +6 -0
  93. data/vendor/libgit2/src/util/futils.h +11 -3
  94. data/vendor/libgit2/src/util/hash/builtin.c +14 -4
  95. data/vendor/libgit2/src/util/hash/openssl.c +0 -4
  96. data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +8 -6
  97. data/vendor/libgit2/src/util/hashmap.h +1 -0
  98. data/vendor/libgit2/src/util/net.c +5 -5
  99. data/vendor/libgit2/src/util/process.h +2 -1
  100. data/vendor/libgit2/src/util/runtime.c +2 -2
  101. data/vendor/libgit2/src/util/str.c +18 -6
  102. data/vendor/libgit2/src/util/str.h +5 -3
  103. data/vendor/libgit2/src/util/unix/process.c +92 -15
  104. data/vendor/libgit2/src/util/util.c +16 -3
  105. data/vendor/libgit2/src/util/util.h +1 -0
  106. data/vendor/libgit2/src/util/win32/path_w32.c +81 -5
  107. data/vendor/libgit2/src/util/win32/process.c +22 -6
  108. metadata +17 -6
@@ -268,21 +268,23 @@ int git_str_splice(
268
268
  * @param str String buffer to append data to
269
269
  * @param string String to escape and append
270
270
  * @param esc_chars Characters to be escaped
271
- * @param esc_with String to insert in from of each found character
271
+ * @param esc_prefix String to insert as prefix of each found character
272
+ * @param esc_suffix String to insert as suffix of each found character
272
273
  * @return 0 on success, <0 on failure (probably allocation problem)
273
274
  */
274
275
  extern int git_str_puts_escaped(
275
276
  git_str *str,
276
277
  const char *string,
277
278
  const char *esc_chars,
278
- const char *esc_with);
279
+ const char *esc_prefix,
280
+ const char *esc_suffix);
279
281
 
280
282
  /**
281
283
  * Append string escaping characters that are regex special
282
284
  */
283
285
  GIT_INLINE(int) git_str_puts_escape_regex(git_str *str, const char *string)
284
286
  {
285
- return git_str_puts_escaped(str, string, "^.[]$()|*+?{}\\", "\\");
287
+ return git_str_puts_escaped(str, string, "^.[]$()|*+?{}\\", "\\", NULL);
286
288
  }
287
289
 
288
290
  /**
@@ -12,6 +12,7 @@
12
12
 
13
13
  #include "git2_util.h"
14
14
  #include "vector.h"
15
+ #include "futils.h"
15
16
  #include "process.h"
16
17
  #include "strlist.h"
17
18
 
@@ -28,7 +29,8 @@ struct git_process {
28
29
 
29
30
  char *cwd;
30
31
 
31
- unsigned int capture_in : 1,
32
+ unsigned int use_shell : 1,
33
+ capture_in : 1,
32
34
  capture_out : 1,
33
35
  capture_err : 1;
34
36
 
@@ -42,7 +44,7 @@ struct git_process {
42
44
 
43
45
  GIT_INLINE(bool) is_delete_env(const char *env)
44
46
  {
45
- char *c = strchr(env, '=');
47
+ const char *c = strchr(env, '=');
46
48
 
47
49
  if (c == NULL)
48
50
  return false;
@@ -50,6 +52,53 @@ GIT_INLINE(bool) is_delete_env(const char *env)
50
52
  return *(c+1) == '\0';
51
53
  }
52
54
 
55
+ GIT_INLINE(int) insert_dup(git_vector *v, const char *s)
56
+ {
57
+ char *dup = git__strdup(s);
58
+
59
+ GIT_ERROR_CHECK_ALLOC(dup);
60
+
61
+ return git_vector_insert(v, dup);
62
+ }
63
+
64
+ static int setup_args(
65
+ char ***out,
66
+ const char **args,
67
+ size_t args_len,
68
+ bool use_shell)
69
+ {
70
+ git_vector prefixed = GIT_VECTOR_INIT;
71
+ git_str first = GIT_STR_INIT;
72
+ size_t cnt;
73
+
74
+ GIT_ASSERT(args && args_len);
75
+
76
+ if (use_shell) {
77
+ if (git_str_puts(&first, args[0]) < 0 ||
78
+ git_str_puts(&first, " \"$@\"") < 0 ||
79
+ insert_dup(&prefixed, "/bin/sh") < 0 ||
80
+ insert_dup(&prefixed, "-c") < 0 ||
81
+ git_vector_insert(&prefixed, git_str_detach(&first)) < 0)
82
+ goto on_error;
83
+ }
84
+
85
+ for (cnt = 0; args && cnt < args_len; cnt++) {
86
+ if (insert_dup(&prefixed, args[cnt]) < 0)
87
+ goto on_error;
88
+ }
89
+
90
+ git_vector_insert(&prefixed, NULL);
91
+
92
+ *out = (char **)prefixed.contents;
93
+
94
+ return 0;
95
+
96
+ on_error:
97
+ git_str_dispose(&first);
98
+ git_vector_dispose_deep(&prefixed);
99
+ return -1;
100
+ }
101
+
53
102
  static int merge_env(
54
103
  char ***out,
55
104
  const char **env,
@@ -57,7 +106,7 @@ static int merge_env(
57
106
  bool exclude_env)
58
107
  {
59
108
  git_vector merged = GIT_VECTOR_INIT;
60
- char **kv, *dup;
109
+ char **kv;
61
110
  size_t max, cnt;
62
111
  int error = 0;
63
112
 
@@ -71,10 +120,7 @@ static int merge_env(
71
120
  if (is_delete_env(env[cnt]))
72
121
  continue;
73
122
 
74
- dup = git__strdup(env[cnt]);
75
- GIT_ERROR_CHECK_ALLOC(dup);
76
-
77
- if ((error = git_vector_insert(&merged, dup)) < 0)
123
+ if (insert_dup(&merged, env[cnt]) < 0)
78
124
  goto on_error;
79
125
  }
80
126
 
@@ -83,10 +129,7 @@ static int merge_env(
83
129
  if (env && git_strlist_contains_key(env, env_len, *kv, '='))
84
130
  continue;
85
131
 
86
- dup = git__strdup(*kv);
87
- GIT_ERROR_CHECK_ALLOC(dup);
88
-
89
- if ((error = git_vector_insert(&merged, dup)) < 0)
132
+ if (insert_dup(&merged, *kv) < 0)
90
133
  goto on_error;
91
134
  }
92
135
  }
@@ -125,13 +168,14 @@ int git_process_new(
125
168
  process = git__calloc(sizeof(git_process), 1);
126
169
  GIT_ERROR_CHECK_ALLOC(process);
127
170
 
128
- if (git_strlist_copy_with_null(&process->args, args, args_len) < 0 ||
171
+ if (setup_args(&process->args, args, args_len, opts ? opts->use_shell : false) < 0 ||
129
172
  merge_env(&process->env, env, env_len, opts ? opts->exclude_env : false) < 0) {
130
173
  git_process_free(process);
131
174
  return -1;
132
175
  }
133
176
 
134
177
  if (opts) {
178
+ process->use_shell = opts->use_shell;
135
179
  process->capture_in = opts->capture_in;
136
180
  process->capture_out = opts->capture_out;
137
181
  process->capture_err = opts->capture_err;
@@ -158,10 +202,12 @@ extern int git_process_new_from_cmdline(
158
202
  size_t env_len,
159
203
  git_process_options *opts)
160
204
  {
161
- const char *args[] = { "/bin/sh", "-c", cmdline };
205
+ git_process_options merged_opts = {0};
162
206
 
163
- return git_process_new(out,
164
- args, ARRAY_SIZE(args), env, env_len, opts);
207
+ memcpy(&merged_opts, opts, sizeof(git_process_options));
208
+ merged_opts.use_shell = 1;
209
+
210
+ return git_process_new(out, &cmdline, 1, env, env_len, &merged_opts);
165
211
  }
166
212
 
167
213
  #define CLOSE_FD(fd) \
@@ -271,6 +317,33 @@ static void write_status(int fd, const char *fn, int error, int os_error)
271
317
  try_write_status(fd, fn, fn_len);
272
318
  }
273
319
 
320
+ static int resolve_path(git_process *process)
321
+ {
322
+ git_str full_path = GIT_STR_INIT;
323
+ int error = 0;
324
+
325
+ /* The shell will resolve the path for us */
326
+ if (process->use_shell)
327
+ goto done;
328
+
329
+ error = git_fs_path_find_executable(&full_path, process->args[0]);
330
+
331
+ if (error == GIT_ENOTFOUND) {
332
+ git_error_set(GIT_ERROR_SSH, "cannot run %s: No such file or directory", process->args[0]);
333
+ error = -1;
334
+ }
335
+
336
+ if (error)
337
+ goto done;
338
+
339
+ git__free(process->args[0]);
340
+ process->args[0] = git_str_detach(&full_path);
341
+
342
+ done:
343
+ git_str_dispose(&full_path);
344
+ return error;
345
+ }
346
+
274
347
  int git_process_start(git_process *process)
275
348
  {
276
349
  int in[2] = { -1, -1 }, out[2] = { -1, -1 },
@@ -278,6 +351,10 @@ int git_process_start(git_process *process)
278
351
  int fdflags, state, error;
279
352
  pid_t pid;
280
353
 
354
+ /* Locate the path (unless we're letting the shell do it for us) */
355
+ if ((error = resolve_path(process)) < 0)
356
+ goto on_error;
357
+
281
358
  /* Set up the pipes to read from/write to the process */
282
359
  if ((process->capture_in && pipe(in) < 0) ||
283
360
  (process->capture_out && pipe(out) < 0) ||
@@ -269,13 +269,26 @@ int git__prefixncmp_icase(const char *str, size_t str_n, const char *prefix)
269
269
  return prefixcmp(str, str_n, prefix, true);
270
270
  }
271
271
 
272
- int git__suffixcmp(const char *str, const char *suffix)
272
+ static int suffixcmp(const char *str, const char *suffix, bool icase)
273
273
  {
274
274
  size_t a = strlen(str);
275
275
  size_t b = strlen(suffix);
276
+
276
277
  if (a < b)
277
278
  return -1;
278
- return strcmp(str + (a - b), suffix);
279
+
280
+ return icase ? strcasecmp(str + (a - b), suffix) :
281
+ strcmp(str + (a - b), suffix);
282
+ }
283
+
284
+ int git__suffixcmp(const char *str, const char *suffix)
285
+ {
286
+ return suffixcmp(str, suffix, false);
287
+ }
288
+
289
+ int git__suffixcmp_icase(const char *str, const char *suffix)
290
+ {
291
+ return suffixcmp(str, suffix, true);
279
292
  }
280
293
 
281
294
  char *git__strtok(char **end, const char *sep)
@@ -323,7 +336,7 @@ char *git__strsep(char **end, const char *sep)
323
336
 
324
337
  size_t git__linenlen(const char *buffer, size_t buffer_len)
325
338
  {
326
- char *nl = memchr(buffer, '\n', buffer_len);
339
+ const char *nl = memchr(buffer, '\n', buffer_len);
327
340
  return nl ? (size_t)(nl - buffer) + 1 : buffer_len;
328
341
  }
329
342
 
@@ -57,6 +57,7 @@ extern int git__prefixcmp_icase(const char *str, const char *prefix);
57
57
  extern int git__prefixncmp(const char *str, size_t str_n, const char *prefix);
58
58
  extern int git__prefixncmp_icase(const char *str, size_t str_n, const char *prefix);
59
59
  extern int git__suffixcmp(const char *str, const char *suffix);
60
+ extern int git__suffixcmp_icase(const char *str, const char *suffix);
60
61
 
61
62
  GIT_INLINE(int) git__signum(int val)
62
63
  {
@@ -153,6 +153,7 @@ int git_win32_path_canonicalize(git_win32_path path)
153
153
 
154
154
  static int git_win32_path_join(
155
155
  git_win32_path dest,
156
+ size_t *dest_len,
156
157
  const wchar_t *one,
157
158
  size_t one_len,
158
159
  const wchar_t *two,
@@ -176,6 +177,9 @@ static int git_win32_path_join(
176
177
  memcpy(dest + one_len + backslash, two, two_len * sizeof(wchar_t));
177
178
  dest[one_len + backslash + two_len] = L'\0';
178
179
 
180
+ if (dest_len)
181
+ *dest_len = one_len + backslash + two_len;
182
+
179
183
  return 0;
180
184
  }
181
185
 
@@ -253,21 +257,92 @@ static void win32_path_iter_dispose(struct win32_path_iter *iter)
253
257
  iter->current_dir = NULL;
254
258
  }
255
259
 
260
+ struct executable_suffix {
261
+ const wchar_t *suffix;
262
+ size_t len;
263
+ };
264
+
265
+ static struct executable_suffix suffixes[] = { { NULL, 0 }, { L".exe", 4 }, { L".cmd", 4 } };
266
+
267
+ static bool has_executable_suffix(wchar_t *exe, size_t exe_len)
268
+ {
269
+ size_t i;
270
+
271
+ for (i = 0; i < ARRAY_SIZE(suffixes); i++) {
272
+ struct executable_suffix *suffix = &suffixes[i];
273
+
274
+ if (!suffix->len)
275
+ continue;
276
+
277
+ if (exe_len < suffix->len)
278
+ continue;
279
+
280
+ if (memcmp(&exe[exe_len - suffix->len], suffix->suffix, suffix->len) == 0)
281
+ return true;
282
+ }
283
+
284
+ return false;
285
+ }
286
+
287
+ static int is_executable(git_win32_path path, size_t path_len, bool suffixed)
288
+ {
289
+ size_t i;
290
+
291
+ /*
292
+ * if the given name has an executable suffix, then try looking for it
293
+ * directly. in all cases, append executable extensions
294
+ * (".exe", ".cmd"...)
295
+ */
296
+ for (i = suffixed ? 0 : 1; i < ARRAY_SIZE(suffixes); i++) {
297
+ struct executable_suffix *suffix = &suffixes[i];
298
+
299
+ if (suffix->len) {
300
+ if (path_len + suffix->len > MAX_PATH)
301
+ continue;
302
+
303
+ wcscat(path, suffix->suffix);
304
+ }
305
+
306
+ if (_waccess(path, 0) == 0)
307
+ return true;
308
+
309
+ path[path_len] = L'\0';
310
+ }
311
+
312
+ return false;
313
+ }
314
+
256
315
  int git_win32_path_find_executable(git_win32_path fullpath, wchar_t *exe)
257
316
  {
258
317
  struct win32_path_iter path_iter;
259
318
  const wchar_t *dir;
260
- size_t dir_len, exe_len = wcslen(exe);
261
- bool found = false;
319
+ size_t dir_len, exe_len, fullpath_len;
320
+ bool suffixed = false, found = false;
321
+
322
+ if ((exe_len = wcslen(exe)) > MAX_PATH)
323
+ goto done;
324
+
325
+ /* see if the given executable has an executable suffix; if so we will
326
+ * look for the explicit name directly, as well as with added suffixes.
327
+ */
328
+ suffixed = has_executable_suffix(exe, exe_len);
329
+
330
+ /* For fully-qualified paths we do not look in PATH */
331
+ if (wcschr(exe, L'\\') != NULL || wcschr(exe, L'/') != NULL) {
332
+ if ((found = is_executable(exe, exe_len, suffixed)))
333
+ wcscpy(fullpath, exe);
334
+
335
+ goto done;
336
+ }
262
337
 
263
338
  if (win32_path_iter_init(&path_iter) < 0)
264
339
  return -1;
265
340
 
266
- while (win32_path_iter_next(&dir, &dir_len, &path_iter) != GIT_ITEROVER) {
267
- if (git_win32_path_join(fullpath, dir, dir_len, exe, exe_len) < 0)
341
+ while (win32_path_iter_next(&dir, &dir_len, &path_iter) != GIT_ITEROVER && !found) {
342
+ if (git_win32_path_join(fullpath, &fullpath_len, dir, dir_len, exe, exe_len) < 0)
268
343
  continue;
269
344
 
270
- if (_waccess(fullpath, 0) == 0) {
345
+ if (is_executable(fullpath, fullpath_len, suffixed)) {
271
346
  found = true;
272
347
  break;
273
348
  }
@@ -275,6 +350,7 @@ int git_win32_path_find_executable(git_win32_path fullpath, wchar_t *exe)
275
350
 
276
351
  win32_path_iter_dispose(&path_iter);
277
352
 
353
+ done:
278
354
  if (found)
279
355
  return 0;
280
356
 
@@ -11,6 +11,7 @@
11
11
  #include "git2_util.h"
12
12
  #include "process.h"
13
13
  #include "strlist.h"
14
+ #include "fs_path.h"
14
15
 
15
16
  #ifndef DWORD_MAX
16
17
  # define DWORD_MAX INT32_MAX
@@ -19,7 +20,8 @@
19
20
  #define ENV_MAX 32767
20
21
 
21
22
  struct git_process {
22
- wchar_t *appname;
23
+ char *app_name;
24
+ wchar_t *app_path;
23
25
  wchar_t *cmdline;
24
26
  wchar_t *env;
25
27
 
@@ -178,8 +180,7 @@ static int process_new(
178
180
  process = git__calloc(1, sizeof(git_process));
179
181
  GIT_ERROR_CHECK_ALLOC(process);
180
182
 
181
- if (appname &&
182
- git_utf8_to_16_alloc(&process->appname, appname) < 0) {
183
+ if (appname && (process->app_name = git__strdup(appname)) == NULL) {
183
184
  error = -1;
184
185
  goto done;
185
186
  }
@@ -233,7 +234,7 @@ int git_process_new(
233
234
  size_t env_len,
234
235
  git_process_options *opts)
235
236
  {
236
- git_str cmdline = GIT_STR_INIT;
237
+ git_str cmd_path = GIT_STR_INIT, cmdline = GIT_STR_INIT;
237
238
  int error;
238
239
 
239
240
  GIT_ASSERT_ARG(out && args && args_len > 0);
@@ -244,6 +245,7 @@ int git_process_new(
244
245
  error = process_new(out, args[0], cmdline.ptr, env, env_len, opts);
245
246
 
246
247
  done:
248
+ git_str_dispose(&cmd_path);
247
249
  git_str_dispose(&cmdline);
248
250
  return error;
249
251
  }
@@ -259,6 +261,19 @@ int git_process_start(git_process *process)
259
261
  out[2] = { NULL, NULL },
260
262
  err[2] = { NULL, NULL };
261
263
 
264
+ if (process->app_name) {
265
+ git_str cmd_path = GIT_STR_INIT;
266
+ int error;
267
+
268
+ if ((error = git_fs_path_find_executable(&cmd_path, process->app_name)) == 0)
269
+ error = git_utf8_to_16_alloc(&process->app_path, cmd_path.ptr);
270
+
271
+ git_str_dispose(&cmd_path);
272
+
273
+ if (error < 0)
274
+ goto on_error;
275
+ }
276
+
262
277
  memset(&security_attrs, 0, sizeof(SECURITY_ATTRIBUTES));
263
278
  security_attrs.bInheritHandle = TRUE;
264
279
 
@@ -303,7 +318,7 @@ int git_process_start(git_process *process)
303
318
 
304
319
  memset(&process->process_info, 0, sizeof(PROCESS_INFORMATION));
305
320
 
306
- if (!CreateProcessW(process->appname, process->cmdline,
321
+ if (!CreateProcessW(process->app_path, process->cmdline,
307
322
  NULL, NULL, TRUE, flags, process->env,
308
323
  process->cwd,
309
324
  &startup_info,
@@ -501,6 +516,7 @@ void git_process_free(git_process *process)
501
516
  git__free(process->env);
502
517
  git__free(process->cwd);
503
518
  git__free(process->cmdline);
504
- git__free(process->appname);
519
+ git__free(process->app_path);
520
+ git__free(process->app_name);
505
521
  git__free(process);
506
522
  }
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugged
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
8
8
  - Vicent Marti
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2025-01-03 00:00:00.000000000 Z
11
+ date: 2026-06-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake-compiler
@@ -53,6 +52,20 @@ dependencies:
53
52
  - - "~>"
54
53
  - !ruby/object:Gem::Version
55
54
  version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: base64
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
56
69
  description: |
57
70
  Rugged is a Ruby bindings to the libgit2 linkable C Git library. This is
58
71
  for testing and using the libgit2 library in a language that is awesome.
@@ -751,7 +764,6 @@ licenses:
751
764
  - MIT
752
765
  metadata:
753
766
  msys2_mingw_dependencies: libssh2 cmake
754
- post_install_message:
755
767
  rdoc_options: []
756
768
  require_paths:
757
769
  - lib
@@ -766,8 +778,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
766
778
  - !ruby/object:Gem::Version
767
779
  version: '0'
768
780
  requirements: []
769
- rubygems_version: 3.3.7
770
- signing_key:
781
+ rubygems_version: 4.0.3
771
782
  specification_version: 4
772
783
  summary: Rugged is a Ruby binding to the libgit2 linkable library
773
784
  test_files: []