rugged 0.26.0b3 → 0.26.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/ext/rugged/extconf.rb +10 -7
  4. data/ext/rugged/rugged.c +4 -6
  5. data/ext/rugged/rugged_repo.c +1 -1
  6. data/ext/rugged/rugged_revwalk.c +4 -4
  7. data/ext/rugged/rugged_tree.c +2 -2
  8. data/lib/rugged/version.rb +1 -1
  9. data/vendor/libgit2/CMakeLists.txt +13 -6
  10. data/vendor/libgit2/COPYING +33 -0
  11. data/vendor/libgit2/include/git2/branch.h +12 -0
  12. data/vendor/libgit2/include/git2/commit.h +6 -3
  13. data/vendor/libgit2/include/git2/common.h +11 -0
  14. data/vendor/libgit2/include/git2/errors.h +2 -0
  15. data/vendor/libgit2/include/git2/index.h +7 -6
  16. data/vendor/libgit2/include/git2/repository.h +91 -0
  17. data/vendor/libgit2/include/git2/stash.h +2 -2
  18. data/vendor/libgit2/include/git2/types.h +3 -0
  19. data/vendor/libgit2/include/git2/worktree.h +161 -0
  20. data/vendor/libgit2/src/attr.c +24 -16
  21. data/vendor/libgit2/src/attr_file.h +1 -1
  22. data/vendor/libgit2/src/attrcache.c +11 -10
  23. data/vendor/libgit2/src/attrcache.h +1 -4
  24. data/vendor/libgit2/src/blob.c +2 -2
  25. data/vendor/libgit2/src/branch.c +63 -0
  26. data/vendor/libgit2/src/buffer.h +2 -1
  27. data/vendor/libgit2/src/cache.c +21 -25
  28. data/vendor/libgit2/src/cache.h +1 -1
  29. data/vendor/libgit2/src/checkout.c +0 -2
  30. data/vendor/libgit2/src/cherrypick.c +2 -2
  31. data/vendor/libgit2/src/clone.c +2 -3
  32. data/vendor/libgit2/src/commit.c +8 -4
  33. data/vendor/libgit2/src/config_file.c +1 -3
  34. data/vendor/libgit2/src/describe.c +1 -3
  35. data/vendor/libgit2/src/diff_driver.c +2 -4
  36. data/vendor/libgit2/src/fetchhead.c +2 -2
  37. data/vendor/libgit2/src/fileops.c +1 -3
  38. data/vendor/libgit2/src/hash.h +5 -3
  39. data/vendor/libgit2/src/hash/hash_collisiondetect.h +57 -0
  40. data/vendor/libgit2/src/hash/sha1dc/sha1.c +1149 -0
  41. data/vendor/libgit2/src/hash/sha1dc/sha1.h +94 -0
  42. data/vendor/libgit2/src/hash/sha1dc/ubc_check.c +361 -0
  43. data/vendor/libgit2/src/hash/sha1dc/ubc_check.h +35 -0
  44. data/vendor/libgit2/src/idxmap.c +133 -0
  45. data/vendor/libgit2/src/idxmap.h +22 -60
  46. data/vendor/libgit2/src/ignore.c +7 -1
  47. data/vendor/libgit2/src/ignore.h +1 -1
  48. data/vendor/libgit2/src/index.c +11 -14
  49. data/vendor/libgit2/src/indexer.c +8 -11
  50. data/vendor/libgit2/src/merge.c +5 -5
  51. data/vendor/libgit2/src/mwindow.c +1 -3
  52. data/vendor/libgit2/src/odb.c +3 -3
  53. data/vendor/libgit2/src/odb.h +3 -0
  54. data/vendor/libgit2/src/odb_mempack.c +11 -18
  55. data/vendor/libgit2/src/offmap.c +83 -0
  56. data/vendor/libgit2/src/offmap.h +14 -34
  57. data/vendor/libgit2/src/oidmap.c +105 -0
  58. data/vendor/libgit2/src/oidmap.h +19 -22
  59. data/vendor/libgit2/src/pack-objects.c +10 -13
  60. data/vendor/libgit2/src/pack.c +17 -26
  61. data/vendor/libgit2/src/path.c +45 -24
  62. data/vendor/libgit2/src/rebase.c +3 -3
  63. data/vendor/libgit2/src/refdb_fs.c +81 -46
  64. data/vendor/libgit2/src/refs.c +13 -3
  65. data/vendor/libgit2/src/remote.c +6 -2
  66. data/vendor/libgit2/src/repository.c +318 -46
  67. data/vendor/libgit2/src/repository.h +5 -2
  68. data/vendor/libgit2/src/revert.c +2 -2
  69. data/vendor/libgit2/src/revwalk.c +6 -8
  70. data/vendor/libgit2/src/settings.c +5 -0
  71. data/vendor/libgit2/src/sortedcache.c +3 -5
  72. data/vendor/libgit2/src/strmap.c +95 -0
  73. data/vendor/libgit2/src/strmap.h +17 -37
  74. data/vendor/libgit2/src/submodule.c +12 -8
  75. data/vendor/libgit2/src/thread-utils.h +6 -0
  76. data/vendor/libgit2/src/transaction.c +5 -17
  77. data/vendor/libgit2/src/transports/local.c +2 -1
  78. data/vendor/libgit2/src/transports/smart.h +2 -0
  79. data/vendor/libgit2/src/transports/smart_protocol.c +3 -1
  80. data/vendor/libgit2/src/tree.c +2 -4
  81. data/vendor/libgit2/src/unix/posix.h +1 -1
  82. data/vendor/libgit2/src/worktree.c +432 -0
  83. data/vendor/libgit2/src/worktree.h +35 -0
  84. metadata +13 -2
