myos/make/monorepo/git.mk

17 lines
818 B
Makefile
Raw Normal View History

2021-02-09 17:05:00 +01:00
##
# GIT
2021-05-31 03:45:39 +02:00
## Check if monorepo is up to date with subrepo. subrepo-push saves the parent commit in file subrepo/.gitrepo
2021-02-09 17:05:00 +01:00
.PHONY: git-diff-subrepo
2021-05-17 03:40:02 +02:00
git-diff-subrepo: myos-base subrepo-check
2021-02-09 17:05:00 +01:00
## Get parent commit in .gitrepo : awk '$1 == "parent" {print $3}' subrepo/.gitrepo
## Get child of parent commit : git rev-list --ancestry-path parent..HEAD |tail -n 1
## Compare child commit with our tree : git diff --quiet child -- subrepo
$(eval DRYRUN_IGNORE := true)
$(eval DIFF = $(shell $(call exec,git diff --quiet $(shell $(call exec,git rev-list --ancestry-path $(shell awk '$$1 == "parent" {print $$3}' $(SUBREPO)/.gitrepo)..HEAD |tail -n 1)) -- $(SUBREPO); echo $$?)) )
$(eval DRYRUN_IGNORE := false)
.PHONY: git-fetch-subrepo
2021-05-17 03:40:02 +02:00
git-fetch-subrepo: myos-base subrepo-check
2021-02-09 17:05:00 +01:00
$(call exec,git fetch --prune $(REMOTE))