From 3287df49902a7a99bf050cb95344096012896ff4 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Fri, 30 Oct 2020 10:31:32 -0400 Subject: automatically call "git reset" on submodules if there are NO FILES in the submodule dir, but the git submodule is initialized, then DO NOT treat the submodule as locally modified. Instead, try to remedy the situation. ('git reset' already will avoid destroying data, but it likewise does not treat the absence of a file as data to be preserved.) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 65fdd9a..c327b76 100644 --- a/Makefile +++ b/Makefile @@ -125,7 +125,7 @@ include user.mk .PHONY: submodules build-submodules $(SUBMODULES) $(SUBMODULES): stack - @a=$$(cd $@ && git status -uno -s) && (if test -z "$$a"; then set -x; git submodule update --init --recursive $@/; fi) + @a=$$(cd $@ && (exec 3>&1; exec >&2; if test -z "$$(git ls-files)"; then git reset; fi; git status -uno -s >&3)) && (if test -z "$$a"; then set -x; git submodule update --init --recursive $@/; fi) $(MAKE) -C $@ $(cmd) submodules: build-submodules -- cgit v1.2.3