rugged 0.27.10.1 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (297) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +23 -2
  3. data/ext/rugged/rugged.c +48 -2
  4. data/ext/rugged/rugged.h +5 -0
  5. data/ext/rugged/rugged_allocator.c +89 -0
  6. data/ext/rugged/rugged_blob.c +3 -3
  7. data/ext/rugged/rugged_branch.c +1 -1
  8. data/ext/rugged/rugged_commit.c +8 -8
  9. data/ext/rugged/rugged_config.c +1 -1
  10. data/ext/rugged/rugged_diff.c +24 -4
  11. data/ext/rugged/rugged_note.c +1 -1
  12. data/ext/rugged/rugged_repo.c +10 -10
  13. data/ext/rugged/rugged_settings.c +1 -1
  14. data/lib/rugged/version.rb +1 -1
  15. data/vendor/libgit2/CMakeLists.txt +69 -47
  16. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
  17. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -8
  18. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
  19. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
  20. data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
  21. data/vendor/libgit2/deps/regex/COPYING +502 -0
  22. data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
  23. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
  24. data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
  25. data/vendor/libgit2/deps/zlib/COPYING +27 -0
  26. data/vendor/libgit2/include/git2.h +3 -0
  27. data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
  28. data/vendor/libgit2/include/git2/apply.h +129 -0
  29. data/vendor/libgit2/include/git2/attr.h +19 -8
  30. data/vendor/libgit2/include/git2/blame.h +41 -24
  31. data/vendor/libgit2/include/git2/blob.h +1 -1
  32. data/vendor/libgit2/include/git2/branch.h +1 -1
  33. data/vendor/libgit2/include/git2/buffer.h +2 -2
  34. data/vendor/libgit2/include/git2/checkout.h +20 -19
  35. data/vendor/libgit2/include/git2/cherrypick.h +6 -4
  36. data/vendor/libgit2/include/git2/clone.h +11 -9
  37. data/vendor/libgit2/include/git2/commit.h +30 -2
  38. data/vendor/libgit2/include/git2/common.h +54 -4
  39. data/vendor/libgit2/include/git2/config.h +18 -7
  40. data/vendor/libgit2/include/git2/deprecated.h +253 -0
  41. data/vendor/libgit2/include/git2/describe.h +30 -7
  42. data/vendor/libgit2/include/git2/diff.h +193 -143
  43. data/vendor/libgit2/include/git2/errors.h +54 -46
  44. data/vendor/libgit2/include/git2/ignore.h +2 -2
  45. data/vendor/libgit2/include/git2/index.h +72 -51
  46. data/vendor/libgit2/include/git2/indexer.h +30 -4
  47. data/vendor/libgit2/include/git2/mailmap.h +115 -0
  48. data/vendor/libgit2/include/git2/merge.h +29 -8
  49. data/vendor/libgit2/include/git2/net.h +1 -1
  50. data/vendor/libgit2/include/git2/notes.h +1 -1
  51. data/vendor/libgit2/include/git2/object.h +16 -16
  52. data/vendor/libgit2/include/git2/odb.h +10 -10
  53. data/vendor/libgit2/include/git2/odb_backend.h +7 -7
  54. data/vendor/libgit2/include/git2/oid.h +1 -1
  55. data/vendor/libgit2/include/git2/pack.h +2 -2
  56. data/vendor/libgit2/include/git2/proxy.h +9 -5
  57. data/vendor/libgit2/include/git2/rebase.h +7 -4
  58. data/vendor/libgit2/include/git2/refs.h +14 -15
  59. data/vendor/libgit2/include/git2/refspec.h +17 -0
  60. data/vendor/libgit2/include/git2/remote.h +92 -16
  61. data/vendor/libgit2/include/git2/repository.h +52 -37
  62. data/vendor/libgit2/include/git2/revert.h +5 -3
  63. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  64. data/vendor/libgit2/include/git2/signature.h +2 -2
  65. data/vendor/libgit2/include/git2/stash.h +13 -10
  66. data/vendor/libgit2/include/git2/status.h +8 -4
  67. data/vendor/libgit2/include/git2/submodule.h +11 -10
  68. data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
  69. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  70. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  71. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  72. data/vendor/libgit2/include/git2/sys/index.h +3 -0
  73. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  74. data/vendor/libgit2/include/git2/sys/merge.h +9 -4
  75. data/vendor/libgit2/include/git2/sys/odb_backend.h +19 -19
  76. data/vendor/libgit2/include/git2/sys/path.h +64 -0
  77. data/vendor/libgit2/include/git2/sys/refdb_backend.h +19 -19
  78. data/vendor/libgit2/include/git2/sys/stream.h +92 -12
  79. data/vendor/libgit2/include/git2/sys/transport.h +127 -81
  80. data/vendor/libgit2/include/git2/tag.h +2 -2
  81. data/vendor/libgit2/include/git2/trace.h +1 -1
  82. data/vendor/libgit2/include/git2/transaction.h +1 -0
  83. data/vendor/libgit2/include/git2/transport.h +47 -18
  84. data/vendor/libgit2/include/git2/tree.h +3 -3
  85. data/vendor/libgit2/include/git2/types.h +35 -28
  86. data/vendor/libgit2/include/git2/version.h +4 -4
  87. data/vendor/libgit2/include/git2/worktree.h +47 -12
  88. data/vendor/libgit2/src/CMakeLists.txt +87 -26
  89. data/vendor/libgit2/src/alloc.c +55 -0
  90. data/vendor/libgit2/src/alloc.h +40 -0
  91. data/vendor/libgit2/src/annotated_commit.c +15 -8
  92. data/vendor/libgit2/src/apply.c +490 -14
  93. data/vendor/libgit2/src/apply.h +3 -1
  94. data/vendor/libgit2/src/array.h +2 -2
  95. data/vendor/libgit2/src/attr.c +11 -11
  96. data/vendor/libgit2/src/attr_file.c +20 -15
  97. data/vendor/libgit2/src/attrcache.c +11 -11
  98. data/vendor/libgit2/src/blame.c +30 -15
  99. data/vendor/libgit2/src/blame.h +1 -0
  100. data/vendor/libgit2/src/blame_git.c +16 -13
  101. data/vendor/libgit2/src/blob.c +50 -28
  102. data/vendor/libgit2/src/blob.h +18 -1
  103. data/vendor/libgit2/src/branch.c +38 -38
  104. data/vendor/libgit2/src/buf_text.c +7 -6
  105. data/vendor/libgit2/src/buffer.c +55 -50
  106. data/vendor/libgit2/src/buffer.h +1 -1
  107. data/vendor/libgit2/src/cache.c +16 -16
  108. data/vendor/libgit2/src/cache.h +2 -2
  109. data/vendor/libgit2/src/cc-compat.h +15 -3
  110. data/vendor/libgit2/src/checkout.c +83 -74
  111. data/vendor/libgit2/src/cherrypick.c +6 -6
  112. data/vendor/libgit2/src/clone.c +20 -20
  113. data/vendor/libgit2/src/commit.c +53 -33
  114. data/vendor/libgit2/src/commit.h +1 -0
  115. data/vendor/libgit2/src/commit_list.c +6 -10
  116. data/vendor/libgit2/src/common.h +32 -30
  117. data/vendor/libgit2/src/config.c +167 -147
  118. data/vendor/libgit2/src/config.h +1 -14
  119. data/vendor/libgit2/src/config_backend.h +84 -0
  120. data/vendor/libgit2/src/config_cache.c +7 -1
  121. data/vendor/libgit2/src/config_entries.c +259 -0
  122. data/vendor/libgit2/src/config_entries.h +23 -0
  123. data/vendor/libgit2/src/config_file.c +167 -439
  124. data/vendor/libgit2/src/config_mem.c +224 -0
  125. data/vendor/libgit2/src/config_parse.c +69 -38
  126. data/vendor/libgit2/src/config_parse.h +4 -4
  127. data/vendor/libgit2/src/crlf.c +215 -186
  128. data/vendor/libgit2/src/delta.c +25 -18
  129. data/vendor/libgit2/src/describe.c +23 -23
  130. data/vendor/libgit2/src/diff.c +12 -12
  131. data/vendor/libgit2/src/diff_driver.c +14 -15
  132. data/vendor/libgit2/src/diff_file.c +10 -10
  133. data/vendor/libgit2/src/diff_generate.c +29 -23
  134. data/vendor/libgit2/src/diff_generate.h +1 -1
  135. data/vendor/libgit2/src/diff_parse.c +3 -3
  136. data/vendor/libgit2/src/diff_print.c +17 -17
  137. data/vendor/libgit2/src/diff_stats.c +22 -7
  138. data/vendor/libgit2/src/diff_tform.c +12 -12
  139. data/vendor/libgit2/src/diff_xdiff.c +15 -3
  140. data/vendor/libgit2/src/errors.c +42 -20
  141. data/vendor/libgit2/src/features.h.in +2 -1
  142. data/vendor/libgit2/src/fetch.c +3 -3
  143. data/vendor/libgit2/src/fetchhead.c +16 -16
  144. data/vendor/libgit2/src/filebuf.c +28 -28
  145. data/vendor/libgit2/src/fileops.c +54 -54
  146. data/vendor/libgit2/src/fileops.h +1 -1
  147. data/vendor/libgit2/src/filter.c +30 -30
  148. data/vendor/libgit2/src/filter.h +0 -10
  149. data/vendor/libgit2/src/global.c +36 -23
  150. data/vendor/libgit2/src/hash.h +4 -1
  151. data/vendor/libgit2/src/hash/hash_collisiondetect.h +6 -2
  152. data/vendor/libgit2/src/hash/hash_common_crypto.h +5 -1
  153. data/vendor/libgit2/src/hash/hash_generic.h +5 -1
  154. data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
  155. data/vendor/libgit2/src/hash/hash_mbedtls.h +24 -0
  156. data/vendor/libgit2/src/hash/hash_openssl.h +8 -4
  157. data/vendor/libgit2/src/hash/hash_win32.c +13 -13
  158. data/vendor/libgit2/src/hashsig.c +4 -4
  159. data/vendor/libgit2/src/idxmap.c +25 -5
  160. data/vendor/libgit2/src/idxmap.h +4 -18
  161. data/vendor/libgit2/src/ignore.c +9 -9
  162. data/vendor/libgit2/src/index.c +280 -198
  163. data/vendor/libgit2/src/index.h +16 -0
  164. data/vendor/libgit2/src/indexer.c +311 -139
  165. data/vendor/libgit2/src/integer.h +32 -22
  166. data/vendor/libgit2/src/iterator.c +116 -49
  167. data/vendor/libgit2/src/iterator.h +15 -0
  168. data/vendor/libgit2/src/khash.h +3 -1
  169. data/vendor/libgit2/src/mailmap.c +485 -0
  170. data/vendor/libgit2/src/mailmap.h +35 -0
  171. data/vendor/libgit2/src/merge.c +89 -59
  172. data/vendor/libgit2/src/merge_driver.c +7 -7
  173. data/vendor/libgit2/src/merge_file.c +1 -1
  174. data/vendor/libgit2/src/mwindow.c +8 -8
  175. data/vendor/libgit2/src/netops.c +22 -13
  176. data/vendor/libgit2/src/netops.h +2 -0
  177. data/vendor/libgit2/src/notes.c +15 -10
  178. data/vendor/libgit2/src/object.c +118 -67
  179. data/vendor/libgit2/src/object.h +20 -9
  180. data/vendor/libgit2/src/object_api.c +8 -8
  181. data/vendor/libgit2/src/odb.c +72 -72
  182. data/vendor/libgit2/src/odb.h +7 -7
  183. data/vendor/libgit2/src/odb_loose.c +46 -46
  184. data/vendor/libgit2/src/odb_mempack.c +14 -14
  185. data/vendor/libgit2/src/odb_pack.c +14 -10
  186. data/vendor/libgit2/src/offmap.c +30 -0
  187. data/vendor/libgit2/src/offmap.h +20 -11
  188. data/vendor/libgit2/src/oid.c +6 -6
  189. data/vendor/libgit2/src/oidmap.c +20 -0
  190. data/vendor/libgit2/src/oidmap.h +9 -12
  191. data/vendor/libgit2/src/pack-objects.c +71 -63
  192. data/vendor/libgit2/src/pack-objects.h +1 -7
  193. data/vendor/libgit2/src/pack.c +58 -58
  194. data/vendor/libgit2/src/pack.h +6 -6
  195. data/vendor/libgit2/src/parse.h +1 -1
  196. data/vendor/libgit2/src/patch.c +3 -3
  197. data/vendor/libgit2/src/patch_generate.c +18 -18
  198. data/vendor/libgit2/src/patch_parse.c +13 -13
  199. data/vendor/libgit2/src/path.c +93 -225
  200. data/vendor/libgit2/src/path.h +2 -84
  201. data/vendor/libgit2/src/pathspec.c +6 -6
  202. data/vendor/libgit2/src/posix.c +3 -3
  203. data/vendor/libgit2/src/proxy.c +1 -1
  204. data/vendor/libgit2/src/push.c +27 -26
  205. data/vendor/libgit2/src/push.h +2 -1
  206. data/vendor/libgit2/src/reader.c +265 -0
  207. data/vendor/libgit2/src/reader.h +107 -0
  208. data/vendor/libgit2/src/rebase.c +49 -52
  209. data/vendor/libgit2/src/refdb.c +3 -3
  210. data/vendor/libgit2/src/refdb_fs.c +181 -103
  211. data/vendor/libgit2/src/reflog.c +3 -3
  212. data/vendor/libgit2/src/refs.c +98 -74
  213. data/vendor/libgit2/src/refs.h +5 -3
  214. data/vendor/libgit2/src/refspec.c +47 -21
  215. data/vendor/libgit2/src/refspec.h +1 -1
  216. data/vendor/libgit2/src/remote.c +219 -166
  217. data/vendor/libgit2/src/remote.h +9 -0
  218. data/vendor/libgit2/src/repository.c +173 -133
  219. data/vendor/libgit2/src/repository.h +6 -3
  220. data/vendor/libgit2/src/reset.c +8 -8
  221. data/vendor/libgit2/src/revert.c +6 -6
  222. data/vendor/libgit2/src/revparse.c +30 -30
  223. data/vendor/libgit2/src/revwalk.c +60 -30
  224. data/vendor/libgit2/src/revwalk.h +2 -1
  225. data/vendor/libgit2/src/settings.c +42 -10
  226. data/vendor/libgit2/src/signature.c +11 -11
  227. data/vendor/libgit2/src/sortedcache.c +13 -13
  228. data/vendor/libgit2/src/stash.c +91 -45
  229. data/vendor/libgit2/src/status.c +13 -13
  230. data/vendor/libgit2/src/stdalloc.c +120 -0
  231. data/vendor/libgit2/src/{streams/curl.h → stdalloc.h} +6 -6
  232. data/vendor/libgit2/src/stream.h +17 -2
  233. data/vendor/libgit2/src/streams/mbedtls.c +483 -0
  234. data/vendor/libgit2/src/streams/mbedtls.h +23 -0
  235. data/vendor/libgit2/src/streams/openssl.c +204 -114
  236. data/vendor/libgit2/src/streams/openssl.h +4 -108
  237. data/vendor/libgit2/src/streams/registry.c +118 -0
  238. data/vendor/libgit2/src/streams/registry.h +19 -0
  239. data/vendor/libgit2/src/streams/socket.c +54 -29
  240. data/vendor/libgit2/src/streams/stransport.c +57 -32
  241. data/vendor/libgit2/src/streams/stransport.h +5 -0
  242. data/vendor/libgit2/src/streams/tls.c +50 -19
  243. data/vendor/libgit2/src/streams/tls.h +12 -4
  244. data/vendor/libgit2/src/strmap.c +22 -2
  245. data/vendor/libgit2/src/strmap.h +18 -15
  246. data/vendor/libgit2/src/submodule.c +179 -155
  247. data/vendor/libgit2/src/sysdir.c +18 -18
  248. data/vendor/libgit2/src/tag.c +31 -26
  249. data/vendor/libgit2/src/tag.h +2 -1
  250. data/vendor/libgit2/src/trace.c +1 -1
  251. data/vendor/libgit2/src/trace.h +1 -1
  252. data/vendor/libgit2/src/trailer.c +6 -6
  253. data/vendor/libgit2/src/transaction.c +23 -23
  254. data/vendor/libgit2/src/transport.c +5 -5
  255. data/vendor/libgit2/src/transports/auth.c +7 -4
  256. data/vendor/libgit2/src/transports/auth.h +1 -1
  257. data/vendor/libgit2/src/transports/auth_negotiate.c +12 -11
  258. data/vendor/libgit2/src/transports/cred.c +18 -18
  259. data/vendor/libgit2/src/transports/git.c +15 -15
  260. data/vendor/libgit2/src/transports/http.c +606 -216
  261. data/vendor/libgit2/src/transports/http.h +2 -0
  262. data/vendor/libgit2/src/transports/local.c +26 -26
  263. data/vendor/libgit2/src/transports/smart.c +54 -31
  264. data/vendor/libgit2/src/transports/smart.h +1 -2
  265. data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
  266. data/vendor/libgit2/src/transports/smart_protocol.c +61 -57
  267. data/vendor/libgit2/src/transports/ssh.c +34 -33
  268. data/vendor/libgit2/src/transports/winhttp.c +99 -119
  269. data/vendor/libgit2/src/tree-cache.c +5 -5
  270. data/vendor/libgit2/src/tree.c +96 -121
  271. data/vendor/libgit2/src/tree.h +1 -12
  272. data/vendor/libgit2/src/unix/map.c +2 -2
  273. data/vendor/libgit2/src/util.c +22 -6
  274. data/vendor/libgit2/src/util.h +12 -135
  275. data/vendor/libgit2/src/vector.c +4 -4
  276. data/vendor/libgit2/src/win32/dir.c +3 -3
  277. data/vendor/libgit2/src/win32/findfile.c +3 -3
  278. data/vendor/libgit2/src/win32/map.c +6 -6
  279. data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
  280. data/vendor/libgit2/src/win32/path_w32.c +101 -7
  281. data/vendor/libgit2/src/win32/path_w32.h +18 -0
  282. data/vendor/libgit2/src/win32/posix_w32.c +24 -43
  283. data/vendor/libgit2/src/win32/w32_buffer.c +2 -2
  284. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +96 -2
  285. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
  286. data/vendor/libgit2/src/win32/w32_stack.c +2 -2
  287. data/vendor/libgit2/src/win32/w32_util.c +1 -69
  288. data/vendor/libgit2/src/win32/w32_util.h +1 -19
  289. data/vendor/libgit2/src/worktree.c +75 -54
  290. data/vendor/libgit2/src/worktree.h +2 -0
  291. data/vendor/libgit2/src/xdiff/xdiffi.c +7 -5
  292. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  293. data/vendor/libgit2/src/xdiff/xmerge.c +15 -15
  294. data/vendor/libgit2/src/zstream.c +4 -4
  295. metadata +33 -7
  296. data/vendor/libgit2/src/config_file.h +0 -73
  297. data/vendor/libgit2/src/streams/curl.c +0 -385
