From 91b834807b98b620050fe534b6de93e223dbcbcf Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Wed, 2 Aug 2017 12:49:20 -0700 Subject: submodule: check for unstaged .gitmodules outside of config parsing Teach 'is_staging_gitmodules_ok()' to be able to determine in the '.gitmodules' file has unstaged changes based on the passed in index instead of relying on a global variable which is set during the submodule-config parsing. Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- builtin/rm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/rm.c') diff --git a/builtin/rm.c b/builtin/rm.c index 52826d1379..4057e73fa0 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -286,7 +286,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) list.entry[list.nr].name = xstrdup(ce->name); list.entry[list.nr].is_submodule = S_ISGITLINK(ce->ce_mode); if (list.entry[list.nr++].is_submodule && - !is_staging_gitmodules_ok()) + !is_staging_gitmodules_ok(&the_index)) die (_("Please stage your changes to .gitmodules or stash them to proceed")); } -- cgit v1.2.3