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
@@ -126,8 +126,9 @@ struct git_repository {
126
126
  git_attr_cache *attrcache;
127
127
  git_diff_driver_registry *diff_drivers;
128
128
 
129
- char *path_repository;
130
- char *path_gitlink;
129
+ char *gitlink;
130
+ char *gitdir;
131
+ char *commondir;
131
132
  char *workdir;
132
133
  char *namespace;
133
134
 
@@ -137,6 +138,7 @@ struct git_repository {
137
138
  git_array_t(git_buf) reserved_names;
138
139
 
139
140
  unsigned is_bare:1;
141
+ unsigned is_worktree:1;
140
142
 
141
143
  unsigned int lru_counter;
142
144
 
@@ -152,6 +154,7 @@ GIT_INLINE(git_attr_cache *) git_repository_attr_cache(git_repository *repo)
152
154
  }
153
155
 
154
156
  int git_repository_head_tree(git_tree **tree, git_repository *repo);
157
+ int git_repository_create_head(const char *git_dir, const char *ref_name);
155
158
 
156
159
  /*
157
160
  * Weak pointers to repository internals.
@@ -27,7 +27,7 @@ static int write_revert_head(
27
27
  git_buf file_path = GIT_BUF_INIT;
28
28
  int error = 0;
29
29
 
30
- if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_REVERT_HEAD_FILE)) >= 0 &&
30
+ if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_REVERT_HEAD_FILE)) >= 0 &&
31
31
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) >= 0 &&
32
32
  (error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
33
33
  error = git_filebuf_commit(&file);
@@ -49,7 +49,7 @@ static int write_merge_msg(
49
49
  git_buf file_path = GIT_BUF_INIT;
50
50
  int error = 0;
51
51
 
52
- if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
52
+ if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
53
53
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) < 0 ||
54
54
  (error = git_filebuf_printf(&file, "Revert \"%s\"\n\nThis reverts commit %s.\n",
55
55
  commit_msgline, commit_oidstr)) < 0)
@@ -15,8 +15,6 @@
15
15
  #include "merge.h"
16
16
  #include "vector.h"
17
17
 
18
- GIT__USE_OIDMAP
19
-
20
18
  git_commit_list_node *git_revwalk__commit_lookup(
21
19
  git_revwalk *walk, const git_oid *oid)
22
20
  {
@@ -25,9 +23,9 @@ git_commit_list_node *git_revwalk__commit_lookup(
25
23
  int ret;
26
24
 
27
25
  /* lookup and reserve space if not already present */
28
- pos = kh_get(oid, walk->commits, oid);
29
- if (pos != kh_end(walk->commits))
30
- return kh_value(walk->commits, pos);
26
+ pos = git_oidmap_lookup_index(walk->commits, oid);
27
+ if (git_oidmap_valid_index(walk->commits, pos))
28
+ return git_oidmap_value_at(walk->commits, pos);
31
29
 
32
30
  commit = git_commit_list_alloc_node(walk);
33
31
  if (commit == NULL)
@@ -35,9 +33,9 @@ git_commit_list_node *git_revwalk__commit_lookup(
35
33
 
36
34
  git_oid_cpy(&commit->oid, oid);
37
35
 
38
- pos = kh_put(oid, walk->commits, &commit->oid, &ret);
36
+ pos = git_oidmap_put(walk->commits, &commit->oid, &ret);
39
37
  assert(ret != 0);
40
- kh_value(walk->commits, pos) = commit;
38
+ git_oidmap_set_value_at(walk->commits, pos, commit);
41
39
 
42
40
  return commit;
43
41
  }
@@ -702,7 +700,7 @@ void git_revwalk_reset(git_revwalk *walk)
702
700
 
703
701
  assert(walk);
704
702
 
705
- kh_foreach_value(walk->commits, commit, {
703
+ git_oidmap_foreach_value(walk->commits, commit, {
706
704
  commit->seen = 0;
707
705
  commit->in_degree = 0;
708
706
  commit->topo_delay = 0;
@@ -16,6 +16,7 @@
16
16
  #include "global.h"
17
17
  #include "object.h"
18
18
  #include "refs.h"
19
+ #include "transports/smart.h"
19
20
 
20
21
  void git_libgit2_version(int *major, int *minor, int *rev)
21
22
  {
@@ -222,6 +223,10 @@ int git_libgit2_opts(int key, ...)
222
223
  }
223
224
  break;
224
225
 
226
+ case GIT_OPT_ENABLE_OFS_DELTA:
227
+ git_smart__ofs_delta_enabled = (va_arg(ap, int) != 0);
228
+ break;
229
+
225
230
  default:
226
231
  giterr_set(GITERR_INVALID, "invalid option key");
227
232
  error = -1;
@@ -1,7 +1,5 @@
1
1
  #include "sortedcache.h"
2
2
 
3
- GIT__USE_STRMAP
4
-
5
3
  int git_sortedcache_new(
6
4
  git_sortedcache **out,
7
5
  size_t item_path_offset,
@@ -294,13 +292,13 @@ int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
294
292
  item_key = ((char *)item) + sc->item_path_offset;
295
293
  memcpy(item_key, key, keylen);
296
294
 
297
- pos = kh_put(str, sc->map, item_key, &error);
295
+ pos = git_strmap_put(sc->map, item_key, &error);
298
296
  if (error < 0)
299
297
  goto done;
300
298
 
301
299
  if (!error)
302
- kh_key(sc->map, pos) = item_key;
303
- kh_val(sc->map, pos) = item;
300
+ git_strmap_set_key_at(sc->map, pos, item_key);
301
+ git_strmap_set_value_at(sc->map, pos, item);
304
302
 
305
303
  error = git_vector_insert(&sc->items, item);
306
304
  if (error < 0)
@@ -7,6 +7,101 @@
7
7
 
8
8
  #include "strmap.h"
9
9
 
10
+ __KHASH_IMPL(str, static kh_inline, const char *, void *, 1, kh_str_hash_func, kh_str_hash_equal)
11
+
12
+ int git_strmap_alloc(git_strmap **map)
13
+ {
14
+ if ((*map = kh_init(str)) == NULL) {
15
+ giterr_set_oom();
16
+ return -1;
17
+ }
18
+
19
+ return 0;
20
+ }
21
+
22
+ void git_strmap__free(git_strmap *map)
23
+ {
24
+ kh_destroy(str, map);
25
+ }
26
+
27
+ void git_strmap_clear(git_strmap *map)
28
+ {
29
+ kh_clear(str, map);
30
+ }
31
+
32
+ size_t git_strmap_num_entries(git_strmap *map)
33
+ {
34
+ return kh_size(map);
35
+ }
36
+
37
+ size_t git_strmap_lookup_index(git_strmap *map, const char *key)
38
+ {
39
+ return kh_get(str, map, key);
40
+ }
41
+
42
+ int git_strmap_valid_index(git_strmap *map, size_t idx)
43
+ {
44
+ return idx != kh_end(map);
45
+ }
46
+
47
+ int git_strmap_exists(git_strmap *map, const char *key)
48
+ {
49
+ return kh_get(str, map, key) != kh_end(map);
50
+ }
51
+
52
+ int git_strmap_has_data(git_strmap *map, size_t idx)
53
+ {
54
+ return kh_exist(map, idx);
55
+ }
56
+
57
+ const char *git_strmap_key(git_strmap *map, size_t idx)
58
+ {
59
+ return kh_key(map, idx);
60
+ }
61
+
62
+ void git_strmap_set_key_at(git_strmap *map, size_t idx, char *key)
63
+ {
64
+ kh_val(map, idx) = key;
65
+ }
66
+
67
+ void *git_strmap_value_at(git_strmap *map, size_t idx)
68
+ {
69
+ return kh_val(map, idx);
70
+ }
71
+
72
+ void git_strmap_set_value_at(git_strmap *map, size_t idx, void *value)
73
+ {
74
+ kh_val(map, idx) = value;
75
+ }
76
+
77
+ void git_strmap_delete_at(git_strmap *map, size_t idx)
78
+ {
79
+ kh_del(str, map, idx);
80
+ }
81
+
82
+ int git_strmap_put(git_strmap *map, const char *key, int *err)
83
+ {
84
+ return kh_put(str, map, key, err);
85
+ }
86
+
87
+ void git_strmap_insert(git_strmap *map, const char *key, void *value, int *rval)
88
+ {
89
+ khiter_t idx = kh_put(str, map, key, rval);
90
+
91
+ if ((*rval) >= 0) {
92
+ if ((*rval) == 0)
93
+ kh_key(map, idx) = key;
94
+ kh_val(map, idx) = value;
95
+ }
96
+ }
97
+
98
+ void git_strmap_delete(git_strmap *map, const char *key)
99
+ {
100
+ khiter_t idx = git_strmap_lookup_index(map, key);
101
+ if (git_strmap_valid_index(map, idx))
102
+ git_strmap_delete_at(map, idx);
103
+ }
104
+
10
105
  int git_strmap_next(
11
106
  void **data,
12
107
  git_strmap_iter* iter,
@@ -20,49 +20,29 @@ __KHASH_TYPE(str, const char *, void *)
20
20
  typedef khash_t(str) git_strmap;
21
21
  typedef khiter_t git_strmap_iter;
22
22
 
23
- #define GIT__USE_STRMAP \
24
- __KHASH_IMPL(str, static kh_inline, const char *, void *, 1, kh_str_hash_func, kh_str_hash_equal)
23
+ int git_strmap_alloc(git_strmap **map);
25
24
 
26
- #define git_strmap_alloc(hp) \
27
- ((*(hp) = kh_init(str)) == NULL) ? giterr_set_oom(), -1 : 0
25
+ #define git_strmap_free(h) git_strmap__free(h); (h) = NULL
26
+ void git_strmap__free(git_strmap *map);
27
+ void git_strmap_clear(git_strmap *map);
28
28
 
29
- #define git_strmap_free(h) kh_destroy(str, h), h = NULL
30
- #define git_strmap_clear(h) kh_clear(str, h)
29
+ size_t git_strmap_num_entries(git_strmap *map);
31
30
 
32
- #define git_strmap_num_entries(h) kh_size(h)
31
+ size_t git_strmap_lookup_index(git_strmap *map, const char *key);
32
+ int git_strmap_valid_index(git_strmap *map, size_t idx);
33
33
 
34
- #define git_strmap_lookup_index(h, k) kh_get(str, h, k)
35
- #define git_strmap_valid_index(h, idx) (idx != kh_end(h))
34
+ int git_strmap_exists(git_strmap *map, const char *key);
35
+ int git_strmap_has_data(git_strmap *map, size_t idx);
36
36
 
37
- #define git_strmap_exists(h, k) (kh_get(str, h, k) != kh_end(h))
38
- #define git_strmap_has_data(h, idx) kh_exist(h, idx)
37
+ const char *git_strmap_key(git_strmap *map, size_t idx);
38
+ void git_strmap_set_key_at(git_strmap *map, size_t idx, char *key);
39
+ void *git_strmap_value_at(git_strmap *map, size_t idx);
40
+ void git_strmap_set_value_at(git_strmap *map, size_t idx, void *value);
41
+ void git_strmap_delete_at(git_strmap *map, size_t idx);
39
42
 
40
- #define git_strmap_key(h, idx) kh_key(h, idx)
41
- #define git_strmap_value_at(h, idx) kh_val(h, idx)
42
- #define git_strmap_set_value_at(h, idx, v) kh_val(h, idx) = v
43
- #define git_strmap_delete_at(h, idx) kh_del(str, h, idx)
44
-
45
- #define git_strmap_insert(h, key, val, rval) do { \
46
- khiter_t __pos = kh_put(str, h, key, &rval); \
47
- if (rval >= 0) { \
48
- if (rval == 0) kh_key(h, __pos) = key; \
49
- kh_val(h, __pos) = val; \
50
- } } while (0)
51
-
52
- #define git_strmap_insert2(h, key, val, oldv, rval) do { \
53
- khiter_t __pos = kh_put(str, h, key, &rval); \
54
- if (rval >= 0) { \
55
- if (rval == 0) { \
56
- oldv = kh_val(h, __pos); \
57
- kh_key(h, __pos) = key; \
58
- } else { oldv = NULL; } \
59
- kh_val(h, __pos) = val; \
60
- } } while (0)
61
-
62
- #define git_strmap_delete(h, key) do { \
63
- khiter_t __pos = git_strmap_lookup_index(h, key); \
64
- if (git_strmap_valid_index(h, __pos)) \
65
- git_strmap_delete_at(h, __pos); } while (0)
43
+ int git_strmap_put(git_strmap *map, const char *key, int *err);
44
+ void git_strmap_insert(git_strmap *map, const char *key, void *value, int *rval);
45
+ void git_strmap_delete(git_strmap *map, const char *key);
66
46
 
67
47
  #define git_strmap_foreach kh_foreach
68
48
  #define git_strmap_foreach_value kh_foreach_value
@@ -186,7 +186,7 @@ static int load_submodule_names(git_strmap *out, git_config *cfg)
186
186
  ldot = strrchr(entry->name, '.');
187
187
 
188
188
  git_buf_put(&buf, fdot + 1, ldot - fdot - 1);
189
- git_strmap_insert(out, entry->value, git_buf_detach(&buf), rval);
189
+ git_strmap_insert(out, entry->value, git_buf_detach(&buf), &rval);
190
190
  if (rval < 0) {
191
191
  giterr_set(GITERR_NOMEMORY, "error inserting submodule into hash table");
192
192
  return -1;
@@ -329,7 +329,7 @@ static int submodule_get_or_create(git_submodule **out, git_repository *repo, gi
329
329
  if ((error = submodule_alloc(&sm, repo, name)) < 0)
330
330
  return error;
331
331
 
332
- pos = kh_put(str, map, sm->name, &error);
332
+ pos = git_strmap_put(map, sm->name, &error);
333
333
  /* nobody can beat us to adding it */
334
334
  assert(error != 0);
335
335
  if (error < 0) {
@@ -555,7 +555,7 @@ int git_submodule_foreach(
555
555
  goto done;
556
556
 
557
557
  if (!(error = git_vector_init(
558
- &snapshot, kh_size(submodules), submodule_cmp))) {
558
+ &snapshot, git_strmap_num_entries(submodules), submodule_cmp))) {
559
559
 
560
560
  git_strmap_foreach_value(submodules, sm, {
561
561
  if ((error = git_vector_insert(&snapshot, sm)) < 0)
@@ -616,8 +616,10 @@ static int submodule_repo_init(
616
616
  * Old style: sub-repo goes directly into repo/<name>/.git/
617
617
  */
618
618
  if (use_gitlink) {
619
- error = git_buf_join3(
620
- &repodir, '/', git_repository_path(parent_repo), "modules", path);
619
+ error = git_repository_item_path(&repodir, parent_repo, GIT_REPOSITORY_ITEM_MODULES);
620
+ if (error < 0)
621
+ goto cleanup;
622
+ error = git_buf_joinpath(&repodir, repodir.ptr, path);
621
623
  if (error < 0)
622
624
  goto cleanup;
623
625
 
@@ -1084,8 +1086,10 @@ static int submodule_repo_create(
1084
1086
  * <repo-dir>/modules/<name>/ with a gitlink in the
1085
1087
  * sub-repo workdir directory to that repository.
1086
1088
  */
1087
- error = git_buf_join3(
1088
- &repodir, '/', git_repository_path(parent_repo), "modules", path);
1089
+ error = git_repository_item_path(&repodir, parent_repo, GIT_REPOSITORY_ITEM_MODULES);
1090
+ if (error < 0)
1091
+ goto cleanup;
1092
+ error = git_buf_joinpath(&repodir, repodir.ptr, path);
1089
1093
  if (error < 0)
1090
1094
  goto cleanup;
1091
1095
 
@@ -1862,7 +1866,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
1862
1866
  goto done;
1863
1867
  }
1864
1868
 
1865
- git_strmap_insert(map, sm->name, sm, error);
1869
+ git_strmap_insert(map, sm->name, sm, &error);
1866
1870
  assert(error != 0);
1867
1871
  if (error < 0)
1868
1872
  goto done;
@@ -7,6 +7,12 @@
7
7
  #ifndef INCLUDE_thread_utils_h__
8
8
  #define INCLUDE_thread_utils_h__
9
9
 
10
+ #if defined(__GNUC__) && defined(GIT_THREADS)
11
+ # if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1))
12
+ # error Atomic primitives do not exist on this version of gcc; configure libgit2 with -DTHREADSAFE=OFF
13
+ # endif
14
+ #endif
15
+
10
16
  /* Common operations even if threading has been disabled */
11
17
  typedef struct {
12
18
  #if defined(GIT_WIN32)
@@ -19,8 +19,6 @@
19
19
  #include "git2/sys/refs.h"
20
20
  #include "git2/sys/refdb_backend.h"
21
21
 
22
- GIT__USE_STRMAP
23
-
24
22
  typedef enum {
25
23
  TRANSACTION_NONE,
26
24
  TRANSACTION_REFS,
@@ -120,7 +118,7 @@ int git_transaction_lock_ref(git_transaction *tx, const char *refname)
120
118
  if ((error = git_refdb_lock(&node->payload, tx->db, refname)) < 0)
121
119
  return error;
122
120
 
123
- git_strmap_insert(tx->locks, node->name, node, error);
121
+ git_strmap_insert(tx->locks, node->name, node, &error);
124
122
  if (error < 0)
125
123
  goto cleanup;
126
124
 
@@ -323,7 +321,6 @@ static int update_target(git_refdb *db, transaction_node *node)
323
321
  int git_transaction_commit(git_transaction *tx)
324
322
  {
325
323
  transaction_node *node;
326
- git_strmap_iter pos;
327
324
  int error = 0;
328
325
 
329
326
  assert(tx);
@@ -335,11 +332,7 @@ int git_transaction_commit(git_transaction *tx)
335
332
  return error;
336
333
  }
337
334
 
338
- for (pos = kh_begin(tx->locks); pos < kh_end(tx->locks); pos++) {
339
- if (!git_strmap_has_data(tx->locks, pos))
340
- continue;
341
-
342
- node = git_strmap_value_at(tx->locks, pos);
335
+ git_strmap_foreach_value(tx->locks, node, {
343
336
  if (node->reflog) {
344
337
  if ((error = tx->db->backend->reflog_write(tx->db->backend, node->reflog)) < 0)
345
338
  return error;
@@ -349,7 +342,7 @@ int git_transaction_commit(git_transaction *tx)
349
342
  if ((error = update_target(tx->db, node)) < 0)
350
343
  return error;
351
344
  }
352
- }
345
+ });
353
346
 
354
347
  return 0;
355
348
  }
@@ -358,7 +351,6 @@ void git_transaction_free(git_transaction *tx)
358
351
  {
359
352
  transaction_node *node;
360
353
  git_pool pool;
361
- git_strmap_iter pos;
362
354
 
363
355
  assert(tx);
364
356
 
@@ -373,16 +365,12 @@ void git_transaction_free(git_transaction *tx)
373
365
  }
374
366
 
375
367
  /* start by unlocking the ones we've left hanging, if any */
376
- for (pos = kh_begin(tx->locks); pos < kh_end(tx->locks); pos++) {
377
- if (!git_strmap_has_data(tx->locks, pos))
378
- continue;
379
-
380
- node = git_strmap_value_at(tx->locks, pos);
368
+ git_strmap_foreach_value(tx->locks, node, {
381
369
  if (node->committed)
382
370
  continue;
383
371
 
384
372
  git_refdb_unlock(tx->db, node->payload, false, false, NULL, NULL, NULL);
385
- }
373
+ });
386
374
 
387
375
  git_refdb_free(tx->db);
388
376
  git_strmap_free(tx->locks);
@@ -375,7 +375,8 @@ static int local_push(
375
375
  goto on_error;
376
376
  }
377
377
 
378
- if ((error = git_buf_joinpath(&odb_path, git_repository_path(remote_repo), "objects/pack")) < 0)
378
+ if ((error = git_repository_item_path(&odb_path, remote_repo, GIT_REPOSITORY_ITEM_OBJECTS)) < 0
379
+ || (error = git_buf_joinpath(&odb_path, odb_path.ptr, "pack")) < 0)
379
380
  goto on_error;
380
381
 
381
382
  error = git_packbuilder_write(push->pb, odb_path.ptr, 0, transfer_to_push_transfer, (void *) cbs);