rugged 1.5.1 → 1.6.2

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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +2 -2
  3. data/ext/rugged/rugged_blame.c +2 -0
  4. data/ext/rugged/rugged_blob.c +3 -0
  5. data/ext/rugged/rugged_commit.c +1 -0
  6. data/ext/rugged/rugged_config.c +2 -0
  7. data/ext/rugged/rugged_diff.c +1 -0
  8. data/ext/rugged/rugged_index.c +2 -0
  9. data/ext/rugged/rugged_patch.c +1 -0
  10. data/ext/rugged/rugged_rebase.c +1 -0
  11. data/ext/rugged/rugged_reference.c +1 -0
  12. data/ext/rugged/rugged_remote.c +1 -0
  13. data/ext/rugged/rugged_repo.c +5 -2
  14. data/ext/rugged/rugged_revwalk.c +5 -1
  15. data/ext/rugged/rugged_submodule.c +1 -0
  16. data/ext/rugged/rugged_tag.c +1 -0
  17. data/ext/rugged/rugged_tree.c +4 -0
  18. data/lib/rugged/index.rb +1 -1
  19. data/lib/rugged/tree.rb +1 -1
  20. data/lib/rugged/version.rb +1 -1
  21. data/vendor/libgit2/CMakeLists.txt +5 -1
  22. data/vendor/libgit2/COPYING +30 -0
  23. data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
  24. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
  25. data/vendor/libgit2/include/git2/common.h +13 -6
  26. data/vendor/libgit2/include/git2/deprecated.h +6 -0
  27. data/vendor/libgit2/include/git2/diff.h +1 -1
  28. data/vendor/libgit2/include/git2/experimental.h +20 -0
  29. data/vendor/libgit2/include/git2/indexer.h +29 -0
  30. data/vendor/libgit2/include/git2/object.h +28 -2
  31. data/vendor/libgit2/include/git2/odb.h +58 -7
  32. data/vendor/libgit2/include/git2/odb_backend.h +106 -18
  33. data/vendor/libgit2/include/git2/oid.h +115 -15
  34. data/vendor/libgit2/include/git2/repository.h +20 -1
  35. data/vendor/libgit2/include/git2/stash.h +60 -6
  36. data/vendor/libgit2/include/git2/strarray.h +0 -13
  37. data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
  38. data/vendor/libgit2/include/git2/sys/transport.h +12 -0
  39. data/vendor/libgit2/include/git2/version.h +4 -4
  40. data/vendor/libgit2/include/git2.h +1 -0
  41. data/vendor/libgit2/src/CMakeLists.txt +0 -6
  42. data/vendor/libgit2/src/cli/CMakeLists.txt +6 -2
  43. data/vendor/libgit2/src/cli/cmd_hash_object.c +27 -8
  44. data/vendor/libgit2/src/cli/opt.c +1 -1
  45. data/vendor/libgit2/src/libgit2/CMakeLists.txt +25 -15
  46. data/vendor/libgit2/src/libgit2/annotated_commit.c +1 -1
  47. data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
  48. data/vendor/libgit2/src/libgit2/attr_file.c +1 -1
  49. data/vendor/libgit2/src/libgit2/attrcache.c +1 -1
  50. data/vendor/libgit2/src/libgit2/blame.c +2 -0
  51. data/vendor/libgit2/src/libgit2/blob.c +4 -2
  52. data/vendor/libgit2/src/libgit2/blob.h +2 -2
  53. data/vendor/libgit2/src/libgit2/branch.c +2 -2
  54. data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
  55. data/vendor/libgit2/src/libgit2/clone.c +31 -2
  56. data/vendor/libgit2/src/libgit2/commit.c +52 -17
  57. data/vendor/libgit2/src/libgit2/commit.h +25 -7
  58. data/vendor/libgit2/src/libgit2/commit_graph.c +47 -32
  59. data/vendor/libgit2/src/libgit2/commit_graph.h +3 -0
  60. data/vendor/libgit2/src/libgit2/commit_list.c +6 -2
  61. data/vendor/libgit2/src/libgit2/config.c +1 -1
  62. data/vendor/libgit2/src/libgit2/config_file.c +2 -2
  63. data/vendor/libgit2/src/libgit2/describe.c +8 -8
  64. data/vendor/libgit2/src/libgit2/diff.c +5 -1
  65. data/vendor/libgit2/src/libgit2/diff_file.c +15 -6
  66. data/vendor/libgit2/src/libgit2/diff_generate.c +17 -12
  67. data/vendor/libgit2/src/libgit2/diff_print.c +5 -5
  68. data/vendor/libgit2/src/libgit2/diff_tform.c +4 -0
  69. data/vendor/libgit2/src/libgit2/email.c +2 -2
  70. data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
  71. data/vendor/libgit2/src/libgit2/fetch.c +3 -6
  72. data/vendor/libgit2/src/libgit2/fetchhead.c +4 -4
  73. data/vendor/libgit2/src/libgit2/ident.c +3 -3
  74. data/vendor/libgit2/src/libgit2/index.c +11 -9
  75. data/vendor/libgit2/src/libgit2/indexer.c +107 -44
  76. data/vendor/libgit2/src/libgit2/iterator.c +4 -2
  77. data/vendor/libgit2/src/libgit2/libgit2.c +19 -0
  78. data/vendor/libgit2/src/libgit2/merge.c +3 -3
  79. data/vendor/libgit2/src/libgit2/midx.c +16 -15
  80. data/vendor/libgit2/src/libgit2/mwindow.c +5 -2
  81. data/vendor/libgit2/src/libgit2/mwindow.h +4 -1
  82. data/vendor/libgit2/src/libgit2/notes.c +5 -5
  83. data/vendor/libgit2/src/libgit2/object.c +89 -25
  84. data/vendor/libgit2/src/libgit2/object.h +12 -3
  85. data/vendor/libgit2/src/libgit2/odb.c +194 -50
  86. data/vendor/libgit2/src/libgit2/odb.h +43 -4
  87. data/vendor/libgit2/src/libgit2/odb_loose.c +128 -70
  88. data/vendor/libgit2/src/libgit2/odb_pack.c +96 -44
  89. data/vendor/libgit2/src/libgit2/oid.c +134 -76
  90. data/vendor/libgit2/src/libgit2/oid.h +183 -9
  91. data/vendor/libgit2/src/libgit2/pack-objects.c +15 -4
  92. data/vendor/libgit2/src/libgit2/pack.c +90 -66
  93. data/vendor/libgit2/src/libgit2/pack.h +29 -15
  94. data/vendor/libgit2/src/libgit2/parse.c +4 -3
  95. data/vendor/libgit2/src/libgit2/patch_parse.c +5 -5
  96. data/vendor/libgit2/src/libgit2/push.c +13 -3
  97. data/vendor/libgit2/src/libgit2/reader.c +1 -1
  98. data/vendor/libgit2/src/libgit2/rebase.c +19 -18
  99. data/vendor/libgit2/src/libgit2/refdb_fs.c +70 -39
  100. data/vendor/libgit2/src/libgit2/reflog.c +7 -5
  101. data/vendor/libgit2/src/libgit2/reflog.h +1 -2
  102. data/vendor/libgit2/src/libgit2/refs.c +2 -0
  103. data/vendor/libgit2/src/libgit2/remote.c +38 -37
  104. data/vendor/libgit2/src/libgit2/remote.h +40 -0
  105. data/vendor/libgit2/src/libgit2/repository.c +212 -36
  106. data/vendor/libgit2/src/libgit2/repository.h +9 -0
  107. data/vendor/libgit2/src/libgit2/reset.c +2 -2
  108. data/vendor/libgit2/src/libgit2/revert.c +4 -4
  109. data/vendor/libgit2/src/libgit2/revparse.c +23 -7
  110. data/vendor/libgit2/src/libgit2/revwalk.c +5 -1
  111. data/vendor/libgit2/src/libgit2/stash.c +201 -26
  112. data/vendor/libgit2/src/libgit2/strarray.c +1 -0
  113. data/vendor/libgit2/src/libgit2/strarray.h +25 -0
  114. data/vendor/libgit2/src/libgit2/streams/openssl.c +1 -1
  115. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +7 -3
  116. data/vendor/libgit2/src/libgit2/streams/socket.c +4 -1
  117. data/vendor/libgit2/src/libgit2/submodule.c +6 -2
  118. data/vendor/libgit2/src/libgit2/sysdir.c +294 -7
  119. data/vendor/libgit2/src/libgit2/sysdir.h +39 -9
  120. data/vendor/libgit2/src/libgit2/tag.c +29 -10
  121. data/vendor/libgit2/src/libgit2/tag.h +2 -2
  122. data/vendor/libgit2/src/libgit2/threadstate.h +1 -1
  123. data/vendor/libgit2/src/libgit2/transports/http.c +8 -7
  124. data/vendor/libgit2/src/libgit2/transports/httpclient.c +9 -0
  125. data/vendor/libgit2/src/libgit2/transports/httpclient.h +10 -0
  126. data/vendor/libgit2/src/libgit2/transports/local.c +14 -0
  127. data/vendor/libgit2/src/libgit2/transports/smart.c +35 -0
  128. data/vendor/libgit2/src/libgit2/transports/smart.h +10 -1
  129. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +153 -41
  130. data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +42 -12
  131. data/vendor/libgit2/src/libgit2/transports/ssh.c +62 -65
  132. data/vendor/libgit2/src/libgit2/transports/winhttp.c +9 -4
  133. data/vendor/libgit2/src/libgit2/tree-cache.c +4 -4
  134. data/vendor/libgit2/src/libgit2/tree.c +22 -16
  135. data/vendor/libgit2/src/libgit2/tree.h +2 -2
  136. data/vendor/libgit2/src/libgit2/worktree.c +5 -0
  137. data/vendor/libgit2/src/util/CMakeLists.txt +7 -1
  138. data/vendor/libgit2/src/util/fs_path.c +1 -1
  139. data/vendor/libgit2/src/util/futils.c +0 -3
  140. data/vendor/libgit2/src/util/git2_util.h +2 -2
  141. data/vendor/libgit2/src/util/hash/openssl.c +4 -3
  142. data/vendor/libgit2/src/util/hash/rfc6234/sha.h +0 -112
  143. data/vendor/libgit2/src/util/hash.h +13 -0
  144. data/vendor/libgit2/src/util/net.c +338 -84
  145. data/vendor/libgit2/src/util/net.h +7 -0
  146. data/vendor/libgit2/src/util/posix.h +2 -0
  147. data/vendor/libgit2/src/util/rand.c +4 -0
  148. data/vendor/libgit2/src/util/regexp.c +3 -3
  149. data/vendor/libgit2/src/util/thread.h +20 -19
  150. data/vendor/libgit2/src/util/util.h +1 -0
  151. metadata +7 -5
  152. data/vendor/libgit2/src/util/win32/findfile.c +0 -286
  153. data/vendor/libgit2/src/util/win32/findfile.h +0 -22
  154. /data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +0 -0
