rugged 0.23.0 → 0.23.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_remote.c +1 -8
  3. data/ext/rugged/rugged_submodule_collection.c +3 -3
  4. data/lib/rugged/version.rb +1 -1
  5. data/vendor/libgit2/CMakeLists.txt +3 -1
  6. data/vendor/libgit2/include/git2/diff.h +19 -0
  7. data/vendor/libgit2/include/git2/errors.h +1 -12
  8. data/vendor/libgit2/include/git2/remote.h +9 -1
  9. data/vendor/libgit2/include/git2/repository.h +1 -1
  10. data/vendor/libgit2/include/git2/sys/config.h +1 -1
  11. data/vendor/libgit2/include/git2/sys/diff.h +4 -4
  12. data/vendor/libgit2/include/git2/sys/filter.h +4 -1
  13. data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
  14. data/vendor/libgit2/include/git2/sys/refdb_backend.h +4 -3
  15. data/vendor/libgit2/include/git2/transport.h +14 -21
  16. data/vendor/libgit2/src/blame_git.c +10 -15
  17. data/vendor/libgit2/src/blob.c +6 -0
  18. data/vendor/libgit2/src/branch.c +1 -12
  19. data/vendor/libgit2/src/cache.c +4 -4
  20. data/vendor/libgit2/src/checkout.c +2 -2
  21. data/vendor/libgit2/src/clone.c +2 -2
  22. data/vendor/libgit2/src/common.h +13 -4
  23. data/vendor/libgit2/src/curl_stream.c +7 -7
  24. data/vendor/libgit2/src/describe.c +1 -1
  25. data/vendor/libgit2/src/diff.c +25 -0
  26. data/vendor/libgit2/src/errors.c +75 -40
  27. data/vendor/libgit2/src/filebuf.c +6 -1
  28. data/vendor/libgit2/src/filebuf.h +2 -0
  29. data/vendor/libgit2/src/filter.c +14 -9
  30. data/vendor/libgit2/src/global.c +25 -9
  31. data/vendor/libgit2/src/global.h +1 -0
  32. data/vendor/libgit2/src/index.c +75 -2
  33. data/vendor/libgit2/src/indexer.c +1 -1
  34. data/vendor/libgit2/src/iterator.c +6 -3
  35. data/vendor/libgit2/src/khash.h +1 -1
  36. data/vendor/libgit2/src/merge.c +3 -3
  37. data/vendor/libgit2/src/openssl_stream.c +5 -2
  38. data/vendor/libgit2/src/pack-objects.c +1 -1
  39. data/vendor/libgit2/src/pack.c +2 -2
  40. data/vendor/libgit2/src/path.c +25 -4
  41. data/vendor/libgit2/src/path.h +6 -1
  42. data/vendor/libgit2/src/push.h +3 -1
  43. data/vendor/libgit2/src/rebase.c +2 -2
  44. data/vendor/libgit2/src/refdb_fs.c +7 -0
  45. data/vendor/libgit2/src/remote.c +18 -9
  46. data/vendor/libgit2/src/revwalk.c +1 -1
  47. data/vendor/libgit2/src/stash.c +1 -1
  48. data/vendor/libgit2/src/stransport_stream.c +1 -1
  49. data/vendor/libgit2/src/submodule.c +12 -1
  50. data/vendor/libgit2/src/sysdir.c +22 -8
  51. data/vendor/libgit2/src/thread-utils.c +2 -0
  52. data/vendor/libgit2/src/transports/git.c +2 -0
  53. data/vendor/libgit2/src/transports/http.c +2 -2
  54. data/vendor/libgit2/src/transports/smart_pkt.c +1 -1
  55. data/vendor/libgit2/src/transports/ssh.c +4 -2
  56. data/vendor/libgit2/src/transports/winhttp.c +1 -1
  57. data/vendor/libgit2/src/util.c +48 -0
  58. data/vendor/libgit2/src/util.h +13 -5
  59. data/vendor/libgit2/src/win32/posix_w32.c +2 -0
  60. data/vendor/libgit2/src/win32/{buffer.c → w32_buffer.c} +1 -2
  61. data/vendor/libgit2/src/win32/{buffer.h → w32_buffer.h} +0 -0
  62. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +343 -0
  63. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +93 -0
  64. data/vendor/libgit2/src/win32/w32_stack.c +192 -0
  65. data/vendor/libgit2/src/win32/w32_stack.h +138 -0
  66. data/vendor/libgit2/src/xdiff/xdiff.h +10 -6
  67. data/vendor/libgit2/src/xdiff/xdiffi.c +46 -4
  68. data/vendor/libgit2/src/xdiff/xdiffi.h +1 -0
  69. data/vendor/libgit2/src/xdiff/xemit.c +43 -6
  70. data/vendor/libgit2/src/xdiff/xemit.h +1 -1
  71. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  72. data/vendor/libgit2/src/xdiff/xmerge.c +2 -2
  73. data/vendor/libgit2/src/xdiff/xpatience.c +1 -1
  74. data/vendor/libgit2/src/xdiff/xprepare.c +10 -11
  75. data/vendor/libgit2/src/xdiff/xutils.c +13 -29
  76. data/vendor/libgit2/src/xdiff/xutils.h +1 -0
  77. metadata +84 -80
