diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2014-09-16 01:25:53 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-09-16 17:02:28 +0200 |
| commit | 0fef38999abc74b8237971f96295f461631d9d1d (patch) | |
| tree | 6f26d1bd650140f1c4add4bf944263cd8e058d70 /include/git2 | |
| parent | bf8756d6a2c42dc77b8a2de814a12e2ceb4487fd (diff) | |
| parent | 910cd2daa6af0f3af97d283eb4c6a0452688d067 (diff) | |
| download | libgit2-0fef38999abc74b8237971f96295f461631d9d1d.tar.gz | |
Merge remote-tracking branch 'upstream/master' into cmn/host-cert-info
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/merge.h | 16 | ||||
| -rw-r--r-- | include/git2/oidarray.h | 40 | ||||
| -rw-r--r-- | include/git2/remote.h | 13 | ||||
| -rw-r--r-- | include/git2/repository.h | 3 | ||||
| -rw-r--r-- | include/git2/submodule.h | 18 |
5 files changed, 82 insertions, 8 deletions
diff --git a/include/git2/merge.h b/include/git2/merge.h index 9eb14ccb1..bd5ebc1bd 100644 --- a/include/git2/merge.h +++ b/include/git2/merge.h @@ -10,6 +10,7 @@ #include "common.h" #include "types.h" #include "oid.h" +#include "oidarray.h" #include "checkout.h" #include "index.h" @@ -321,6 +322,21 @@ GIT_EXTERN(int) git_merge_base( const git_oid *two); /** + * Find merge bases between two commits + * + * @param out array in which to store the resulting ids + * @param repo the repository where the commits exist + * @param one one of the commits + * @param two the other commit + * @return 0 on success, GIT_ENOTFOUND if not found or error code + */ +GIT_EXTERN(int) git_merge_bases( + git_oidarray *out, + git_repository *repo, + const git_oid *one, + const git_oid *two); + +/** * Find a merge base given a list of commits * * @param out the OID of a merge base considering all the commits diff --git a/include/git2/oidarray.h b/include/git2/oidarray.h new file mode 100644 index 000000000..0b3204597 --- /dev/null +++ b/include/git2/oidarray.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_git_oidarray_h__ +#define INCLUDE_git_oidarray_h__ + +#include "common.h" +#include "oid.h" + +GIT_BEGIN_DECL + +/** Array of object ids */ +typedef struct git_oidarray { + git_oid *ids; + size_t count; +} git_oidarray; + +/** + * Free the OID array + * + * This method must (and must only) be called on `git_oidarray` + * objects where the array is allocated by the library. Not doing so, + * will result in a memory leak. + * + * This does not free the `git_oidarray` itself, since the library will + * never allocate that object directly itself (it is more commonly embedded + * inside another struct or created on the stack). + * + * @param array git_oidarray from which to free oid data + */ +GIT_EXTERN(void) git_oidarray_free(git_oidarray *array); + +/** @} */ +GIT_END_DECL + +#endif + diff --git a/include/git2/remote.h b/include/git2/remote.h index d2cc3e8e7..055f5e517 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -384,15 +384,12 @@ GIT_EXTERN(int) git_remote_fetch( const char *reflog_message); /** - * Return whether a string is a valid remote URL * - * @param url the url to check - * @return 1 if the url is valid, 0 otherwise - */ -GIT_EXTERN(int) git_remote_valid_url(const char *url); - -/** - * Return whether the passed URL is supported by this version of the library. + * Return whether the library supports a particular URL scheme + * + * Both the built-in and externally-registered transport lists are + * searched for a transport which supports the scheme of the given + * URL. * * @param url the url to check * @return 1 if the url is supported, 0 otherwise diff --git a/include/git2/repository.h b/include/git2/repository.h index 18e515cb0..268782648 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -196,6 +196,8 @@ GIT_EXTERN(int) git_repository_init( * looking the "template_path" from the options if set, or the * `init.templatedir` global config if not, or falling back on * "/usr/share/git-core/templates" if it exists. + * * GIT_REPOSITORY_INIT_RELATIVE_GITLINK - If an alternate workdir is + * specified, use relative paths for the gitdir and core.worktree. */ typedef enum { GIT_REPOSITORY_INIT_BARE = (1u << 0), @@ -204,6 +206,7 @@ typedef enum { GIT_REPOSITORY_INIT_MKDIR = (1u << 3), GIT_REPOSITORY_INIT_MKPATH = (1u << 4), GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE = (1u << 5), + GIT_REPOSITORY_INIT_RELATIVE_GITLINK = (1u << 6), } git_repository_init_flag_t; /** diff --git a/include/git2/submodule.h b/include/git2/submodule.h index 864d1c58c..616890df6 100644 --- a/include/git2/submodule.h +++ b/include/git2/submodule.h @@ -471,6 +471,24 @@ GIT_EXTERN(git_submodule_recurse_t) git_submodule_set_fetch_recurse_submodules( GIT_EXTERN(int) git_submodule_init(git_submodule *submodule, int overwrite); /** + * Set up the subrepository for a submodule in preparation for clone. + * + * This function can be called to init and set up a submodule + * repository from a submodule in preparation to clone it from + * its remote. + * + * @param out Output pointer to the created git repository. + * @param sm The submodule to create a new subrepository from. + * @param use_gitlink Should the workdir contain a gitlink to + * the repo in .git/modules vs. repo directly in workdir. + * @return 0 on success, <0 on failure. + */ +GIT_EXTERN(int) git_submodule_repo_init( + git_repository **out, + const git_submodule *sm, + int use_gitlink); + +/** * Copy submodule remote info into submodule repo. * * This copies the information about the submodules URL into the checked out |