@@ -11,16 +11,16 @@
11
11
  * The version string for libgit2. This string follows semantic
12
12
  * versioning (v2) guidelines.
13
13
  */
14
- #define LIBGIT2_VERSION "1.5.1"
14
+ #define LIBGIT2_VERSION "1.6.2"
15
15
 
16
16
  /** The major version number for this version of libgit2. */
17
17
  #define LIBGIT2_VER_MAJOR 1
18
18
 
19
19
  /** The minor version number for this version of libgit2. */
20
- #define LIBGIT2_VER_MINOR 5
20
+ #define LIBGIT2_VER_MINOR 6
21
21
 
22
22
  /** The revision ("teeny") version number for this version of libgit2. */
23
- #define LIBGIT2_VER_REVISION 1
23
+ #define LIBGIT2_VER_REVISION 2
24
24
 
25
25
  /** The Windows DLL patch number for this version of libgit2. */
26
26
  #define LIBGIT2_VER_PATCH 0
@@ -34,6 +34,6 @@
34
34
  #define LIBGIT2_VER_PRERELEASE NULL
35
35
 
36
36
  /** The library ABI soversion for this version of libgit2. */
37
- #define LIBGIT2_SOVERSION "1.5"
37
+ #define LIBGIT2_SOVERSION "1.6"
38
38
 
