diff options
author | Andrew Cady <d@cryptonomic.net> | 2020-10-30 10:31:32 -0400 |
---|---|---|
committer | Andrew Cady <d@cryptonomic.net> | 2020-10-30 10:31:32 -0400 |
commit | 3287df49902a7a99bf050cb95344096012896ff4 (patch) | |
tree | df7c0882a6e15458453b26d4f69d96595473a1c9 | |
parent | 1ec4aafb2d627a158e2490349d00b4a4fbc463c0 (diff) |
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.)
-rw-r--r-- | Makefile | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -125,7 +125,7 @@ include user.mk | |||
125 | 125 | ||
126 | .PHONY: submodules build-submodules $(SUBMODULES) | 126 | .PHONY: submodules build-submodules $(SUBMODULES) |
127 | $(SUBMODULES): stack | 127 | $(SUBMODULES): stack |
128 | @a=$$(cd $@ && git status -uno -s) && (if test -z "$$a"; then set -x; git submodule update --init --recursive $@/; fi) | 128 | @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) |
129 | $(MAKE) -C $@ $(cmd) | 129 | $(MAKE) -C $@ $(cmd) |
130 | 130 | ||
131 | submodules: build-submodules | 131 | submodules: build-submodules |