@@ -0,0 +1,35 @@
1
+ /***
2
+ * Copyright 2017 Marc Stevens <marc@marc-stevens.nl>, Dan Shumow <danshu@microsoft.com>
3
+ * Distributed under the MIT Software License.
4
+ * See accompanying file LICENSE.txt or copy at
5
+ * https://opensource.org/licenses/MIT
6
+ ***/
7
+
8
+ // this file was generated by the 'parse_bitrel' program in the tools section
9
+ // using the data files from directory 'tools/data/3565'
10
+ //
11
+ // sha1_dvs contains a list of SHA-1 Disturbance Vectors (DV) to check
12
+ // dvType, dvK and dvB define the DV: I(K,B) or II(K,B) (see the paper)
13
+ // dm[80] is the expanded message block XOR-difference defined by the DV
14
+ // testt is the step to do the recompression from for collision detection
15
+ // maski and maskb define the bit to check for each DV in the dvmask returned by ubc_check
16
+ //
17
+ // ubc_check takes as input an expanded message block and verifies the unavoidable bitconditions for all listed DVs
18
+ // it returns a dvmask where each bit belonging to a DV is set if all unavoidable bitconditions for that DV have been met
19
+ // thus one needs to do the recompression check for each DV that has its bit set
20
+
21
+ #ifndef UBC_CHECK_H
22
+ #define UBC_CHECK_H
23
+
24
+ #include <stdint.h>
25
+
26
+ #define DVMASKSIZE 1
27
+ typedef struct { int dvType; int dvK; int dvB; int testt; int maski; int maskb; uint32_t dm[80]; } dv_info_t;
28
+ extern dv_info_t sha1_dvs[];
29
+ void ubc_check(const uint32_t W[80], uint32_t dvmask[DVMASKSIZE]);
30
+
31
+ #define DOSTORESTATE58
32
+ #define DOSTORESTATE65
33
+
34
+
35
+ #endif // UBC_CHECK_H
@@ -0,0 +1,133 @@
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 "idxmap.h"
9
+
10
+ /* This is __ac_X31_hash_string but with tolower and it takes the entry's stage into account */
11
+ static kh_inline khint_t idxentry_hash(const git_index_entry *e)
12
+ {
13
+ const char *s = e->path;
14
+ khint_t h = (khint_t)git__tolower(*s);
15
+ if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)git__tolower(*s);
16
+ return h + GIT_IDXENTRY_STAGE(e);
17
+ }
18
+
19
+ #define idxentry_equal(a, b) (GIT_IDXENTRY_STAGE(a) == GIT_IDXENTRY_STAGE(b) && strcmp(a->path, b->path) == 0)
20
+ #define idxentry_icase_equal(a, b) (GIT_IDXENTRY_STAGE(a) == GIT_IDXENTRY_STAGE(b) && strcasecmp(a->path, b->path) == 0)
21
+
22
+ __KHASH_IMPL(idx, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_equal)
23
+ __KHASH_IMPL(idxicase, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_icase_equal)
24
+
25
+ int git_idxmap_alloc(git_idxmap **map)
26
+ {
27
+ if ((*map = kh_init(idx)) == NULL) {
28
+ giterr_set_oom();
29
+ return -1;
30
+ }
31
+
32
+ return 0;
33
+ }
34
+
35
+ int git_idxmap_icase_alloc(git_idxmap_icase **map)
36
+ {
37
+ if ((*map = kh_init(idxicase)) == NULL) {
38
+ giterr_set_oom();
39
+ return -1;
40
+ }
41
+
42
+ return 0;
43
+ }
44
+
45
+ void git_idxmap_insert(git_idxmap *map, const git_index_entry *key, void *value, int *rval)
46
+ {
47
+ khiter_t idx = kh_put(idx, map, key, rval);
48
+
49
+ if ((*rval) >= 0) {
50
+ if ((*rval) == 0)
51
+ kh_key(map, idx) = key;
52
+ kh_val(map, idx) = value;
53
+ }
54
+ }
55
+
56
+ void git_idxmap_icase_insert(git_idxmap_icase *map, const git_index_entry *key, void *value, int *rval)
57
+ {
58
+ khiter_t idx = kh_put(idxicase, map, key, rval);
59
+
60
+ if ((*rval) >= 0) {
61
+ if ((*rval) == 0)
62
+ kh_key(map, idx) = key;
63
+ kh_val(map, idx) = value;
64
+ }
65
+ }
66
+
67
+ size_t git_idxmap_lookup_index(git_idxmap *map, const git_index_entry *key)
68
+ {
69
+ return kh_get(idx, map, key);
70
+ }
71
+
72
+ size_t git_idxmap_icase_lookup_index(git_idxmap_icase *map, const git_index_entry *key)
73
+ {
74
+ return kh_get(idxicase, map, key);
75
+ }
76
+
77
+ void *git_idxmap_value_at(git_idxmap *map, size_t idx)
78
+ {
79
+ return kh_val(map, idx);
80
+ }
81
+
82
+ int git_idxmap_valid_index(git_idxmap *map, size_t idx)
83
+ {
84
+ return idx != kh_end(map);
85
+ }
86
+
87
+ int git_idxmap_has_data(git_idxmap *map, size_t idx)
88
+ {
89
+ return kh_exist(map, idx);
90
+ }
91
+
92
+ void git_idxmap_resize(git_idxmap *map, size_t size)
93
+ {
94
+ kh_resize(idx, map, size);
95
+ }
96
+
97
+ void git_idxmap_icase_resize(git_idxmap_icase *map, size_t size)
98
+ {
99
+ kh_resize(idxicase, map, size);
100
+ }
101
+
102
+ void git_idxmap__free(git_idxmap *map)
103
+ {
104
+ kh_destroy(idx, map);
105
+ }
106
+
107
+ void git_idxmap_clear(git_idxmap *map)
108
+ {
109
+ kh_clear(idx, map);
110
+ }
111
+
112
+ void git_idxmap_delete_at(git_idxmap *map, size_t idx)
113
+ {
114
+ kh_del(idx, map, idx);
115
+ }
116
+
117
+ void git_idxmap_icase_delete_at(git_idxmap_icase *map, size_t idx)
118
+ {
119
+ kh_del(idxicase, map, idx);
120
+ }
121
+
122
+ void git_idxmap_delete(git_idxmap *map, const git_index_entry *key)
123
+ {
124
+ khiter_t idx = git_idxmap_lookup_index(map, key);
125
+ if (git_idxmap_valid_index(map, idx))
126
+ git_idxmap_delete_at(map, idx);
127
+ }
128
+ void git_idxmap_icase_delete(git_idxmap_icase *map, const git_index_entry *key)
129
+ {
130
+ khiter_t idx = git_idxmap_icase_lookup_index(map, key);
131
+ if (git_idxmap_valid_index((git_idxmap *)map, idx))
132
+ git_idxmap_icase_delete_at(map, idx);
133
+ }
@@ -26,66 +26,28 @@ typedef khash_t(idxicase) git_idxmap_icase;
26
26
 
