mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
sha256: simplify API changes for sha256 support
There are several places where users may want to specify the type of object IDs (sha1 or sha256) that should be used, for example, when dealing with repositories, indexes, etc. However, given that sha256 support remains disappointingly uncommon in the wild, we should avoid hard API breaks when possible. Instead, update these APIs to have an "extended" format (eg, `git_odb_open_ext`) that provides an options structure with oid type information. This allows callers who do care about sha256 to use it, and callers who do not to avoid gratuitous API breakage.
This commit is contained in:
@@ -20,8 +20,6 @@
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
#ifdef GIT_EXPERIMENTAL_SHA256
|
||||
|
||||
/**
|
||||
* The options for creating an repository from scratch.
|
||||
*
|
||||
@@ -64,16 +62,6 @@ GIT_EXTERN(int) git_repository_new_options_init(
|
||||
git_repository_new_options *opts,
|
||||
unsigned int version);
|
||||
|
||||
/**
|
||||
* Create a new repository with no backends.
|
||||
*
|
||||
* @param[out] out The blank repository
|
||||
* @param opts the options for repository creation, or NULL for defaults
|
||||
* @return 0 on success, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_new(git_repository **out, git_repository_new_options *opts);
|
||||
#else
|
||||
|
||||
/**
|
||||
* Create a new repository with neither backends nor config object
|
||||
*
|
||||
@@ -84,11 +72,27 @@ GIT_EXTERN(int) git_repository_new(git_repository **out, git_repository_new_opti
|
||||
* can fail to function properly: locations under $GIT_DIR, $GIT_COMMON_DIR,
|
||||
* or $GIT_INFO_DIR are impacted.
|
||||
*
|
||||
* @note This API only creates SHA1 repositories
|
||||
* @see git_repository_new_ext
|
||||
*
|
||||
* @param[out] out The blank repository
|
||||
* @return 0 on success, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_new(git_repository **out);
|
||||
|
||||
#ifdef GIT_EXPERIMENTAL_SHA256
|
||||
|
||||
/**
|
||||
* Create a new repository with no backends.
|
||||
*
|
||||
* @param[out] out The blank repository
|
||||
* @param opts the options for repository creation, or NULL for defaults
|
||||
* @return 0 on success, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_new_ext(
|
||||
git_repository **out,
|
||||
git_repository_new_options *opts);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user