summaryrefslogtreecommitdiff
path: root/src/submodule.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-05-04 17:29:12 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-22 17:02:55 +0200
commitc6f489c964bc4df29bdacb1ee4afdcdb294f3815 (patch)
tree2311b70fa744c2552208d4d05ff76176d0827a17 /src/submodule.c
parent64bbd47a32e6aaed539bafd109eef624f24fbae7 (diff)
downloadlibgit2-c6f489c964bc4df29bdacb1ee4afdcdb294f3815.tar.gz
submodule: add an ignore option to status
This lets us specify in the status call which ignore rules we want to use (optionally falling back to whatever the submodule has in its configuration). This removes one of the reasons for having `_set_ignore()` set the value in-memory. We re-use the `IGNORE_RESET` value for this as it is no longer relevant but has a similar purpose to `IGNORE_FALLBACK`. Similarly, we remove `IGNORE_DEFAULT` which does not have use outside of initializers and move that to fall back to the configuration as well.
Diffstat (limited to 'src/submodule.c')
-rw-r--r--src/submodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/submodule.c b/src/submodule.c
index 2faaa734d..c6effdef8 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1067,7 +1067,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
memcpy(&clone_options.fetch_opts, &update_options.fetch_opts, sizeof(git_fetch_options));
/* Get the status of the submodule to determine if it is already initialized */
- if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name)) < 0)
+ if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name, GIT_SUBMODULE_IGNORE_FALLBACK)) < 0)
goto done;
/*
@@ -1462,7 +1462,7 @@ int git_submodule__status(
unsigned int status;
git_repository *smrepo = NULL;
- if (ign < GIT_SUBMODULE_IGNORE_NONE)
+ if (ign == GIT_SUBMODULE_IGNORE_FALLBACK)
ign = sm->ignore;
/* only return location info if ignore == all */
@@ -1511,7 +1511,7 @@ int git_submodule__status(
return 0;
}
-int git_submodule_status(unsigned int *status, git_repository *repo, const char *name)
+int git_submodule_status(unsigned int *status, git_repository *repo, const char *name, git_submodule_ignore_t ignore)
{
git_submodule *sm;
int error;
@@ -1521,7 +1521,7 @@ int git_submodule_status(unsigned int *status, git_repository *repo, const char
if ((error = git_submodule_lookup(&sm, repo, name)) < 0)
return error;
- error = git_submodule__status(status, NULL, NULL, NULL, sm, 0);
+ error = git_submodule__status(status, NULL, NULL, NULL, sm, ignore);
git_submodule_free(sm);
return error;