Skip to content
Browse files

make helper-functions:

 * add new function git-get-latest-revision - returns the latest revision of the specified branch in the remote git repository


git-svn-id: file:///var/svn/freetz/trunk@10244 149334a1-2f27-0410-a3b9-fc62619ac1e6
  • Loading branch information...
1 parent 2d1ba12 commit add6e6c6a457de67be50547b176e44449b53f0ef er13 committed Mar 9, 2013
Showing with 11 additions and 0 deletions.
  1. +11 −0 include/make/020-helper-functions.mk
View
11 include/make/020-helper-functions.mk
@@ -67,3 +67,14 @@ SUBST_MAP_TOLOWER_NAME := $(SUBST_MAP_TOLOWER) $(SUBST_MAP_NAME)
# Convert letters to uppercase, minus to underline
# $1 = string to convert
TOUPPER_NAME = $(call SUBST_MAP,$1,$(SUBST_MAP_TOUPPER_NAME))
+
+#
+# $1 - git repository
+# $2 - (optional) branch name, if omitted "master" is used
+#
+# returns:
+# latest revision of the specified branch
+#
+define git-get-latest-revision
+$(shell rev=$$(git ls-remote --heads $(strip $(1)) $(if $(strip $(2)),$(strip $(2)),master) | sed -rn -e 's,^([0-9a-f]{10})[0-9a-f]{30}.*,\1,p'); echo "$${rev:-FAILED_TO_DETERMINE_LATEST_REVISION}")
+endef

0 comments on commit add6e6c

Please sign in to comment.
Something went wrong with that request. Please try again.