27
27
  typedef khiter_t git_idxmap_iter;
28
28
 
29
- /* This is __ac_X31_hash_string but with tolower and it takes the entry's stage into account */
30
- static kh_inline khint_t idxentry_hash(const git_index_entry *e)
31
- {
32
- const char *s = e->path;
33
- khint_t h = (khint_t)git__tolower(*s);
34
- if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)git__tolower(*s);
35
- return h + GIT_IDXENTRY_STAGE(e);
36
- }
37
-
38
- #define idxentry_equal(a, b) (GIT_IDXENTRY_STAGE(a) == GIT_IDXENTRY_STAGE(b) && strcmp(a->path, b->path) == 0)
39
- #define idxentry_icase_equal(a, b) (GIT_IDXENTRY_STAGE(a) == GIT_IDXENTRY_STAGE(b) && strcasecmp(a->path, b->path) == 0)
40
-
41
- #define GIT__USE_IDXMAP \
42
- __KHASH_IMPL(idx, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_equal)
43
-
44
- #define GIT__USE_IDXMAP_ICASE \
45
- __KHASH_IMPL(idxicase, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_icase_equal)
46
-
47
- #define git_idxmap_alloc(hp) \
48
- ((*(hp) = kh_init(idx)) == NULL) ? giterr_set_oom(), -1 : 0
49
-
50
- #define git_idxmap_icase_alloc(hp) \
51
- ((*(hp) = kh_init(idxicase)) == NULL) ? giterr_set_oom(), -1 : 0
52
-
53
- #define git_idxmap_insert(h, key, val, rval) do { \
54
- khiter_t __pos = kh_put(idx, h, key, &rval); \
55
- if (rval >= 0) { \
56
- if (rval == 0) kh_key(h, __pos) = key; \
57
- kh_val(h, __pos) = val; \
58
- } } while (0)
59
-
60
- #define git_idxmap_icase_insert(h, key, val, rval) do { \
61
- khiter_t __pos = kh_put(idxicase, h, key, &rval); \
62
- if (rval >= 0) { \
63
- if (rval == 0) kh_key(h, __pos) = key; \
64
- kh_val(h, __pos) = val; \
65
- } } while (0)
66
-
67
- #define git_idxmap_lookup_index(h, k) kh_get(idx, h, k)
68
- #define git_idxmap_icase_lookup_index(h, k) kh_get(idxicase, h, k)
69
- #define git_idxmap_value_at(h, idx) kh_val(h, idx)
70
- #define git_idxmap_valid_index(h, idx) (idx != kh_end(h))
71
- #define git_idxmap_has_data(h, idx) kh_exist(h, idx)
72
-
73
- #define git_idxmap_resize(h,s) kh_resize(idx, h, s)
74
- #define git_idxmap_free(h) kh_destroy(idx, h), h = NULL
75
- #define git_idxmap_clear(h) kh_clear(idx, h)
76
-
77
- #define git_idxmap_delete_at(h, id) kh_del(idx, h, id)
78
- #define git_idxmap_icase_delete_at(h, id) kh_del(idxicase, h, id)
79
-
80
- #define git_idxmap_delete(h, key) do { \
81
- khiter_t __pos = git_idxmap_lookup_index(h, key); \
82
- if (git_idxmap_valid_index(h, __pos)) \
83
- git_idxmap_delete_at(h, __pos); } while (0)
84
-
85
- #define git_idxmap_icase_delete(h, key) do { \
86
- khiter_t __pos = git_idxmap_icase_lookup_index(h, key); \
87
- if (git_idxmap_valid_index(h, __pos)) \
88
- git_idxmap_icase_delete_at(h, __pos); } while (0)
29
+ int git_idxmap_alloc(git_idxmap **map);
30
+ int git_idxmap_icase_alloc(git_idxmap_icase **map);
31
+ void git_idxmap_insert(git_idxmap *map, const git_index_entry *key, void *value, int *rval);
32
+ void git_idxmap_icase_insert(git_idxmap_icase *map, const git_index_entry *key, void *value, int *rval);
33
+
34
+ size_t git_idxmap_lookup_index(git_idxmap *map, const git_index_entry *key);
35
+ size_t git_idxmap_icase_lookup_index(git_idxmap_icase *map, const git_index_entry *key);
36
+ void *git_idxmap_value_at(git_idxmap *map, size_t idx);
37
+ int git_idxmap_valid_index(git_idxmap *map, size_t idx);
38
+ int git_idxmap_has_data(git_idxmap *map, size_t idx);
39
+
40
+ void git_idxmap_resize(git_idxmap *map, size_t size);
41
+ void git_idxmap_icase_resize(git_idxmap_icase *map, size_t size);
42
+ #define git_idxmap_free(h) git_idxmap__free(h); (h) = NULL
43
+ void git_idxmap__free(git_idxmap *map);
44
+ void git_idxmap_clear(git_idxmap *map);
45
+
46
+ void git_idxmap_delete_at(git_idxmap *map, size_t idx);
47
+ void git_idxmap_icase_delete_at(git_idxmap_icase *map, size_t idx);
48
+
49
+ void git_idxmap_delete(git_idxmap *map, const git_index_entry *key);
50
+ void git_idxmap_icase_delete(git_idxmap_icase *map, const git_index_entry *key);
89
51
 