39
39
  #endif
@@ -28,6 +28,7 @@
28
28
  #include "git2/diff.h"
29
29
  #include "git2/email.h"
30
30
  #include "git2/errors.h"
31
+ #include "git2/experimental.h"
31
32
  #include "git2/filter.h"
32
33
  #include "git2/global.h"
33
34
  #include "git2/graph.h"
@@ -170,12 +170,6 @@ if(ICONV_FOUND)
170
170
  endif()
171
171
  add_feature_info(iconv GIT_USE_ICONV "iconv encoding conversion support")
172
172
 
173
- #
174
- # Configure support
175
- #
176
-
177
- configure_file(features.h.in git2/sys/features.h)
178
-
179
173
  #
180
174
  # Include child projects
181
175
  #
@@ -1,8 +1,11 @@
1
1
  set(CLI_INCLUDES
2
- "${libgit2_BINARY_DIR}/src"
2
+ "${libgit2_BINARY_DIR}/src/util"
3
+ "${libgit2_BINARY_DIR}/include"
4
+ "${libgit2_BINARY_DIR}/include/git2"
3
5
  "${libgit2_SOURCE_DIR}/src/util"
4
6
  "${libgit2_SOURCE_DIR}/src/cli"
5
- "${libgit2_SOURCE_DIR}/include")
7
+ "${libgit2_SOURCE_DIR}/include"
8
+ "${LIBGIT2_DEPENDENCY_INCLUDES}")
6
9
 
7
10
  if(WIN32 AND NOT CYGWIN)
