[Intel-gfx] [PATCH] dim: Add helper command to generate Fixes: lines

Daniel Vetter daniel.vetter at ffwll.ch
Wed Dec 23 05:50:41 PST 2015

Unfortunately a simple git alias doesn't work since the linux kernel
wants a sha1 shortened to 12 characters, and the git commit
prettifying can't do that with e.g. %12h. sed to the rescue.

I'm using this when editing commit messages after applying (:read !dim
fixes sha1 in vim).

v2: Also update documentation.

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
 bash_completion |  4 ++--
 dim             |  5 +++++
 dim.rst         |  5 +++++
 drm-intel.rst   | 12 ++++++++++--
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/bash_completion b/bash_completion
index 7f129ca818eb..e44e5fc844b4 100644
--- a/bash_completion
+++ b/bash_completion
@@ -29,7 +29,7 @@ _dim ()
 	cmds="$cmds magic-patch mp cd"
 	cmds="$cmds magic-rebase-resolve mrr"
 	cmds="$cmds apply-igt ai"
-	cmds="$cmds apply-resolved ar tc check-patch cp cherry-pick"
+	cmds="$cmds apply-resolved ar tc fixes check-patch cp cherry-pick"
 	cmds="$cmds pull-request pull-request-fixes pull-request-next pull-request-next-fixes"
 	cmds="$cmds update-next"
 	cmds="$cmds create-branch remove-branch create-workdir for-each-workdirs fw"
@@ -73,7 +73,7 @@ _dim ()
 				COMPREPLY=( $( compgen -o nospace -W "-a" -- $cur ) )
-		tc)
+		tc|fixes)
 			# FIXME needs a git sha1
diff --git a/dim b/dim
index 9ecb95053718..c749cebd1187 100755
--- a/dim
+++ b/dim
@@ -839,6 +839,11 @@ case "$subcommand" in
 			    origin/master | sed 's/^ *//'
+	fixes)
+		sha1=$1
+		git log -1 $sha1 "--pretty=format:Fixes: %H (\"%s\")%n" | \
+			sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
+		;;
 		dim_checkrange $@
diff --git a/dim.rst b/dim.rst
index 567bcb8bb13e..e37d6630aecb 100644
--- a/dim.rst
+++ b/dim.rst
@@ -177,6 +177,11 @@ tc *commit-ish*
 Print the oldest Linux kernel release or -rc tag that contains the supplied
 *commit-ish*, or, if none do, print the upstream branches that contain it.
+fixes *commit-ish*
+Print the Fixes: line for the supplied *commit-ish* in the linux kernel
+CodingStyle approved format.
 check-patch|cp [*commit-ish* [.. *commit-ish*]]
 Runs the given commit range commit-ish..commit-ish through the check tools. If
diff --git a/drm-intel.rst b/drm-intel.rst
index 0e774047b1b8..6b3b469e1dc6 100644
--- a/drm-intel.rst
+++ b/drm-intel.rst
@@ -163,8 +163,16 @@ or, if the fix is relevant for a released kernel,
 	Cc: stable at vger.kernel.org
-If the Cc: was forgotten, you can still reply to the list with that, just like
-any other tags, and they should be picked up by whoever pushes the patch.
+If your patch fixes a regression then please include a Fixes: line to help
+maintainers where to cherry-pick a patch to. This also extremely useful for
+product groups to know which bugfixes they must include. To follow the
+recommended format please generate the Fixes: line using
+        $ dim fixes $regressing_commit
+If the Cc: or Fixes: was forgotten, you can still reply to the list with that,
+just like any other tags, and they should be picked up by whoever pushes the
 The maintainers will cherry-pick labeled patches from drm-intel-next-queued to
 the appropriate branches.

More information about the Intel-gfx mailing list