90
52
  #define git_idxmap_begin kh_begin
91
53
  #define git_idxmap_end kh_end
@@ -277,6 +277,7 @@ int git_ignore__for_path(
277
277
  {
278
278
  int error = 0;
279
279
  const char *workdir = git_repository_workdir(repo);
280
+ git_buf infopath = GIT_BUF_INIT;
280
281
 
281
282
  assert(repo && ignores && path);
282
283
 
@@ -322,10 +323,14 @@ int git_ignore__for_path(
322
323
  goto cleanup;
323
324
  }
324
325
 
326
+ if ((error = git_repository_item_path(&infopath,
327
+ repo, GIT_REPOSITORY_ITEM_INFO)) < 0)
328
+ goto cleanup;
329
+
325
330
  /* load .git/info/exclude */
326
331
  error = push_ignore_file(
327
332
  ignores, &ignores->ign_global,
328
- git_repository_path(repo), GIT_IGNORE_FILE_INREPO);
333
+ infopath.ptr, GIT_IGNORE_FILE_INREPO);
329
334
  if (error < 0)
330
335
  goto cleanup;
331
336
 
@@ -336,6 +341,7 @@ int git_ignore__for_path(
336
341
  git_repository_attr_cache(repo)->cfg_excl_file);
337
342
 
338
343
  cleanup:
344
+ git_buf_free(&infopath);
339
345
  if (error < 0)
340
346
  git_ignore__free(ignores);
341
347
 
@@ -12,7 +12,7 @@
12
12
  #include "attr_file.h"
13
13
 
14
14
  #define GIT_IGNORE_FILE ".gitignore"
15
- #define GIT_IGNORE_FILE_INREPO "info/exclude"
15
+ #define GIT_IGNORE_FILE_INREPO "exclude"
16
16
  #define GIT_IGNORE_FILE_XDG "ignore"
17
17
 
18
18
  /* The git_ignores structure maintains three sets of ignores:
@@ -27,9 +27,6 @@
27
27
  #include "git2/config.h"
28
28
  #include "git2/sys/index.h"
29
29
 
30
- GIT__USE_IDXMAP
31
- GIT__USE_IDXMAP_ICASE
32
-
33
30
  #define INSERT_IN_MAP_EX(idx, map, e, err) do { \
34
31
  if ((idx)->ignore_case) \
35
32
  git_idxmap_icase_insert((khash_t(idxicase) *) (map), (e), (e), (err)); \
@@ -1365,7 +1362,7 @@ static int index_insert(
1365
1362
  error = git_vector_insert_sorted(&index->entries, entry, index_no_dups);
1366
1363
 
1367
1364
  if (error == 0) {
1368
- INSERT_IN_MAP(index, entry, error);
1365
+ INSERT_IN_MAP(index, entry, &error);
1369
1366
  }
1370
1367
  }
1371
1368
 
@@ -1592,7 +1589,7 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
1592
1589
  if ((ret = git_vector_insert(&index->entries, entry)) < 0)
1593
1590
  break;
1594
1591
 
1595
- INSERT_IN_MAP(index, entry, ret);
1592
+ INSERT_IN_MAP(index, entry, &ret);
1596
1593
  if (ret < 0)
1597
1594
  break;
1598
1595
  }
@@ -2479,9 +2476,9 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2479
2476
  assert(!index->entries.length);
2480
2477
 
2481
2478
  if (index->ignore_case)
2482
- kh_resize(idxicase, (khash_t(idxicase) *) index->entries_map, header.entry_count);
2479
+ git_idxmap_icase_resize((khash_t(idxicase) *) index->entries_map, header.entry_count);
2483
2480
  else
2484
- kh_resize(idx, index->entries_map, header.entry_count);
2481
+ git_idxmap_resize(index->entries_map, header.entry_count);
2485
2482
 
2486
2483
  /* Parse all the entries */
2487
2484
  for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) {
@@ -2499,7 +2496,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2499
2496
  goto done;
2500
2497
  }