8
11
  file(GLOB CLI_SRC_OS win32/*.c)
@@ -39,6 +42,7 @@ target_link_libraries(git2_cli ${CLI_LIBGIT2_LIBRARY} ${LIBGIT2_SYSTEM_LIBS})
39
42
 
40
43
  set_target_properties(git2_cli PROPERTIES C_STANDARD 90)
41
44
  set_target_properties(git2_cli PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
45
+ set_target_properties(git2_cli PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
42
46
 
43
47
  ide_split_sources(git2_cli)
44
48
 
@@ -49,23 +49,39 @@ static void print_help(void)
49
49
  cli_opt_help_fprint(stdout, opts);
50
50
  }
51
51
 
52
- static int hash_buf(git_odb *odb, git_str *buf, git_object_t type)
52
+ static int hash_buf(
53
+ git_odb *odb,
54
+ git_str *buf,
55
+ git_object_t object_type,
56
+ git_oid_t oid_type)
53
57
  {
54
58
  git_oid oid;
55
59
 
56
60
  if (!literally) {
57
61
  int valid = 0;
58
62
 
59
- if (git_object_rawcontent_is_valid(&valid, buf->ptr, buf->size, type) < 0 || !valid)
63
+ #ifdef GIT_EXPERIMENTAL_SHA256
64
+ if (git_object_rawcontent_is_valid(&valid, buf->ptr, buf->size, object_type, oid_type) < 0 || !valid)
60
65
  return cli_error_git();
66
+ #else
67
+ GIT_UNUSED(oid_type);
68
+
69
+ if (git_object_rawcontent_is_valid(&valid, buf->ptr, buf->size, object_type) < 0 || !valid)
70
+ return cli_error_git();
71
+ #endif
61
72
  }
62
73
 
63
74
  if (write_object) {
64
- if (git_odb_write(&oid, odb, buf->ptr, buf->size, type) < 0)
75
+ if (git_odb_write(&oid, odb, buf->ptr, buf->size, object_type) < 0)
65
76
  return cli_error_git();
66
77
  } else {
67
- if (git_odb_hash(&oid, buf->ptr, buf->size, type) < 0)
78
+ #ifdef GIT_EXPERIMENTAL_SHA256
79
+ if (git_odb_hash(&oid, buf->ptr, buf->size, object_type, GIT_OID_SHA1) < 0)
68
80
  return cli_error_git();
81
+ #else
82
+ if (git_odb_hash(&oid, buf->ptr, buf->size, object_type) < 0)
83
+ return cli_error_git();
84
+ #endif
69
85
  }
70
86
 
71
87
  if (printf("%s\n", git_oid_tostr_s(&oid)) < 0)
@@ -78,9 +94,10 @@ int cmd_hash_object(int argc, char **argv)
78
94
  {
79
95
  git_repository *repo = NULL;
80
96
  git_odb *odb = NULL;
97
+ git_oid_t oid_type;
81
98
  git_str buf = GIT_STR_INIT;
82
99
  cli_opt invalid_opt;
83
- git_object_t type = GIT_OBJECT_BLOB;
100
+ git_object_t object_type = GIT_OBJECT_BLOB;
84
101
  char **filename;
85
102
  int ret = 0;
86
103
 
@@ -92,7 +109,7 @@ int cmd_hash_object(int argc, char **argv)
92
109
  return 0;
93
110
  }
94
111
 
95
- if (type_name && (type = git_object_string2type(type_name)) == GIT_OBJECT_INVALID)
112
+ if (type_name && (object_type = git_object_string2type(type_name)) == GIT_OBJECT_INVALID)
96
113
  return cli_error_usage("invalid object type '%s'", type_name);
97
114
 
98
115
  if (write_object &&
@@ -102,6 +119,8 @@ int cmd_hash_object(int argc, char **argv)
102
119
  goto done;
103
120
  }
104
121
 
122
+ oid_type = git_repository_oid_type(repo);
123
+
105
124
  /*
106
125
  * TODO: we're reading blobs, we shouldn't pull them all into main
107
126
  * memory, we should just stream them into the odb instead.
@@ -113,7 +132,7 @@ int cmd_hash_object(int argc, char **argv)
113
132
  goto done;
114
133
  }
115
134
 
116
- if ((ret = hash_buf(odb, &buf, type)) != 0)
135
+ if ((ret = hash_buf(odb, &buf, object_type, oid_type)) != 0)
117
136
  goto done;
118
137
  } else {
119
138
  for (filename = filenames; *filename; filename++) {
@@ -122,7 +141,7 @@ int cmd_hash_object(int argc, char **argv)
122
141
  goto done;
123
142
  }
124
143
 
125
- if ((ret = hash_buf(odb, &buf, type)) != 0)
144
+ if ((ret = hash_buf(odb, &buf, object_type, oid_type)) != 0)
126
145
  goto done;
127
146
  }
128
147
  }
@@ -23,7 +23,7 @@
23
23
  #include "opt.h"
24
24
 
25
25
  #ifdef _WIN32
26
- # include <Windows.h>
26
+ # include <windows.h>
27
27
  #else
28
28
  # include <fcntl.h>
29
29
  # include <sys/ioctl.h>
@@ -8,21 +8,13 @@ set_target_properties(libgit2 PROPERTIES C_EXTENSIONS OFF)
8
8
  include(PkgBuildConfig)
9
9
 
10
10
  set(LIBGIT2_INCLUDES
11
- "${PROJECT_BINARY_DIR}/src"
11
+ "${PROJECT_BINARY_DIR}/src/util"
12
+ "${PROJECT_BINARY_DIR}/include"
13
+ "${PROJECT_BINARY_DIR}/include/git2"
12
14
  "${PROJECT_SOURCE_DIR}/src/libgit2"
13
15
  "${PROJECT_SOURCE_DIR}/src/util"
14
16
  "${PROJECT_SOURCE_DIR}/include")
15
17
 
16
- if(WIN32 AND EMBED_SSH_PATH)
17
- file(GLOB SRC_SSH "${EMBED_SSH_PATH}/src/*.c")
18
- list(SORT SRC_SSH)
19
- target_sources(libgit2 PRIVATE ${SRC_SSH})
20
-
21
- list(APPEND LIBGIT2_SYSTEM_INCLUDES "${EMBED_SSH_PATH}/include")
22
- file(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"")
23
- set(GIT_SSH 1)
24
- endif()
25
-
26
18
  # Collect sourcefiles
27
19
  file(GLOB SRC_H
28
20
  "${PROJECT_SOURCE_DIR}/include/git2.h"
@@ -67,6 +59,7 @@ endif()
67
59
 
68
60
  ide_split_sources(libgit2)
69
61
  list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:util> $<TARGET_OBJECTS:libgit2> ${LIBGIT2_DEPENDENCY_OBJECTS})
62
+ list(APPEND LIBGIT2_INCLUDES ${LIBGIT2_DEPENDENCY_INCLUDES})
70
63
 
71
64
  target_include_directories(libgit2 PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES} PUBLIC ${PROJECT_SOURCE_DIR}/include)
72
65
  target_include_directories(libgit2 SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
@@ -84,6 +77,7 @@ set(LIBGIT2_SYSTEM_LIBS ${LIBGIT2_SYSTEM_LIBS} PARENT_SCOPE)
84
77
 
85
78
  add_library(libgit2package ${SRC_RC} ${LIBGIT2_OBJECTS})
86
79
  target_link_libraries(libgit2package ${LIBGIT2_SYSTEM_LIBS})
80
+ target_include_directories(libgit2package SYSTEM PRIVATE ${LIBGIT2_INCLUDES})
87
81
 
88
82
  set_target_properties(libgit2package PROPERTIES C_STANDARD 90)
89
83
  set_target_properties(libgit2package PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
@@ -109,10 +103,10 @@ if(SONAME)
109
103
  endif()
110
104
  endif()
111
105
 
112
- pkg_build_config(NAME libgit2
106
+ pkg_build_config(NAME "lib${LIBGIT2_FILENAME}"
113
107
  VERSION ${libgit2_VERSION}
114
108
  DESCRIPTION "The git library, take 2"
115
- LIBS_SELF git2
109
+ LIBS_SELF ${LIBGIT2_FILENAME}
116
110
  PRIVATE_LIBS ${LIBGIT2_PC_LIBS}
117
111
  REQUIRES ${LIBGIT2_PC_REQUIRES})
118
112
 
@@ -122,10 +116,26 @@ if(MSVC_IDE)
122
116
  set_source_files_properties(win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
123
117
  endif()
124
118
 
119
+ # support experimental features and functionality
120
+
121
+ configure_file(experimental.h.in "${PROJECT_BINARY_DIR}/include/git2/experimental.h")
122
+
123
+ # translate filenames in the git2.h so that they match the install directory
124
+ # (allows for side-by-side installs of libgit2 and libgit2-experimental.)
125
+
126
+ FILE(READ "${PROJECT_SOURCE_DIR}/include/git2.h" LIBGIT2_INCLUDE)
127
+ STRING(REGEX REPLACE "#include \"git2\/" "#include \"${LIBGIT2_FILENAME}/" LIBGIT2_INCLUDE "${LIBGIT2_INCLUDE}")
128
+ FILE(WRITE "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h" ${LIBGIT2_INCLUDE})
129
+
125
130
  # Install
131
+
126
132
  install(TARGETS libgit2package
127
133
  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
128
134
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
129
135
  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
130
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
131
- install(FILES ${PROJECT_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
136
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2/
137
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
138
+ install(FILES ${PROJECT_BINARY_DIR}/include/git2/experimental.h
139
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
140
+ install(FILES "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h"
141
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@@ -40,7 +40,7 @@ static int annotated_commit_init(
40
40
  goto done;
41
41
 
42
42
  git_oid_fmt(annotated_commit->id_str, git_commit_id(commit));
43
- annotated_commit->id_str[GIT_OID_HEXSZ] = '\0';
43
+ annotated_commit->id_str[GIT_OID_SHA1_HEXSIZE] = '\0';
44
44
 
45
45
  if (!description)
46
46
  description = annotated_commit->id_str;
@@ -41,7 +41,7 @@ struct git_annotated_commit {
41
41
  const char *ref_name;
42
42
  const char *remote_url;
43
43
 
44
- char id_str[GIT_OID_HEXSZ+1];
44
+ char id_str[GIT_OID_SHA1_HEXSIZE+1];
45
45
  };
46
46
 
47
47
  extern int git_annotated_commit_from_head(git_annotated_commit **out,
@@ -135,7 +135,7 @@ int git_attr_file__load(
135
135
  break;
136
136
  case GIT_ATTR_FILE_SOURCE_INDEX: {
137
137
  if ((error = attr_file_oid_from_index(&id, repo, entry->path)) < 0 ||
138
- (error = git_blob_lookup(&blob, repo, &id)) < 0)
138
+ (error = git_blob_lookup(&blob, repo, &id)) < 0)
139
139
  return error;
140
140
 
141
141
  /* Do not assume that data straight from the ODB is NULL-terminated;
@@ -300,7 +300,7 @@ static int attr_cache__lookup_path(
300
300
 
301
301
  /* expand leading ~/ as needed */
302
302
  if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
303
- if (! (error = git_sysdir_expand_global_file(&buf, &cfgval[2])))
303
+ if (! (error = git_sysdir_expand_homedir_file(&buf, &cfgval[2])))
304
304
  *out = git_str_detach(&buf);
305
305
  } else if (cfgval) {
306
306
  *out = git__strdup(cfgval);
@@ -72,6 +72,8 @@ static git_blame_hunk *new_hunk(
72
72
  hunk->final_start_line_number = start;
73
73
  hunk->orig_start_line_number = orig_start;
74
74
  hunk->orig_path = path ? git__strdup(path) : NULL;
75
+ git_oid_clear(&hunk->orig_commit_id, GIT_OID_SHA1);
76
+ git_oid_clear(&hunk->final_commit_id, GIT_OID_SHA1);
75
77
 
76
78
  return hunk;
77
79
  }
@@ -52,11 +52,12 @@ void git_blob__free(void *_blob)
52
52
  git__free(blob);
53
53
  }
