[PATCH] dim: Create git_push helper

Daniel Vetter daniel.vetter at ffwll.ch
Wed Aug 7 14:18:42 UTC 2019


Just a bit of ocd ... One functional change is the switch from $DRY to
the $DRY_RUN flag in dim_pull_request. That one didn't have a
justification, and the one for the other place in dim_create_branch
didn't seem to apply really.

v2: don't substitute too much (Arek)

Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/dim b/dim
index f1b43552cb59..7ecbaacfbf87 100755
--- a/dim
+++ b/dim
@@ -385,6 +385,11 @@ function git_committer_email
 	echo $committer_email
 }
 
+function git_push
+{
+	git push $dim_fdo_cookie $DRY_RUN "$@"
+}
+
 function check_for_updates
 {
 	local stamp stampfile
@@ -531,14 +536,14 @@ function update_linux_next # branch next next-fixes fixes
 
 	# always update drm-intel-fixes
 	echo -n "Pushing $linux_fixes to for-linux-next-fixes... "
-	git push $dim_fdo_cookie $DRY_RUN $remote +$remote/$linux_fixes:for-linux-next-fixes # >& /dev/null
+	git_push $remote +$remote/$linux_fixes:for-linux-next-fixes # >& /dev/null
 	echo "Done."
 
 	if git merge-base --is-ancestor $remote/$linux_next_fixes $remote/$linux_fixes ; then
 		# -fixes has caught up to dinf, i.e. we're out of the merge
 		# window. Push the next queue.
 		echo -n "Out of merge window. Pushing $linux_next to for-linux-next... "
-		git push $dim_fdo_cookie $DRY_RUN $remote +$remote/$linux_next:for-linux-next >& /dev/null
+		git_push $remote +$remote/$linux_next:for-linux-next >& /dev/null
 		echo "Done."
 	else
 		# dinf is ahead of -fixes, i.e. drm-next has already closed for
@@ -546,7 +551,7 @@ function update_linux_next # branch next next-fixes fixes
 		# for the current -next cycle. Push dinf
 
 		echo -n "Pushing $linux_next_fixes to for-linux-next... "
-		git push $dim_fdo_cookie $DRY_RUN $remote +$remote/$linux_next_fixes:for-linux-next >& /dev/null
+		git_push $remote +$remote/$linux_next_fixes:for-linux-next >& /dev/null
 		echo "Done."
 	fi
 }
@@ -657,7 +662,7 @@ function commit_rerere_cache
 	rm $commit_message
 
 	echo -n "Pushing rerere cache... "
-	git push $dim_fdo_cookie $DRY_RUN $remote HEAD >& /dev/null && echo "Done."
+	git_push $remote HEAD >& /dev/null && echo "Done."
 }
 
 function fetch_all
@@ -792,7 +797,7 @@ function dim_rebuild_tip
 	remote=$(repo_to_remote drm-tip)
 
 	echo -n "Pushing $integration_branch... "
-	git push $dim_fdo_cookie $DRY_RUN $remote +HEAD >& /dev/null && echo "Done."
+	git_push $remote +HEAD >& /dev/null && echo "Done."
 
 	commit_rerere_cache
 }
@@ -981,7 +986,7 @@ function dim_push_branch
 		fi
 	fi
 
-	git push $dim_fdo_cookie $DRY_RUN $remote $branch "$@"
+	git_push $remote $branch "$@"
 
 	update_linux_next $branch drm-intel-next-queued drm-intel-next-fixes drm-intel-fixes
 	update_linux_next $branch drm-misc-next drm-misc-next-fixes drm-misc-fixes
@@ -1507,7 +1512,7 @@ function dim_create_branch
 
 	# git push gives confusing error messages for non-existing branches,
 	# even with --dry-run, hence the even quieter $DRY
-	$DRY git push $dim_fdo_cookie $remote +$branch --set-upstream
+	$DRY git_push $remote +$branch --set-upstream
 
 	cd $DIM_PREFIX/drm-rerere
 	$DRY sed -i "s/^\() # DO NOT CHANGE THIS LINE\)$/\t\"$repo\t\t${branch//\//\\\/}\"\n\1/" $dim_integration_config
@@ -1544,7 +1549,7 @@ function dim_remove_branch
 
 	remote=$(repo_to_remote $repo)
 
-	git push $dim_fdo_cookie $DRY_RUN $remote --delete $branch
+	git_push $remote --delete $branch
 	$DRY git fetch $remote --prune
 	cd $DIM_PREFIX/drm-rerere
 	$DRY sed -i "/^[[:space:]]*\"${repo}[[:space:]]\+${branch//\//\\\/}.*$/d" $dim_integration_config
@@ -1999,11 +2004,11 @@ function dim_update_next_continue
 
 	remote=$(repo_to_remote drm-intel)
 
-	git push $dim_fdo_cookie $DRY_RUN -f $remote drm-intel-next-queued:drm-intel-next
+	git_push -f $remote drm-intel-next-queued:drm-intel-next
 	tag=$(tag_name "drm-intel-next")
 
 	tag_branch $tag drm-intel-next
-	git push $dim_fdo_cookie $DRY_RUN $remote $tag
+	git_push $remote $tag
 }
 
 function dim_tag_branch
@@ -2038,7 +2043,7 @@ function dim_tag_branch
 
 	tag=$(tag_name "$branch")
 	tag_branch $tag $branch
-	git push $dim_fdo_cookie $DRY_RUN $remote $tag
+	git_push $remote $tag
 }
 
 function dim_tag_next
@@ -2076,7 +2081,7 @@ function dim_pull_request
 		tag=$(tag_name "$branch")
 		gitk --first-parent "$branch" ^$upstream &
 		tag_branch $tag $branch
-		$DRY git push $dim_fdo_cookie $remote $tag
+		git_push $remote $tag
 		prep_pull_mail $req_file $tag
 
 		repo=$(branch_to_repo $branch)
-- 
2.22.0



More information about the dim-tools mailing list