mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 20:42:23 +00:00
Add faster git_submodule__is_submodule check
This commit is contained in:
parent
fad0412027
commit
945c92a5cf
@ -135,6 +135,21 @@ static int submodule_lookup(
|
|||||||
* PUBLIC APIS
|
* PUBLIC APIS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool git_submodule__is_submodule(git_repository *repo, const char *name)
|
||||||
|
{
|
||||||
|
git_strmap *map;
|
||||||
|
|
||||||
|
if (load_submodule_config(repo, false) < 0) {
|
||||||
|
giterr_clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(map = repo->submodules))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return git_strmap_valid_index(map, git_strmap_lookup_index(map, name));
|
||||||
|
}
|
||||||
|
|
||||||
int git_submodule_lookup(
|
int git_submodule_lookup(
|
||||||
git_submodule **out, /* NULL if user only wants to test existence */
|
git_submodule **out, /* NULL if user only wants to test existence */
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
|
@ -119,6 +119,9 @@ enum {
|
|||||||
#define GIT_SUBMODULE_STATUS__CLEAR_INTERNAL(S) \
|
#define GIT_SUBMODULE_STATUS__CLEAR_INTERNAL(S) \
|
||||||
((S) & ~(0xFFFFFFFFu << 20))
|
((S) & ~(0xFFFFFFFFu << 20))
|
||||||
|
|
||||||
|
/* Internal submodule check does not attempt to refresh cached data */
|
||||||
|
bool git_submodule__is_submodule(git_repository *repo, const char *name);
|
||||||
|
|
||||||
/* Internal status fn returns status and optionally the various OIDs */
|
/* Internal status fn returns status and optionally the various OIDs */
|
||||||
extern int git_submodule__status(
|
extern int git_submodule__status(
|
||||||
unsigned int *out_status,
|
unsigned int *out_status,
|
||||||
|
Loading…
Reference in New Issue
Block a user