54
54
 
55
- int git_blob__parse_raw(void *_blob, const char *data, size_t size)
55
+ int git_blob__parse_raw(void *_blob, const char *data, size_t size, git_oid_t oid_type)
56
56
  {
57
57
  git_blob *blob = (git_blob *) _blob;
58
58
 
59
59
  GIT_ASSERT_ARG(blob);
60
+ GIT_UNUSED(oid_type);
60
61
 
61
62
  blob->raw = 1;
62
63
  blob->data.raw.data = data;
@@ -64,11 +65,12 @@ int git_blob__parse_raw(void *_blob, const char *data, size_t size)
64
65
  return 0;
65
66
  }
66
67
 
67
- int git_blob__parse(void *_blob, git_odb_object *odb_obj)
68
+ int git_blob__parse(void *_blob, git_odb_object *odb_obj, git_oid_t oid_type)
68
69
  {
69
70
  git_blob *blob = (git_blob *) _blob;
70
71
 
71
72
  GIT_ASSERT_ARG(blob);
73
+ GIT_UNUSED(oid_type);
72
74
 
73
75
  git_cached_obj_incref((git_cached_obj *)odb_obj);
74
76
  blob->raw = 0;
@@ -36,8 +36,8 @@ struct git_blob {
36
36
  } while(0)
37
37
 
38
38
  void git_blob__free(void *blob);
39
- int git_blob__parse(void *blob, git_odb_object *obj);
40
- int git_blob__parse_raw(void *blob, const char *data, size_t size);
39
+ int git_blob__parse(void *blob, git_odb_object *obj, git_oid_t oid_type);
40
+ int git_blob__parse_raw(void *blob, const char *data, size_t size, git_oid_t oid_type);
41
41
  int git_blob__getbuf(git_str *buffer, git_blob *blob);
42
42
 
43
43
  extern int git_blob__create_from_paths(
@@ -134,9 +134,9 @@ int git_branch_create(
134
134
  const git_commit *commit,
135
135
  int force)
136
136
  {
137
- char commit_id[GIT_OID_HEXSZ + 1];
137
+ char commit_id[GIT_OID_SHA1_HEXSIZE + 1];
138
138
 
139
- git_oid_tostr(commit_id, GIT_OID_HEXSZ + 1, git_commit_id(commit));
139
+ git_oid_tostr(commit_id, GIT_OID_SHA1_HEXSIZE + 1, git_commit_id(commit));
140
140
  return create_branch(ref_out, repository, branch_name, commit, commit_id, force);
141
141
  }
142
142
 
@@ -106,10 +106,10 @@ static int cherrypick_state_cleanup(git_repository *repo)
106
106
 
107
107
  static int cherrypick_seterr(git_commit *commit, const char *fmt)
108
108
  {
109
- char commit_oidstr[GIT_OID_HEXSZ + 1];
109
+ char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
110
110
 
111
111
  git_error_set(GIT_ERROR_CHERRYPICK, fmt,
112
- git_oid_tostr(commit_oidstr, GIT_OID_HEXSZ + 1, git_commit_id(commit)));
112
+ git_oid_tostr(commit_oidstr, GIT_OID_SHA1_HEXSIZE + 1, git_commit_id(commit)));
113
113
 
114
114
  return -1;
115
115
  }
@@ -173,7 +173,7 @@ int git_cherrypick(
173
173
  git_cherrypick_options opts;
174
174
  git_reference *our_ref = NULL;
175
175
  git_commit *our_commit = NULL;
176
- char commit_oidstr[GIT_OID_HEXSZ + 1];
176
+ char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
177
177
  const char *commit_msg, *commit_summary;
178
178
  git_str their_label = GIT_STR_INIT;
179
179
  git_index *index = NULL;
@@ -282,7 +282,11 @@ static int update_head_to_branch(
282
282
  reflog_message)) < 0)
