[dim PATCH 4/7] dim: abstract helper for listing unmerged tags

Jani Nikula jani.nikula at intel.com
Wed Dec 5 15:02:56 UTC 2018


Make the pull request code a bit easier to grasp. Use git log pretty
format for easier extraction of the tags.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 dim | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dim b/dim
index b227f0db99dc..e0f96f78c858 100755
--- a/dim
+++ b/dim
@@ -345,6 +345,22 @@ function git_branch_exists # branch
 	fi
 }
 
+# $1: branch
+# $2: upstream
+function git_unmerged_tags
+{
+	local branch upstream
+
+	branch=$1
+	upstream=$2
+
+	# assume branch based tag names
+	git log --decorate --pretty=%D "$branch@{upstream}" ^$upstream |\
+		grep -o "tag: $branch-[0-9-]\+" |\
+		sed -e "s/^tag: //" |\
+		tr "[:space:]" " "
+}
+
 function git_committer_email
 {
 	if ! committer_email=$(git config --get user.email) ; then
@@ -1930,7 +1946,7 @@ function dim_pull_request
 
 	if [ "$branch" = "drm-intel-next" ]; then
 		# drm-intel-next pulls have been tagged using dim update-next
-		drm_intel_next_tags=$(git log "$branch@{upstream}" ^$upstream --decorate | grep "(.*tag: drm-intel-next-" | sed -e "s/^.*(.*tag: \(drm-intel-next-[^ ,]*\).*)$/\1/")
+		drm_intel_next_tags=$(git_unmerged_tags "$branch" "$upstream")
 		prep_pull_mail $req_file $drm_intel_next_tags
 		tag=$(git describe --all --exact "$branch@{upstream}")
 
-- 
2.11.0



More information about the dim-tools mailing list