2501
2498
 
2502
- INSERT_IN_MAP(index, entry, error);
2499
+ INSERT_IN_MAP(index, entry, &error);
2503
2500
 
2504
2501
  if (error < 0) {
2505
2502
  index_entry_free(entry);
@@ -2979,12 +2976,12 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
2979
2976
  goto cleanup;
2980
2977
 
2981
2978
  if (index->ignore_case)
2982
- kh_resize(idxicase, (khash_t(idxicase) *) entries_map, entries.length);
2979
+ git_idxmap_icase_resize((khash_t(idxicase) *) entries_map, entries.length);
2983
2980
  else
2984
- kh_resize(idx, entries_map, entries.length);
2981
+ git_idxmap_resize(entries_map, entries.length);
2985
2982
 
2986
2983
  git_vector_foreach(&entries, i, e) {
2987
- INSERT_IN_MAP_EX(index, entries_map, e, error);
2984
+ INSERT_IN_MAP_EX(index, entries_map, e, &error);
2988
2985
 
2989
2986
  if (error < 0) {
2990
2987
  giterr_set(GITERR_INDEX, "failed to insert entry into map");
@@ -3037,9 +3034,9 @@ static int git_index_read_iterator(
3037
3034
  goto done;
3038
3035
 
3039
3036
  if (index->ignore_case && new_length_hint)
3040
- kh_resize(idxicase, (khash_t(idxicase) *) new_entries_map, new_length_hint);
3037
+ git_idxmap_icase_resize((khash_t(idxicase) *) new_entries_map, new_length_hint);
3041
3038
  else if (new_length_hint)
3042
- kh_resize(idx, new_entries_map, new_length_hint);
3039
+ git_idxmap_resize(new_entries_map, new_length_hint);
3043
3040
 
3044
3041
  opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE |
3045
3042
  GIT_ITERATOR_INCLUDE_CONFLICTS;
@@ -3103,7 +3100,7 @@ static int git_index_read_iterator(
3103
3100
 
3104
3101
  if (add_entry) {
3105
3102
  if ((error = git_vector_insert(&new_entries, add_entry)) == 0)
3106
- INSERT_IN_MAP_EX(index, new_entries_map, add_entry, error);
3103
+ INSERT_IN_MAP_EX(index, new_entries_map, add_entry, &error);
3107
3104
  }
3108
3105
 
3109
3106
  if (remove_entry && error >= 0)
@@ -18,8 +18,6 @@
18
18
  #include "oidmap.h"
19
19
  #include "zstream.h"
20
20
 
21
- GIT__USE_OIDMAP
22
-
23
21
  extern git_mutex git__mwindow_mutex;
24
22
 
25
23
  #define UINT31_MAX (0x7FFFFFFF)
@@ -294,7 +292,7 @@ static int store_object(git_indexer *idx)
294
292
  git_oid_cpy(&pentry->sha1, &oid);
295
293
  pentry->offset = entry_start;
296
294
 
297
- k = kh_put(oid, idx->pack->idx_cache, &pentry->sha1, &error);
295
+ k = git_oidmap_put(idx->pack->idx_cache, &pentry->sha1, &error);
298
296
  if (error == -1) {
299
297
  git__free(pentry);
300
298
  giterr_set_oom();
@@ -308,7 +306,7 @@ static int store_object(git_indexer *idx)
308
306
  }
309
307
 
310
308
 
311
- kh_value(idx->pack->idx_cache, k) = pentry;
309
+ git_oidmap_set_value_at(idx->pack->idx_cache, k, pentry);
312
310
 
313
311
  git_oid_cpy(&entry->oid, &oid);
314
312
 
@@ -333,9 +331,7 @@ on_error:
333
331
 
334
332
  GIT_INLINE(bool) has_entry(git_indexer *idx, git_oid *id)
335
333
  {
336
- khiter_t k;
337
- k = kh_get(oid, idx->pack->idx_cache, id);
338
- return (k != kh_end(idx->pack->idx_cache));
334
+ return git_oidmap_exists(idx->pack->idx_cache, id);
339
335
  }
340
336
 
341
337
  static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_entry *pentry, git_off_t entry_start)
@@ -351,14 +347,14 @@ static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_ent
351
347
  }
352
348
 
353
349
  pentry->offset = entry_start;
354
- k = kh_put(oid, idx->pack->idx_cache, &pentry->sha1, &error);
350
+ k = git_oidmap_put(idx->pack->idx_cache, &pentry->sha1, &error);
355
351
 
356
352
  if (error <= 0) {
357
353
  giterr_set(GITERR_INDEXER, "cannot insert object into pack");
358
354
  return -1;
359
355
  }
360
356
 
361
- kh_value(idx->pack->idx_cache, k) = pentry;
357
+ git_oidmap_set_value_at(idx->pack->idx_cache, k, pentry);
362
358
 
363
359
  /* Add the object to the list */
364
360
  if (git_vector_insert(&idx->objects, entry) < 0)
@@ -1106,8 +1102,9 @@ void git_indexer_free(git_indexer *idx)
1106
1102
 
1107
1103
  if (idx->pack->idx_cache) {
1108
1104
  struct git_pack_entry *pentry;
1109
- kh_foreach_value(
1110
- idx->pack->idx_cache, pentry, { git__free(pentry); });
1105
+ git_oidmap_foreach_value(idx->pack->idx_cache, pentry, {
1106
+ git__free(pentry);
1107
+ });
1111
1108
 
1112
1109
  git_oidmap_free(idx->pack->idx_cache);
1113
1110
  }
@@ -562,7 +562,7 @@ int git_repository_mergehead_foreach(
562
562
 
563
563
  assert(repo && cb);
564
564
 
565
- if ((error = git_buf_joinpath(&merge_head_path, repo->path_repository,
565
+ if ((error = git_buf_joinpath(&merge_head_path, repo->gitdir,
566
566
  GIT_MERGE_HEAD_FILE)) < 0)
567
567
  return error;
568
568
 
@@ -2277,7 +2277,7 @@ static int write_merge_head(
2277
2277
 
2278
2278
  assert(repo && heads);
2279
2279
 
2280
- if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_HEAD_FILE)) < 0 ||
2280
+ if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_HEAD_FILE)) < 0 ||
2281
2281
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_MERGE_FILE_MODE)) < 0)
2282
2282
  goto cleanup;
2283
2283
 
@@ -2305,7 +2305,7 @@ static int write_merge_mode(git_repository *repo)
2305
2305
 
2306
2306
  assert(repo);
2307
2307
 
2308
- if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MODE_FILE)) < 0 ||
2308
+ if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MODE_FILE)) < 0 ||
2309
2309
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_MERGE_FILE_MODE)) < 0)
2310
2310
  goto cleanup;
2311
2311
 
@@ -2536,7 +2536,7 @@ static int write_merge_msg(
2536
2536
  for (i = 0; i < heads_len; i++)
2537
2537
  entries[i].merge_head = heads[i];
2538
2538
 
2539
- if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
2539
+ if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
2540
2540
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_MERGE_FILE_MODE)) < 0 ||
2541
2541
  (error = git_filebuf_write(&file, "Merge ", 6)) < 0)
2542
2542
  goto cleanup;
@@ -2914,7 +2914,7 @@ int git_merge__append_conflicts_to_merge_msg(
2914
2914
  if (!git_index_has_conflicts(index))
2915
2915
  return 0;
2916
2916
 
2917
- if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
2917
+ if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
2918
2918
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_APPEND, GIT_MERGE_FILE_MODE)) < 0)
2919
2919
  goto cleanup;
2920
2920