@@ -14,6 +14,7 @@
14
14
  typedef struct {
15
15
  git_error *last_error;
16
16
  git_error error_t;
17
+ git_buf error_buf;
17
18
  char oid_fmt[GIT_OID_HEXSZ+1];
18
19
  } git_global_st;
19
20
 
@@ -1228,6 +1228,45 @@ int git_index_add_frombuffer(
1228
1228
  return 0;
1229
1229
  }
1230
1230
 
1231
+ static int add_repo_as_submodule(git_index_entry **out, git_index *index, const char *path)
1232
+ {
1233
+ git_repository *sub;
1234
+ git_buf abspath = GIT_BUF_INIT;
1235
+ git_repository *repo = INDEX_OWNER(index);
1236
+ git_reference *head;
1237
+ git_index_entry *entry;
1238
+ struct stat st;
1239
+ int error;
1240
+
1241
+ if (index_entry_create(&entry, INDEX_OWNER(index), path) < 0)
1242
+ return -1;
1243
+
1244
+ if ((error = git_buf_joinpath(&abspath, git_repository_workdir(repo), path)) < 0)
1245
+ return error;
1246
+
1247
+ if ((error = p_stat(abspath.ptr, &st)) < 0) {
1248
+ giterr_set(GITERR_OS, "failed to stat repository dir");
1249
+ return -1;
1250
+ }
1251
+
1252
+ git_index_entry__init_from_stat(entry, &st, !index->distrust_filemode);
1253
+
1254
+ if ((error = git_repository_open(&sub, abspath.ptr)) < 0)
1255
+ return error;
1256
+
1257
+ if ((error = git_repository_head(&head, sub)) < 0)
1258
+ return error;
1259
+
1260
+ git_oid_cpy(&entry->id, git_reference_target(head));
1261
+ entry->mode = GIT_FILEMODE_COMMIT;
1262
+
1263
+ git_reference_free(head);
1264
+ git_repository_free(sub);
1265
+ git_buf_free(&abspath);
1266
+
1267
+ *out = entry;
1268
+ return 0;
1269
+ }
1231
1270
 
1232
1271
  int git_index_add_bypath(git_index *index, const char *path)
