summaryrefslogtreecommitdiff
path: root/submodule.h
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-12-20 23:20:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-27 22:19:35 (GMT)
commit83b7696605dbea3eb4e878cf904159f398345aa9 (patch)
treed1fe20f8be9d48bf1f37289339d4d571d87fdb1a /submodule.h
parent5a1c824f70ec261f8f9e5e039555fc80301dee0b (diff)
downloadgit-83b7696605dbea3eb4e878cf904159f398345aa9.zip
git-83b7696605dbea3eb4e878cf904159f398345aa9.tar.gz
git-83b7696605dbea3eb4e878cf904159f398345aa9.tar.bz2
submodule: rename and add flags to ok_to_remove_submodule
In different contexts the question "Is it ok to delete a submodule?" may be answered differently. In 293ab15eea (submodule: teach rm to remove submodules unless they contain a git directory, 2012-09-26) a case was made that we can safely ignore ignored untracked files for removal as we explicitely ask for the removal of the submodule. In a later patch we want to remove submodules even when the user doesn't explicitly ask for it (e.g. checking out a tree-ish in which the submodule doesn't exist). In that case we want to be more careful when it comes to deletion of untracked files. As of this patch it is unclear how this will be implemented exactly, so we'll offer flags in which the caller can specify how the different untracked files ought to be handled. As the flags allow the function to not die on an error when spawning a child process, we need to find an appropriate return code for the case when the child process could not be started. As in that case we cannot tell if the submodule is ok to remove, we'd want to return 'false'. As only 0 is understood as false, rename the function to invert the meaning, i.e. the return code of 0 signals the removal of the submodule is fine, and other values can be used to return a more precise answer what went wrong. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.h')
-rw-r--r--submodule.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/submodule.h b/submodule.h
index 61fb610..21b1569 100644
--- a/submodule.h
+++ b/submodule.h
@@ -59,7 +59,11 @@ extern int fetch_populated_submodules(const struct argv_array *options,
int quiet, int max_parallel_jobs);
extern unsigned is_submodule_modified(const char *path, int ignore_untracked);
extern int submodule_uses_gitfile(const char *path);
-extern int ok_to_remove_submodule(const char *path);
+
+#define SUBMODULE_REMOVAL_DIE_ON_ERROR (1<<0)
+#define SUBMODULE_REMOVAL_IGNORE_UNTRACKED (1<<1)
+#define SUBMODULE_REMOVAL_IGNORE_IGNORED_UNTRACKED (1<<2)
+extern int bad_to_remove_submodule(const char *path, unsigned flags);
extern int merge_submodule(unsigned char result[20], const char *path,
const unsigned char base[20],
const unsigned char a[20],