@@ -81,7 +81,7 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
81
81
  assert(reflog && new_oid && committer);
82
82
 
83
83
  entry = git__calloc(1, sizeof(git_reflog_entry));
84
- GITERR_CHECK_ALLOC(entry);
84
+ GIT_ERROR_CHECK_ALLOC(entry);
85
85
 
86
86
  if ((git_signature_dup(&entry->committer, committer)) < 0)
87
87
  goto cleanup;
@@ -94,7 +94,7 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
94
94
 
95
95
  if (newline) {
96
96
  if (newline[1] != '\0') {
97
- giterr_set(GITERR_INVALID, "reflog message cannot contain newline");
97
+ git_error_set(GIT_ERROR_INVALID, "reflog message cannot contain newline");
98
98
  goto cleanup;
99
99
  }
100
100
 
@@ -194,7 +194,7 @@ int git_reflog_drop(git_reflog *reflog, size_t idx, int rewrite_previous_entry)
194
194
  entry = (git_reflog_entry *)git_reflog_entry_byindex(reflog, idx);
195
195
 
196
196
  if (entry == NULL) {
197
- giterr_set(GITERR_REFERENCE, "no reflog entry at index %"PRIuZ, idx);
197
+ git_error_set(GIT_ERROR_REFERENCE, "no reflog entry at index %"PRIuZ, idx);
198
198
  return GIT_ENOTFOUND;
199
199
  }
200
200
 
@@ -59,7 +59,7 @@ git_reference *git_reference__alloc_symbolic(
59
59
  if (!ref)
60
60
  return NULL;
61
61
 
62
- ref->type = GIT_REF_SYMBOLIC;
62
+ ref->type = GIT_REFERENCE_SYMBOLIC;
63
63
 
64
64
  if ((ref->target.symbolic = git__strdup(target)) == NULL) {
65
65
  git__free(ref);
@@ -82,7 +82,7 @@ git_reference *git_reference__alloc(
82
82
  if (!ref)
83
83
  return NULL;
84
84
 
85
- ref->type = GIT_REF_OID;
85
+ ref->type = GIT_REFERENCE_DIRECT;
86
86
  git_oid_cpy(&ref->target.oid, oid);
87
87
 
88
88
  if (peel != NULL)
@@ -108,12 +108,12 @@ git_reference *git_reference__set_name(
108
108
 
109
109
  int git_reference_dup(git_reference **dest, git_reference *source)
110
110
  {
111
- if (source->type == GIT_REF_SYMBOLIC)
111
+ if (source->type == GIT_REFERENCE_SYMBOLIC)
112
112
  *dest = git_reference__alloc_symbolic(source->name, source->target.symbolic);
113
113
  else
114
114
  *dest = git_reference__alloc(source->name, &source->target.oid, &source->peel);
115
115
 
116
- GITERR_CHECK_ALLOC(*dest);
116
+ GIT_ERROR_CHECK_ALLOC(*dest);
117
117
 
118
118
  (*dest)->db = source->db;
119
119
  GIT_REFCOUNT_INC((*dest)->db);
@@ -126,7 +126,7 @@ void git_reference_free(git_reference *reference)
126
126
  if (reference == NULL)
127
127
  return;
128
128
 
129
- if (reference->type == GIT_REF_SYMBOLIC)
129
+ if (reference->type == GIT_REFERENCE_SYMBOLIC)
130
130
  git__free(reference->target.symbolic);
131
131
 
132
132
  if (reference->db)
@@ -140,7 +140,7 @@ int git_reference_delete(git_reference *ref)
140
140
  const git_oid *old_id = NULL;
141
141
  const char *old_target = NULL;
142
142
 
143
- if (ref->type == GIT_REF_OID)
143
+ if (ref->type == GIT_REFERENCE_DIRECT)
144
144
  old_id = &ref->target.oid;
145
145
  else
146
146
  old_target = ref->target.symbolic;
@@ -186,14 +186,14 @@ static int reference_normalize_for_repo(
186
186
  bool validate)
187
187
  {
188
188
  int precompose;
189
- unsigned int flags = GIT_REF_FORMAT_ALLOW_ONELEVEL;
189
+ unsigned int flags = GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL;
190
190
 
191
191
  if (!git_repository__cvar(&precompose, repo, GIT_CVAR_PRECOMPOSE) &&
192
192
  precompose)
193
- flags |= GIT_REF_FORMAT__PRECOMPOSE_UNICODE;
193
+ flags |= GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE;
194
194
 
195
195
  if (!validate)
196
- flags |= GIT_REF_FORMAT__VALIDATION_DISABLE;
196
+ flags |= GIT_REFERENCE_FORMAT__VALIDATION_DISABLE;
197
197
 
198
198
  return git_reference_normalize_name(out, GIT_REFNAME_MAX, name, flags);
199
199
  }
@@ -205,7 +205,7 @@ int git_reference_lookup_resolved(
205
205
  int max_nesting)
206
206
  {
207
207
  git_refname_t scan_name;
208
- git_ref_t scan_type;
208
+ git_reference_t scan_type;
209
209
  int error = 0, nesting;
210
210
  git_reference *ref = NULL;
211
211
  git_refdb *refdb;
@@ -219,7 +219,7 @@ int git_reference_lookup_resolved(
219
219
  else if (max_nesting < 0)
220
220
  max_nesting = DEFAULT_NESTING_LEVEL;
221
221
 
222
- scan_type = GIT_REF_SYMBOLIC;
222
+ scan_type = GIT_REFERENCE_SYMBOLIC;
223
223
 
224
224
  if ((error = reference_normalize_for_repo(scan_name, repo, name, true)) < 0)
225
225
  return error;
@@ -228,7 +228,7 @@ int git_reference_lookup_resolved(
228
228
  return error;
229
229
 
230
230
  for (nesting = max_nesting;
231
- nesting >= 0 && scan_type == GIT_REF_SYMBOLIC;
231
+ nesting >= 0 && scan_type == GIT_REFERENCE_SYMBOLIC;
232
232
  nesting--)
233
233
  {
234
234
  if (nesting != max_nesting) {
@@ -242,8 +242,8 @@ int git_reference_lookup_resolved(
242
242
  scan_type = ref->type;
243
243
  }
244
244
 
245
- if (scan_type != GIT_REF_OID && max_nesting != 0) {
246
- giterr_set(GITERR_REFERENCE,
245
+ if (scan_type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
246
+ git_error_set(GIT_ERROR_REFERENCE,
247
247
  "cannot resolve reference (>%u levels deep)", max_nesting);
248
248
  git_reference_free(ref);
249
249
  return -1;
@@ -282,7 +282,7 @@ int git_reference__read_head(
282
282
 
283
283
  out:
284
284
  git__free(name);
285
- git_buf_free(&reference);
285
+ git_buf_dispose(&reference);
286
286
 
287
287
  return error;
288
288
  }
@@ -339,22 +339,22 @@ int git_reference_dwim(git_reference **out, git_repository *repo, const char *re
339
339
  cleanup:
340
340
  if (error && !foundvalid) {
341
341
  /* never found a valid reference name */
342
- giterr_set(GITERR_REFERENCE,
342
+ git_error_set(GIT_ERROR_REFERENCE,
343
343
  "could not use '%s' as valid reference name", git_buf_cstr(&name));
344
344
  }
345
345
 
346
346
  if (error == GIT_ENOTFOUND)
347
- giterr_set(GITERR_REFERENCE, "no reference found for shorthand '%s'", refname);
347
+ git_error_set(GIT_ERROR_REFERENCE, "no reference found for shorthand '%s'", refname);
348
348
 
349
- git_buf_free(&name);
350
- git_buf_free(&refnamebuf);
349
+ git_buf_dispose(&name);
350
+ git_buf_dispose(&refnamebuf);
351
351
  return error;
352
352
  }
353
353
 
354
354
  /**
355
355
  * Getters
356
356
  */
357
- git_ref_t git_reference_type(const git_reference *ref)
357
+ git_reference_t git_reference_type(const git_reference *ref)
358
358
  {
359
359
  assert(ref);
360
360
  return ref->type;
@@ -376,7 +376,7 @@ const git_oid *git_reference_target(const git_reference *ref)
376
376
  {
377
377
  assert(ref);
378
378
 
379
- if (ref->type != GIT_REF_OID)
379
+ if (ref->type != GIT_REFERENCE_DIRECT)
380
380
  return NULL;
381
381
 
382
382
  return &ref->target.oid;
@@ -386,7 +386,7 @@ const git_oid *git_reference_target_peel(const git_reference *ref)
386
386
  {
387
387
  assert(ref);
388
388
 
389
- if (ref->type != GIT_REF_OID || git_oid_iszero(&ref->peel))
389
+ if (ref->type != GIT_REFERENCE_DIRECT || git_oid_iszero(&ref->peel))
390
390
  return NULL;
391
391
 
392
392
  return &ref->peel;
@@ -396,7 +396,7 @@ const char *git_reference_symbolic_target(const git_reference *ref)
396
396
  {
397
397
  assert(ref);
398
398
 
399
- if (ref->type != GIT_REF_SYMBOLIC)
399
+ if (ref->type != GIT_REFERENCE_SYMBOLIC)
400
400
  return NULL;
401
401
 
402
402
  return ref->target.symbolic;
@@ -436,8 +436,8 @@ static int reference__create(
436
436
  if (oid != NULL) {
437
437
  assert(symbolic == NULL);
438
438
 
439
- if (!git_object__is_valid(repo, oid, GIT_OBJ_ANY)) {
440
- giterr_set(GITERR_REFERENCE,
439
+ if (!git_object__is_valid(repo, oid, GIT_OBJECT_ANY)) {
440
+ git_error_set(GIT_ERROR_REFERENCE,
441
441
  "target OID for the reference doesn't exist on the repository");
442
442
  return -1;
443
443
  }
@@ -455,7 +455,7 @@ static int reference__create(
455
455
  ref = git_reference__alloc_symbolic(normalized, normalized_target);
456
456
  }
457
457
 
458
- GITERR_CHECK_ALLOC(ref);
458
+ GIT_ERROR_CHECK_ALLOC(ref);
459
459
 
460
460
  if ((error = git_refdb_write(refdb, ref, force, signature, log_message, old_id, old_target)) < 0) {
461
461
  git_reference_free(ref);
@@ -566,10 +566,10 @@ int git_reference_symbolic_create(
566
566
 
567
567
  static int ensure_is_an_updatable_direct_reference(git_reference *ref)
568
568
  {
569
- if (ref->type == GIT_REF_OID)
569
+ if (ref->type == GIT_REFERENCE_DIRECT)
570
570
  return 0;
571
571
 
572
- giterr_set(GITERR_REFERENCE, "cannot set OID on symbolic reference");
572
+ git_error_set(GIT_ERROR_REFERENCE, "cannot set OID on symbolic reference");
573
573
  return -1;
574
574
  }
575
575
 
@@ -594,10 +594,10 @@ int git_reference_set_target(
594
594
 
595
595
  static int ensure_is_an_updatable_symbolic_reference(git_reference *ref)
596
596
  {
597
- if (ref->type == GIT_REF_SYMBOLIC)
597
+ if (ref->type == GIT_REFERENCE_SYMBOLIC)
598
598
  return 0;
599
599
 
600
- giterr_set(GITERR_REFERENCE, "cannot set symbolic target on a direct reference");
600
+ git_error_set(GIT_ERROR_REFERENCE, "cannot set symbolic target on a direct reference");
601
601
  return -1;
602
602
  }
603
603
 
@@ -631,7 +631,7 @@ static int update_wt_heads(git_repository *repo, const char *path, void *payload
631
631
  int error;
632
632
 
633
633
  if ((error = git_reference__read_head(&head, repo, path)) < 0) {
634
- giterr_set(GITERR_REFERENCE, "could not read HEAD when renaming references");
634
+ git_error_set(GIT_ERROR_REFERENCE, "could not read HEAD when renaming references");
635
635
  goto out;
636
636
  }
637
637
 
@@ -640,7 +640,7 @@ static int update_wt_heads(git_repository *repo, const char *path, void *payload
640
640
  goto out;
641
641
  }
642
642
 
643
- if (git_reference_type(head) != GIT_REF_SYMBOLIC ||
643
+ if (git_reference_type(head) != GIT_REFERENCE_SYMBOLIC ||
644
644
  git__strcmp(head->target.symbolic, data->old_name) != 0) {
645
645
  error = 0;
646
646
  goto out;
@@ -648,7 +648,7 @@ static int update_wt_heads(git_repository *repo, const char *path, void *payload
648
648
 
649
649
  /* Update HEAD it was pointing to the reference being renamed */
650
650
  if ((error = git_repository_create_head(gitdir, data->new_name)) < 0) {
651
- giterr_set(GITERR_REFERENCE, "failed to update HEAD after renaming reference");
651
+ git_error_set(GIT_ERROR_REFERENCE, "failed to update HEAD after renaming reference");
652
652
  goto out;
653
653
  }
654
654
 
@@ -723,14 +723,14 @@ int git_reference_rename(
723
723
  int git_reference_resolve(git_reference **ref_out, const git_reference *ref)
724
724
  {
725
725
  switch (git_reference_type(ref)) {
726
- case GIT_REF_OID:
726
+ case GIT_REFERENCE_DIRECT:
727
727
  return git_reference_lookup(ref_out, ref->db->repo, ref->name);
728
728
 
729
- case GIT_REF_SYMBOLIC:
729
+ case GIT_REFERENCE_SYMBOLIC:
730
730
  return git_reference_lookup_resolved(ref_out, ref->db->repo, ref->target.symbolic, -1);
731
731
 
732
732
  default:
733
- giterr_set(GITERR_REFERENCE, "invalid reference");
733
+ git_error_set(GIT_ERROR_REFERENCE, "invalid reference");
734
734
  return -1;
735
735
  }
736
736
  }
@@ -749,7 +749,7 @@ int git_reference_foreach(
749
749
 
750
750
  while (!(error = git_reference_next(&ref, iter))) {
751
751
  if ((error = callback(ref, payload)) != 0) {
752
- giterr_set_after_callback(error);
752
+ git_error_set_after_callback(error);
753
753
  break;
754
754
  }
755
755
  }
@@ -775,7 +775,7 @@ int git_reference_foreach_name(
775
775
 
776
776
  while (!(error = git_reference_next_name(&refname, iter))) {
777
777
  if ((error = callback(refname, payload)) != 0) {
778
- giterr_set_after_callback(error);
778
+ git_error_set_after_callback(error);
779
779
  break;
780
780
  }
781
781
  }
@@ -802,7 +802,7 @@ int git_reference_foreach_glob(
802
802
 
803
803
  while (!(error = git_reference_next_name(&refname, iter))) {
804
804
  if ((error = callback(refname, payload)) != 0) {
805
- giterr_set_after_callback(error);
805
+ git_error_set_after_callback(error);
806
806
  break;
807
807
  }
808
808
  }
@@ -856,7 +856,7 @@ void git_reference_iterator_free(git_reference_iterator *iter)
856
856
  static int cb__reflist_add(const char *ref, void *data)
857
857
  {
858
858
  char *name = git__strdup(ref);
859
- GITERR_CHECK_ALLOC(name);
859
+ GIT_ERROR_CHECK_ALLOC(name);
860
860
  return git_vector_insert((git_vector *)data, name);
861
861
  }
862
862
 
@@ -970,7 +970,7 @@ int git_reference__normalize_name(
970
970
  int segment_len, segments_count = 0, error = GIT_EINVALIDSPEC;
971
971
  unsigned int process_flags;
972
972
  bool normalize = (buf != NULL);
973
- bool validate = (flags & GIT_REF_FORMAT__VALIDATION_DISABLE) == 0;
973
+ bool validate = (flags & GIT_REFERENCE_FORMAT__VALIDATION_DISABLE) == 0;
974
974
 
975
975
  #ifdef GIT_USE_ICONV
976
976
  git_path_iconv_t ic = GIT_PATH_ICONV_INIT;
@@ -988,7 +988,7 @@ int git_reference__normalize_name(
988
988
  git_buf_clear(buf);
989
989
 
990
990
  #ifdef GIT_USE_ICONV
991
- if ((flags & GIT_REF_FORMAT__PRECOMPOSE_UNICODE) != 0) {
991
+ if ((flags & GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE) != 0) {
992
992
  size_t namelen = strlen(current);
993
993
  if ((error = git_path_iconv_init_precompose(&ic)) < 0 ||
994
994
  (error = git_path_iconv(&ic, &current, &namelen)) < 0)
@@ -1007,11 +1007,11 @@ int git_reference__normalize_name(
1007
1007
  while (true) {
1008
1008
  segment_len = ensure_segment_validity(current);
1009
1009
  if (segment_len < 0) {
1010
- if ((process_flags & GIT_REF_FORMAT_REFSPEC_PATTERN) &&
1010
+ if ((process_flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN) &&
1011
1011
  current[0] == '*' &&
1012
1012
  (current[1] == '\0' || current[1] == '/')) {
1013
1013
  /* Accept one wildcard as a full refname component. */
1014
- process_flags &= ~GIT_REF_FORMAT_REFSPEC_PATTERN;
1014
+ process_flags &= ~GIT_REFERENCE_FORMAT_REFSPEC_PATTERN;
1015
1015
  segment_len = 1;
1016
1016
  } else
1017
1017
  goto cleanup;
@@ -1056,13 +1056,13 @@ int git_reference__normalize_name(
1056
1056
  if (current[segment_len - 1] == '/')
1057
1057
  goto cleanup;
1058
1058
 
1059
- if ((segments_count == 1 ) && !(flags & GIT_REF_FORMAT_ALLOW_ONELEVEL))
1059
+ if ((segments_count == 1 ) && !(flags & GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL))
1060
1060
  goto cleanup;
1061
1061
 
1062
1062
  if ((segments_count == 1 ) &&
1063
- !(flags & GIT_REF_FORMAT_REFSPEC_SHORTHAND) &&
1063
+ !(flags & GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND) &&
1064
1064
  !(is_all_caps_and_underscore(name, (size_t)segment_len) ||
1065
- ((flags & GIT_REF_FORMAT_REFSPEC_PATTERN) && !strcmp("*", name))))
1065
+ ((flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN) && !strcmp("*", name))))
1066
1066
  goto cleanup;
1067
1067
 
1068
1068
  if ((segments_count > 1)
@@ -1073,12 +1073,12 @@ int git_reference__normalize_name(
1073
1073
 
1074
1074
  cleanup:
1075
1075
  if (error == GIT_EINVALIDSPEC)
1076
- giterr_set(
1077
- GITERR_REFERENCE,
1076
+ git_error_set(
1077
+ GIT_ERROR_REFERENCE,
1078
1078
  "the given reference name '%s' is not valid", name);
1079
1079
 
1080
1080
  if (error && normalize)
1081
- git_buf_free(buf);
1081
+ git_buf_dispose(buf);
1082
1082
 
1083
1083
  #ifdef GIT_USE_ICONV
1084
1084
  git_path_iconv_clear(&ic);
@@ -1100,8 +1100,8 @@ int git_reference_normalize_name(
1100
1100
  goto cleanup;
1101
1101
 
1102
1102
  if (git_buf_len(&buf) > buffer_size - 1) {
1103
- giterr_set(
1104
- GITERR_REFERENCE,
1103
+ git_error_set(
1104
+ GIT_ERROR_REFERENCE,
1105
1105
  "the provided buffer is too short to hold the normalization of '%s'", name);
1106
1106
  error = GIT_EBUFS;
1107
1107
  goto cleanup;
@@ -1112,17 +1112,17 @@ int git_reference_normalize_name(
1112
1112
  error = 0;
1113
1113
 
1114
1114
  cleanup:
1115
- git_buf_free(&buf);
1115
+ git_buf_dispose(&buf);
1116
1116
  return error;
1117
1117
  }
1118
1118
 
1119
- #define GIT_REF_TYPEMASK (GIT_REF_OID | GIT_REF_SYMBOLIC)
1119
+ #define GIT_REFERENCE_TYPEMASK (GIT_REFERENCE_DIRECT | GIT_REFERENCE_SYMBOLIC)
1120
1120
 
1121
1121
  int git_reference_cmp(
1122
1122
  const git_reference *ref1,
1123
1123
  const git_reference *ref2)
1124
1124
  {
1125
- git_ref_t type1, type2;
1125
+ git_reference_t type1, type2;
1126
1126
  assert(ref1 && ref2);
1127
1127
 
1128
1128
  type1 = git_reference_type(ref1);
@@ -1130,9 +1130,9 @@ int git_reference_cmp(
1130
1130
 
1131
1131
  /* let's put symbolic refs before OIDs */
1132
1132
  if (type1 != type2)
1133
- return (type1 == GIT_REF_SYMBOLIC) ? -1 : 1;
1133
+ return (type1 == GIT_REFERENCE_SYMBOLIC) ? -1 : 1;
1134
1134
 
1135
- if (type1 == GIT_REF_SYMBOLIC)
1135
+ if (type1 == GIT_REFERENCE_SYMBOLIC)
1136
1136
  return strcmp(ref1->target.symbolic, ref2->target.symbolic);
1137
1137
 
1138
1138
  return git_oid__cmp(&ref1->target.oid, &ref2->target.oid);
@@ -1148,7 +1148,7 @@ static int get_terminal(git_reference **out, git_repository *repo, const char *r
1148
1148
  int error = 0;
1149
1149
 
1150
1150
  if (nesting > MAX_NESTING_LEVEL) {
1151
- giterr_set(GITERR_REFERENCE, "reference chain too deep (%d)", nesting);
1151
+ git_error_set(GIT_ERROR_REFERENCE, "reference chain too deep (%d)", nesting);
1152
1152
  return GIT_ENOTFOUND;
1153
1153
  }
1154
1154
 
@@ -1158,7 +1158,7 @@ static int get_terminal(git_reference **out, git_repository *repo, const char *r
1158
1158
  return error;
1159
1159
  }
1160
1160
 
1161
- if (git_reference_type(ref) == GIT_REF_OID) {
1161
+ if (git_reference_type(ref) == GIT_REFERENCE_DIRECT) {
1162
1162
  *out = ref;
1163
1163
  error = 0;
1164
1164
  } else {
@@ -1197,16 +1197,16 @@ int git_reference__update_terminal(
1197
1197
 
1198
1198
  /* found a dangling symref */
1199
1199
  if (error == GIT_ENOTFOUND && ref) {
1200
- assert(git_reference_type(ref) == GIT_REF_SYMBOLIC);
1201
- giterr_clear();
1200
+ assert(git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC);
1201
+ git_error_clear();
1202
1202
  error = reference__create(&ref2, repo, ref->target.symbolic, oid, NULL, 0, to_use,
1203
1203
  log_message, NULL, NULL);
1204
1204
  } else if (error == GIT_ENOTFOUND) {
1205
- giterr_clear();
1205
+ git_error_clear();
1206
1206
  error = reference__create(&ref2, repo, ref_name, oid, NULL, 0, to_use,
1207
1207
  log_message, NULL, NULL);
1208
1208
  } else if (error == 0) {
1209
- assert(git_reference_type(ref) == GIT_REF_OID);
1209
+ assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
1210
1210
  error = reference__create(&ref2, repo, ref->name, oid, NULL, 1, to_use,
1211
1211
  log_message, &ref->target.oid, NULL);
1212
1212
  }
@@ -1264,7 +1264,7 @@ int git_reference__update_for_commit(
1264
1264
 
1265
1265
  done:
1266
1266
  git_reference_free(ref_new);
1267
- git_buf_free(&reflog_msg);
1267
+ git_buf_dispose(&reflog_msg);
1268
1268
  git_commit_free(commit);
1269
1269
  return error;
1270
1270
  }
@@ -1341,8 +1341,8 @@ int git_reference_is_note(const git_reference *ref)
1341
1341
 
1342
1342
  static int peel_error(int error, const git_reference *ref, const char* msg)
1343
1343
  {
1344
- giterr_set(
1345
- GITERR_INVALID,
1344
+ git_error_set(
1345
+ GIT_ERROR_INVALID,
1346
1346
  "the reference '%s' cannot be peeled - %s", git_reference_name(ref), msg);
1347
1347
  return error;
1348
1348
  }
@@ -1350,7 +1350,7 @@ static int peel_error(int error, const git_reference *ref, const char* msg)
1350
1350
  int git_reference_peel(
1351
1351
  git_object **peeled,
1352
1352
  const git_reference *ref,
1353
- git_otype target_type)
1353
+ git_object_t target_type)
1354
1354
  {
1355
1355
  const git_reference *resolved = NULL;
1356
1356
  git_reference *allocated = NULL;
@@ -1359,7 +1359,7 @@ int git_reference_peel(
1359
1359
 
1360
1360
  assert(ref);
1361
1361
 
1362
- if (ref->type == GIT_REF_OID) {
1362
+ if (ref->type == GIT_REFERENCE_DIRECT) {
1363
1363
  resolved = ref;
1364
1364
  } else {
1365
1365
  if ((error = git_reference_resolve(&allocated, ref)) < 0)
@@ -1374,12 +1374,12 @@ int git_reference_peel(
1374
1374
  * to a commit. So we only want to use the peeled value
1375
1375
  * if it is not zero and the target is not a tag.
1376
1376
  */
1377
- if (target_type != GIT_OBJ_TAG && !git_oid_iszero(&resolved->peel)) {
1377
+ if (target_type != GIT_OBJECT_TAG && !git_oid_iszero(&resolved->peel)) {
1378
1378
  error = git_object_lookup(&target,
1379
- git_reference_owner(ref), &resolved->peel, GIT_OBJ_ANY);
1379
+ git_reference_owner(ref), &resolved->peel, GIT_OBJECT_ANY);
1380
1380
  } else {
1381
1381
  error = git_object_lookup(&target,
1382
- git_reference_owner(ref), &resolved->target.oid, GIT_OBJ_ANY);
1382
+ git_reference_owner(ref), &resolved->target.oid, GIT_OBJECT_ANY);
1383
1383
  }
1384
1384
 
1385
1385
  if (error < 0) {
@@ -1387,7 +1387,7 @@ int git_reference_peel(
1387
1387
  goto cleanup;
1388
1388
  }
1389
1389
 
1390
- if (target_type == GIT_OBJ_ANY && git_object_type(target) != GIT_OBJ_TAG)
1390
+ if (target_type == GIT_OBJECT_ANY && git_object_type(target) != GIT_OBJECT_TAG)
1391
1391
  error = git_object_dup(peeled, target);
1392
1392
  else
1393
1393
  error = git_object_peel(peeled, target, target_type);
@@ -1402,7 +1402,7 @@ cleanup:
1402
1402
  int git_reference__is_valid_name(const char *refname, unsigned int flags)
1403
1403
  {
1404
1404
  if (git_reference__normalize_name(NULL, refname, flags) < 0) {
1405
- giterr_clear();
1405
+ git_error_clear();
1406
1406
  return false;
1407
1407
  }
1408
1408
 
@@ -1411,7 +1411,7 @@ int git_reference__is_valid_name(const char *refname, unsigned int flags)
1411
1411
 
1412
1412
  int git_reference_is_valid_name(const char *refname)
1413
1413
  {
1414
- return git_reference__is_valid_name(refname, GIT_REF_FORMAT_ALLOW_ONELEVEL);
1414
+ return git_reference__is_valid_name(refname, GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL);
1415
1415
  }
1416
1416
 
1417
1417
  const char *git_reference__shorthand(const char *name)
@@ -1433,3 +1433,27 @@ const char *git_reference_shorthand(const git_reference *ref)
1433
1433
  {
1434
1434
  return git_reference__shorthand(ref->name);
1435
1435
  }
1436
+
1437
+ int git_reference__is_unborn_head(bool *unborn, const git_reference *ref, git_repository *repo)
1438
+ {
1439
+ int error;
1440
+ git_reference *tmp_ref;
1441
+ assert(unborn && ref && repo);
1442
+
1443
+ if (ref->type == GIT_REFERENCE_DIRECT) {
1444
+ *unborn = 0;
1445
+ return 0;
1446
+ }
1447
+
1448
+ error = git_reference_lookup_resolved(&tmp_ref, repo, ref->name, -1);
1449
+ git_reference_free(tmp_ref);
1450
+
1451
+ if (error != 0 && error != GIT_ENOTFOUND)
1452
+ return error;
1453
+ else if (error == GIT_ENOTFOUND && git__strcmp(ref->name, GIT_HEAD_FILE) == 0)
1454
+ *unborn = true;
1455
+ else
1456
+ *unborn = false;
1457
+
1458
+ return 0;
1459
+ }