1233
1272
  {
@@ -1236,10 +1275,44 @@ int git_index_add_bypath(git_index *index, const char *path)
1236
1275
 
1237
1276
  assert(index && path);
1238
1277
 
1239
- if ((ret = index_entry_init(&entry, index, path)) < 0 ||
1240
- (ret = index_insert(index, &entry, 1, false)) < 0)
1278
+ if ((ret = index_entry_init(&entry, index, path)) == 0)
1279
+ ret = index_insert(index, &entry, 1, false);
1280
+
1281
+ /* If we were given a directory, let's see if it's a submodule */
1282
+ if (ret < 0 && ret != GIT_EDIRECTORY)
1241
1283
  return ret;
1242
1284
 
1285
+ if (ret == GIT_EDIRECTORY) {
1286
+ git_submodule *sm;
1287
+ git_error_state err;
1288
+
1289
+ giterr_state_capture(&err, ret);
1290
+
1291
+ ret = git_submodule_lookup(&sm, INDEX_OWNER(index), path);
1292
+ if (ret == GIT_ENOTFOUND)
1293
+ return giterr_state_restore(&err);
1294
+
1295
+ giterr_state_free(&err);
1296
+
1297
+ /*
1298
+ * EEXISTS means that there is a repository at that path, but it's not known
1299
+ * as a submodule. We add its HEAD as an entry and don't register it.
1300
+ */
1301
+ if (ret == GIT_EEXISTS) {
1302
+ if ((ret = add_repo_as_submodule(&entry, index, path)) < 0)
1303
+ return ret;
1304
+
1305
+ if ((ret = index_insert(index, &entry, 1, false)) < 0)
1306
+ return ret;
1307
+ } else if (ret < 0) {
1308
+ return ret;
1309
+ } else {
1310
+ ret = git_submodule_add_to_index(sm, false);
1311
+ git_submodule_free(sm);
1312
+ return ret;
1313
+ }
1314
+ }
1315
+
1243
1316
  /* Adding implies conflict was resolved, move conflict entries to REUC */
1244
1317
  if ((ret = index_conflict_to_reuc(index, path)) < 0 && ret != GIT_ENOTFOUND)
1245
1318
  return ret;
@@ -18,7 +18,7 @@
18
18
  #include "oidmap.h"
19
19
  #include "zstream.h"
20
20
 
21
- GIT__USE_OIDMAP;
21
+ GIT__USE_OIDMAP
22
22
 
23
23
  extern git_mutex git__mwindow_mutex;
24
24
 
@@ -1027,8 +1027,11 @@ static int dirload_with_stat(
1027
1027
  strncomp = (flags & GIT_PATH_DIR_IGNORE_CASE) != 0 ?
1028
1028
  git__strncasecmp : git__strncmp;
1029
1029
 
1030
- if ((error = git_path_diriter_init(&diriter, dirpath, flags)) < 0)
1030
+ /* Any error here is equivalent to the dir not existing, skip over it */
1031
+ if ((error = git_path_diriter_init(&diriter, dirpath, flags)) < 0) {
1032
+ error = GIT_ENOTFOUND;
1031
1033
  goto done;
1034
+ }
1032
1035
 
1033
1036
  while ((error = git_path_diriter_next(&diriter)) == 0) {
1034
1037
  if ((error = git_path_diriter_fullpath(&path, &path_len, &diriter)) < 0)
@@ -1117,7 +1120,7 @@ static int fs_iterator__expand_dir(fs_iterator *fi)
1117
1120
 
1118
1121
  if (error < 0) {
1119
1122
  git_error_state last_error = { 0 };
1120
- giterr_capture(&last_error, error);
1123
+ giterr_state_capture(&last_error, error);
1121
1124
 
1122
1125
  /* these callbacks may clear the error message */
1123
1126
  fs_iterator__free_frame(ff);
@@ -1125,7 +1128,7 @@ static int fs_iterator__expand_dir(fs_iterator *fi)
1125
1128
  /* next time return value we skipped to */
1126
1129
  fi->base.flags &= ~GIT_ITERATOR_FIRST_ACCESS;
1127
1130
 
1128
- return giterr_restore(&last_error);
1131
+ return giterr_state_restore(&last_error);
1129
1132
  }
1130
1133
 
1131
1134
  if (ff->entries.length == 0) {
@@ -619,4 +619,4 @@ typedef const char *kh_cstr_t;
619
619
  #define KHASH_MAP_INIT_STR(name, khval_t) \
620
620
  KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
621
621
 
622
- #endif /* __AC_KHASH_H */
622
+ #endif /* __AC_KHASH_H */
@@ -79,7 +79,7 @@ int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_reposito
79
79
  unsigned int i;
80
80
 
81
81
  if (length < 2) {
82
- giterr_set(GITERR_INVALID, "At least two commits are required to find an ancestor. Provided 'length' was %u.", length);
82
+ giterr_set(GITERR_INVALID, "At least two commits are required to find an ancestor. Provided 'length' was %" PRIuZ ".", length);
83
83
  return -1;
84
84
  }
85
85
 
@@ -185,7 +185,7 @@ int git_merge_base_octopus(git_oid *out, git_repository *repo, size_t length, co
185
185
  assert(out && repo && input_array);
186
186
 
187
187
  if (length < 2) {
188
- giterr_set(GITERR_INVALID, "At least two commits are required to find an ancestor. Provided 'length' was %u.", length);
188
+ giterr_set(GITERR_INVALID, "At least two commits are required to find an ancestor. Provided 'length' was %" PRIuZ ".", length);
189
189
  return -1;
190
190
  }
191
191
 
@@ -2451,7 +2451,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
2451
2451
  goto done;
2452
2452
 
2453
2453
  if ((conflicts = index_conflicts + wd_conflicts) > 0) {
2454
- giterr_set(GITERR_MERGE, "%d uncommitted change%s would be overwritten by merge",
2454
+ giterr_set(GITERR_MERGE, "%" PRIuZ " uncommitted change%s would be overwritten by merge",
2455
2455
  conflicts, (conflicts != 1) ? "s" : "");
2456
2456
  error = GIT_ECONFLICT;
2457
2457
  }
@@ -324,7 +324,9 @@ int openssl_connect(git_stream *stream)
324
324
 
325
325
  SSL_set_bio(st->ssl, bio, bio);
326
326
  /* specify the host in case SNI is needed */
327
+ #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
327
328
  SSL_set_tlsext_host_name(st->ssl, st->host);
329
+ #endif
328
330
 
329
331
  if ((ret = SSL_connect(st->ssl)) <= 0)
330
332
  return ssl_set_error(st->ssl, ret);
@@ -358,11 +360,12 @@ int openssl_certificate(git_cert **out, git_stream *stream)
358
360
  return -1;
359
361
  }
360
362
 
361
- st->cert_info.cert_type = GIT_CERT_X509;
363
+ st->cert_info.parent.cert_type = GIT_CERT_X509;
362
364
  st->cert_info.data = encoded_cert;
363
365
  st->cert_info.len = len;
364
366
 
365
- *out = (git_cert *)&st->cert_info;
367
+ *out = &st->cert_info.parent;
368
+
366
369
  return 0;
367
370
  }
368
371
 
@@ -41,7 +41,7 @@ struct pack_write_context {
41
41
  git_transfer_progress *stats;
42
42
  };
43
43
 
44
- GIT__USE_OIDMAP;
44
+ GIT__USE_OIDMAP
45
45
 
46
46
  #ifdef GIT_THREADS
47
47
 
@@ -16,8 +16,8 @@
16
16
 
17
17
  #include <zlib.h>
18
18
 
19
- GIT__USE_OFFMAP;
20
- GIT__USE_OIDMAP;
19
+ GIT__USE_OFFMAP
20
+ GIT__USE_OIDMAP
21
21
 
22
22
  static int packfile_open(struct git_pack_file *p);
23
23
  static git_off_t nth_packed_object_offset(const struct git_pack_file *p, uint32_t n);
@@ -10,8 +10,9 @@
10
10
  #include "repository.h"
11
11
  #ifdef GIT_WIN32
12
12
  #include "win32/posix.h"
13
- #include "win32/buffer.h"
13
+ #include "win32/w32_buffer.h"
14
14
  #include "win32/w32_util.h"
15
+ #include "win32/version.h"
15
16
  #else
16
17
  #include <dirent.h>
17
18
  #endif
@@ -1085,7 +1086,7 @@ int git_path_direach(
1085
1086
  #if defined(GIT_WIN32) && !defined(__MINGW32__)
1086
1087
 
1087
1088
  /* Using _FIND_FIRST_EX_LARGE_FETCH may increase performance in Windows 7
1088
- * and better. Prior versions will ignore this.
1089
+ * and better.
1089
1090
  */
1090
1091
  #ifndef FIND_FIRST_EX_LARGE_FETCH
1091
1092
  # define FIND_FIRST_EX_LARGE_FETCH 2
@@ -1099,6 +1100,10 @@ int git_path_diriter_init(
1099
1100
  git_win32_path path_filter;
1100
1101
  git_buf hack = {0};
1101
1102
 
1103
+ static int is_win7_or_later = -1;
1104
+ if (is_win7_or_later < 0)
1105
+ is_win7_or_later = git_has_win32_version(6, 1, 0);
1106
+
1102
1107
  assert(diriter && path);
1103
1108
 
1104
1109
  memset(diriter, 0, sizeof(git_path_diriter));
@@ -1122,11 +1127,11 @@ int git_path_diriter_init(
1122
1127
 
1123
1128
  diriter->handle = FindFirstFileExW(
1124
1129
  path_filter,
1125
- FindExInfoBasic,
1130
+ is_win7_or_later ? FindExInfoBasic : FindExInfoStandard,
1126
1131
  &diriter->current,
1127
1132
  FindExSearchNameMatch,
1128
1133
  NULL,
1129
- FIND_FIRST_EX_LARGE_FETCH);
1134
+ is_win7_or_later ? FIND_FIRST_EX_LARGE_FETCH : 0);
1130
1135
 
1131
1136
  if (diriter->handle == INVALID_HANDLE_VALUE) {
1132
1137
  giterr_set(GITERR_OS, "Could not open directory '%s'", path);
@@ -1671,3 +1676,19 @@ bool git_path_isvalid(
1671
1676
 
1672
1677
  return verify_component(repo, start, (c - start), flags);
1673
1678
  }
1679
+
1680
+ int git_path_normalize_slashes(git_buf *out, const char *path)
1681
+ {
1682
+ int error;
1683
+ char *p;
1684
+
1685
+ if ((error = git_buf_puts(out, path)) < 0)
1686
+ return error;
1687
+
1688
+ for (p = out->ptr; *p; p++) {
1689
+ if (*p == '\\')
1690
+ *p = '/';
1691
+ }
1692
+
1693
+ return 0;
1694
+ }
@@ -319,7 +319,7 @@ extern int git_path_cmp(
319
319
  * @param callback Function to invoke on each path. Passed the `payload`
320
320
  * and the buffer containing the current path. The path should not
321
321
  * be modified in any way. Return non-zero to stop iteration.
322
- * @param state Passed to fn as the first ath.
322
+ * @param payload Passed to fn as the first ath.
323
323
  */
324
324
  extern int git_path_walk_up(
325
325
  git_buf *pathbuf,
@@ -591,4 +591,9 @@ extern bool git_path_isvalid(
591
591
  const char *path,
592
592
  unsigned int flags);
593
593
 
594
+ /**
595
+ * Convert any backslashes into slashes
596
+ */
597
+ int git_path_normalize_slashes(git_buf *out, const char *path);
598
+
594
599
  #endif
@@ -83,7 +83,7 @@ int git_push_add_refspec(git_push *push, const char *refspec);
83
83
  * Update remote tips after a push
84
84
  *
85
85
  * @param push The push object
86
- * @param signature The identity to use when updating reflogs
86
+ * @param callbacks the callbacks to use for this connection
87
87
  *
88
88
  * @return 0 or an error code
89
89
  */
@@ -100,6 +100,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks);
100
100
  * order to find out which updates were accepted or rejected.
101
101
  *
102
102
  * @param push The push object
103
+ * @param callbacks the callbacks to use for this connection
103
104
  *
104
105
  * @return 0 or an error code
105
106
  */
@@ -117,6 +118,7 @@ int git_push_finish(git_push *push, const git_remote_callbacks *callbacks);
117
118
  *
118
119
  * @param push The push object
119
120
  * @param cb The callback to call on each object
121
+ * @param data The payload passed to the callback
120
122
  *
121
123
  * @return 0 on success, non-zero callback return value, or error code
122
124
  */
@@ -436,7 +436,7 @@ static int rebase_setupfiles_merge(git_rebase *rebase)
436
436
  size_t i;
437
437
  int error = 0;
438
438
 
439
- if ((error = rebase_setupfile(rebase, END_FILE, -1, "%d\n", git_array_size(rebase->operations))) < 0 ||
439
+ if ((error = rebase_setupfile(rebase, END_FILE, -1, "%" PRIuZ "\n", git_array_size(rebase->operations))) < 0 ||
440
440
  (error = rebase_setupfile(rebase, ONTO_NAME_FILE, -1, "%s\n", rebase->onto_name)) < 0)
441
441
  goto done;
442
442
 
@@ -789,7 +789,7 @@ static int rebase_next_merge(
789
789
  normalize_checkout_options_for_apply(&checkout_opts, rebase, current_commit);
790
790
 
791
791
  if ((error = git_indexwriter_init_for_operation(&indexwriter, rebase->repo, &checkout_opts.checkout_strategy)) < 0 ||
792
- (error = rebase_setupfile(rebase, MSGNUM_FILE, -1, "%d\n", rebase->current+1)) < 0 ||
792
+ (error = rebase_setupfile(rebase, MSGNUM_FILE, -1, "%" PRIuZ "\n", rebase->current+1)) < 0 ||
793
793
  (error = rebase_setupfile(rebase, CURRENT_FILE, -1, "%.*s\n", GIT_OID_HEXSZ, current_idstr)) < 0 ||
794
794
  (error = git_merge_trees(&index, rebase->repo, parent_tree, head_tree, current_tree, NULL)) < 0 ||
795
795
  (error = git_merge__check_result(rebase->repo, index)) < 0 ||
@@ -63,6 +63,8 @@ typedef struct refdb_fs_backend {
63
63
  uint32_t direach_flags;
64
64
  } refdb_fs_backend;
65
65
 
66
+ static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name);
67
+
66
68
  static int packref_cmp(const void *a_, const void *b_)
67
69
  {
68
70
  const struct packref *a = a_, *b = b_;
@@ -1217,6 +1219,11 @@ static int refdb_fs_backend__delete(
1217
1219
  if ((error = loose_lock(&file, backend, ref_name)) < 0)
1218
1220
  return error;
1219
1221
 
1222
+ if ((error = refdb_reflog_fs__delete(_backend, ref_name)) < 0) {
1223
+ git_filebuf_cleanup(&file);
1224
+ return error;
1225
+ }
1226
+
1220
1227
  return refdb_fs_backend__delete_tail(_backend, &file, ref_name, old_id, old_target);
1221
1228
  }
1222
1229
 
@@ -153,7 +153,7 @@ static int get_check_cert(int *out, git_repository *repo)
153
153
  * most specific to least specific. */
154
154
 
155
155
  /* GIT_SSL_NO_VERIFY environment variable */
156
- if ((val = getenv("GIT_SSL_NO_VERIFY")) != NULL)
156
+ if ((val = p_getenv("GIT_SSL_NO_VERIFY")) != NULL)
157
157
  return git_config_parse_bool(out, val);
158
158
 
159
159
  /* http.sslVerify config setting */
@@ -759,7 +759,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
759
759
  {
760
760
  git_config *cfg;
761
761
  git_config_entry *ce = NULL;
762
- const char *val = NULL;
762
+ git_buf val = GIT_BUF_INIT;
763
763
  int error;
764
764
 
765
765
  assert(remote);
@@ -789,7 +789,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
789
789
  return error;
790
790
 
791
791
  if (ce && ce->value) {
792
- val = ce->value;
792
+ *proxy_url = git__strdup(ce->value);
793
793
  goto found;
794
794
  }
795
795
  }
@@ -797,19 +797,28 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
797
797
  /* http.proxy config setting */
798
798
  if ((error = git_config__lookup_entry(&ce, cfg, "http.proxy", false)) < 0)
799
799
  return error;
800
+
800
801
  if (ce && ce->value) {
801
- val = ce->value;
802
+ *proxy_url = git__strdup(ce->value);
802
803
  goto found;
803
804
  }
804
805
 
805
806
  /* HTTP_PROXY / HTTPS_PROXY environment variables */
806
- val = use_ssl ? getenv("HTTPS_PROXY") : getenv("HTTP_PROXY");
807
+ error = git__getenv(&val, use_ssl ? "HTTPS_PROXY" : "HTTP_PROXY");
807
808
 
808
- found:
809
- if (val && val[0]) {
810
- *proxy_url = git__strdup(val);
811
- GITERR_CHECK_ALLOC(*proxy_url);
809
+ if (error < 0) {
810
+ if (error == GIT_ENOTFOUND) {
811
+ giterr_clear();
812
+ error = 0;
813
+ }
814
+
815
+ return error;
812
816
  }
817
+
818
+ *proxy_url = git_buf_detach(&val);
819
+
820
+ found:
821
+ GITERR_CHECK_ALLOC(*proxy_url);
813
822
  git_config_entry_free(ce);
814
823
 
815
824
  return 0;
@@ -14,7 +14,7 @@
14
14
  #include "git2/revparse.h"
15
15
  #include "merge.h"
16
16
 
17
- GIT__USE_OIDMAP;
17
+ GIT__USE_OIDMAP
18
18
 
19
19
  git_commit_list_node *git_revwalk__commit_lookup(
20
20
  git_revwalk *walk, const git_oid *oid)
@@ -770,7 +770,7 @@ static int ensure_clean_index(git_repository *repo, git_index *index)
770
770
  goto done;
771
771
 
772
772
  if (git_diff_num_deltas(index_diff) > 0) {
773
- giterr_set(GITERR_STASH, "%d uncommitted changes exist in the index",
773
+ giterr_set(GITERR_STASH, "%" PRIuZ " uncommitted changes exist in the index",
774
774
  git_diff_num_deltas(index_diff));
775
775
  error = GIT_EUNCOMMITTED;
776
776
  }