283
283
  goto cleanup;
284
284
 
285
- if ((retcode = git_remote__default_branch(&default_branch, remote)) < 0)
285
+ retcode = git_remote__default_branch(&default_branch, remote);
286
+
287
+ if (retcode == GIT_ENOTFOUND)
288
+ retcode = 0;
289
+ else if (retcode)
286
290
  goto cleanup;
287
291
 
288
292
  if (!git_remote__matching_refspec(remote, git_str_cstr(&default_branch)))
@@ -389,12 +393,19 @@ static int checkout_branch(git_repository *repo, git_remote *remote, const git_c
389
393
  return error;
390
394
  }
391
395
 
392
- static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch_options *opts, const git_checkout_options *co_opts, const char *branch)
396
+ static int clone_into(
397
+ git_repository *repo,
398
+ git_remote *_remote,
399
+ const git_fetch_options *opts,
400
+ const git_checkout_options *co_opts,
401
+ const char *branch)
393
402
  {
394
403
  int error;
395
404
  git_str reflog_message = GIT_STR_INIT;
405
+ git_remote_connect_options connect_opts = GIT_REMOTE_CONNECT_OPTIONS_INIT;
396
406
  git_fetch_options fetch_opts;
397
407
  git_remote *remote;
408
+ git_oid_t oid_type;
398
409
 
399
410
  GIT_ASSERT_ARG(repo);
400
411
  GIT_ASSERT_ARG(_remote);
@@ -410,8 +421,25 @@ static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch
410
421
  memcpy(&fetch_opts, opts, sizeof(git_fetch_options));
411
422
  fetch_opts.update_fetchhead = 0;
412
423
  fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL;
424
+
425
+ if ((error = git_remote_connect_options__from_fetch_opts(&connect_opts, remote, &fetch_opts)) < 0)
426
+ goto cleanup;
427
+
413
428
  git_str_printf(&reflog_message, "clone: from %s", git_remote_url(remote));
414
429
 
430
+ /*
431
+ * Connect to the server so that we can identify the remote
432
+ * object format.
433
+ */
434
+
435
+ if ((error = git_remote_connect_ext(remote, GIT_DIRECTION_FETCH,
436
+ &connect_opts)) < 0)
437
+ goto cleanup;
438
+
439
+ if ((error = git_remote_oid_type(&oid_type, remote)) < 0 ||
440
+ (error = git_repository__set_objectformat(repo, oid_type)) < 0)
441
+ goto cleanup;
442
+
415
443
  if ((error = git_remote_fetch(remote, NULL, &fetch_opts, git_str_cstr(&reflog_message))) != 0)
416
444
  goto cleanup;
417
445
 
@@ -419,6 +447,7 @@ static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch
419
447
 
420
448
  cleanup:
421
449
  git_remote_free(remote);
450
+ git_remote_connect_options_dispose(&connect_opts);
422
451
  git_str_dispose(&reflog_message);
423
452
 
424
453
  return error;
@@ -56,11 +56,13 @@ static int git_commit__create_buffer_internal(
56
56
  GIT_ASSERT_ARG(out);
57
57
  GIT_ASSERT_ARG(tree);
58
58
 
59
- git_oid__writebuf(out, "tree ", tree);
59
+ if (git_object__write_oid_header(out, "tree ", tree) < 0)
60
+ goto on_error;
60
61
 
61
62
  for (i = 0; i < git_array_size(*parents); i++) {
62
63
  parent = git_array_get(*parents, i);
63
- git_oid__writebuf(out, "parent ", parent);
64
+ if (git_object__write_oid_header(out, "parent ", parent) < 0)
65
+ goto on_error;
64
66
  }
65
67
 
66
68
  git_signature__writebuf(out, "author ", author);
@@ -388,7 +390,11 @@ int git_commit_amend(
388
390
  return error;
389
391
  }
390
392
 
391
- static int commit_parse(git_commit *commit, const char *data, size_t size, unsigned int flags)
393
+ static int commit_parse(
394
+ git_commit *commit,
395
+ const char *data,
396
+ size_t size,
397
+ git_commit__parse_options *opts)
392
398
  {
393
399
  const char *buffer_start = data, *buffer;
394
400
  const char *buffer_end = buffer_start + size;
@@ -399,6 +405,7 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
399
405
 
400
406
  GIT_ASSERT_ARG(commit);
401
407
  GIT_ASSERT_ARG(data);
408
+ GIT_ASSERT_ARG(opts);
402
409
 
403
410
  buffer = buffer_start;
404
411
 
@@ -407,11 +414,14 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
407
414
  GIT_ERROR_CHECK_ARRAY(commit->parent_ids);
408
415
 
409
416
  /* The tree is always the first field */
410
- if (!(flags & GIT_COMMIT_PARSE_QUICK)) {
411
- if (git_oid__parse(&commit->tree_id, &buffer, buffer_end, "tree ") < 0)
417
+ if (!(opts->flags & GIT_COMMIT_PARSE_QUICK)) {
418
+ if (git_object__parse_oid_header(&commit->tree_id,
419
+ &buffer, buffer_end, "tree ",
420
+ opts->oid_type) < 0)
412
421
  goto bad_buffer;
413
422
  } else {
414
- size_t tree_len = strlen("tree ") + GIT_OID_HEXSZ + 1;
423
+ size_t tree_len = strlen("tree ") + git_oid_hexsize(opts->oid_type) + 1;
424
+
415
425
  if (buffer + tree_len > buffer_end)
416
426
  goto bad_buffer;
417
427
  buffer += tree_len;
@@ -421,14 +431,16 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
421
431
  * TODO: commit grafts!
422
432
  */
423
433
 
424
- while (git_oid__parse(&parent_id, &buffer, buffer_end, "parent ") == 0) {
434
+ while (git_object__parse_oid_header(&parent_id,
435
+ &buffer, buffer_end, "parent ",
436
+ opts->oid_type) == 0) {
425
437
  git_oid *new_id = git_array_alloc(commit->parent_ids);
426
438
  GIT_ERROR_CHECK_ALLOC(new_id);
427
439
 
428
440
  git_oid_cpy(new_id, &parent_id);
429
441
  }
430
442
 
431
- if (!(flags & GIT_COMMIT_PARSE_QUICK)) {
443
+ if (!opts || !(opts->flags & GIT_COMMIT_PARSE_QUICK)) {
432
444
  commit->author = git__malloc(sizeof(git_signature));
433
445
  GIT_ERROR_CHECK_ALLOC(commit->author);
434
446
 
@@ -452,7 +464,7 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
452
464
  if ((error = git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n')) < 0)
453
465
  return error;
454
466
 
455
- if (flags & GIT_COMMIT_PARSE_QUICK)
467
+ if (opts && opts->flags & GIT_COMMIT_PARSE_QUICK)
456
468
  return 0;
457
469
 
458
470
  /* Parse add'l header entries */
@@ -497,19 +509,39 @@ bad_buffer:
497
509
  return GIT_EINVALID;
498
510
  }
499
511
 
500
- int git_commit__parse_raw(void *commit, const char *data, size_t size)
512
+ int git_commit__parse(
513
+ void *commit,
514
+ git_odb_object *odb_obj,
515
+ git_oid_t oid_type)
501
516
  {
502
- return commit_parse(commit, data, size, 0);
517
+ git_commit__parse_options parse_options = {0};
518
+ parse_options.oid_type = oid_type;
519
+
520
+ return git_commit__parse_ext(commit, odb_obj, &parse_options);
503
521
  }
504
522
 
505
- int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags)
523
+ int git_commit__parse_raw(
524
+ void *commit,
525
+ const char *data,
526
+ size_t size,
527
+ git_oid_t oid_type)
506
528
  {
507
- return commit_parse(commit, git_odb_object_data(odb_obj), git_odb_object_size(odb_obj), flags);
529
+ git_commit__parse_options parse_options = {0};
530
+ parse_options.oid_type = oid_type;
531
+
532
+ return commit_parse(commit, data, size, &parse_options);
508
533
  }
509
534
 
510
- int git_commit__parse(void *_commit, git_odb_object *odb_obj)
535
+ int git_commit__parse_ext(
536
+ git_commit *commit,
537
+ git_odb_object *odb_obj,
538
+ git_commit__parse_options *parse_opts)
511
539
  {
512
- return git_commit__parse_ext(_commit, odb_obj, 0);
540
+ return commit_parse(
541
+ commit,
542
+ git_odb_object_data(odb_obj),
543
+ git_odb_object_size(odb_obj),
544
+ parse_opts);
513
545
  }
514
546
 
515
547
  #define GIT_COMMIT_GETTER(_rvalue, _name, _return, _invalid) \
@@ -566,7 +598,7 @@ const char *git_commit_summary(git_commit *commit)
566
598
  while (*next && git__isspace_nonlf(*next)) {
567
599
  ++next;
568
600
  }
569
- if (!*next || *next == '\n')
601
+ if (!*next || *next == '\n')
570
602
  break;
571
603
  }
572
604
  /* record the beginning of contiguous whitespace runs */
@@ -979,11 +1011,14 @@ int git_commit_create_with_signature(
979
1011
  git_str commit = GIT_STR_INIT;
980
1012
  git_commit *parsed;
981
1013
  git_array_oid_t parents = GIT_ARRAY_INIT;
1014
+ git_commit__parse_options parse_opts = {0};
1015
+
1016
+ parse_opts.oid_type = repo->oid_type;
982
1017
 
983
1018
  /* The first step is to verify that all the tree and parents exist */
984
1019
  parsed = git__calloc(1, sizeof(git_commit));
985
1020
  GIT_ERROR_CHECK_ALLOC(parsed);
986
- if (commit_parse(parsed, commit_content, strlen(commit_content), 0) < 0) {
1021
+ if (commit_parse(parsed, commit_content, strlen(commit_content), &parse_opts) < 0) {
987
1022
  error = -1;
988
1023
  goto cleanup;
989
1024
  }
@@ -33,6 +33,16 @@ struct git_commit {
33
33
  char *body;
34
34
  };
35
35
 
36
+ typedef struct {
37
+ git_oid_t oid_type;
38
+ unsigned int flags;
39
+ } git_commit__parse_options;
40
+
41
+ typedef enum {
42
+ /** Only parse parents and committer info */
43
+ GIT_COMMIT_PARSE_QUICK = (1 << 0)
44
+ } git_commit__parse_flags;
45
+
36
46
  int git_commit__header_field(
37
47
  git_str *out,
38
48
  const git_commit *commit,
@@ -56,14 +66,22 @@ int git_commit__create_buffer(
56
66
  size_t parent_count,
57
67
  const git_commit *parents[]);
58
68
 
59
- void git_commit__free(void *commit);
60
- int git_commit__parse(void *commit, git_odb_object *obj);
61
- int git_commit__parse_raw(void *commit, const char *data, size_t size);
69
+ int git_commit__parse(
70
+ void *commit,
71
+ git_odb_object *obj,
72
+ git_oid_t oid_type);
62
73
 
63
- typedef enum {
64
- GIT_COMMIT_PARSE_QUICK = (1 << 0) /**< Only parse parents and committer info */
65
- } git_commit__parse_flags;
74
+ int git_commit__parse_raw(
75
+ void *commit,
76
+ const char *data,
77
+ size_t size,
78
+ git_oid_t oid_type);
66
79
 
67
- int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags);
80
+ int git_commit__parse_ext(
81
+ git_commit *commit,
82
+ git_odb_object *odb_obj,
83
+ git_commit__parse_options *parse_opts);
84
+
85
+ void git_commit__free(void *commit);
68
86
 
69
87
  #endif