[maintainer-tools,2/3] dim: add dim cite subcommand

Submitted by Jani Nikula on Sept. 30, 2016, 2:13 p.m.

Details

Message ID 1475244791-20915-2-git-send-email-jani.nikula@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Jani Nikula Sept. 30, 2016, 2:13 p.m.
Add 'dim cite' subcommand to cite the supplied committish in format
'sha1 ("commit subject")'.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim     | 12 ++++++++++--
 dim.rst |  6 +++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/dim b/dim
index 2adbad375167..2b35e0ef69c9 100755
--- a/dim
+++ b/dim
@@ -1169,13 +1169,21 @@  function dim_tc
 	fi
 }
 
+function dim_cite
+{
+	local sha1=$1
+	cd $DIM_PREFIX/$DIM_DRM_INTEL
+
+	git log -1 $sha1 "--pretty=format:%H (\"%s\")%n" | \
+		sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
+}
+
 function dim_fixes
 {
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 	local sha1=$1
 
-	git log -1 $sha1 "--pretty=format:Fixes: %H (\"%s\")%n" | \
-		sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
+	echo "Fixes: $(dim_cite $sha1)"
 
 	local tag=$(git tag --contains $1 | grep ^v | sort -V | head -n 1)
 	if [[ -n "$tag" ]]; then
diff --git a/dim.rst b/dim.rst
index 4a011f44b3ee..0b436f212539 100644
--- a/dim.rst
+++ b/dim.rst
@@ -177,9 +177,13 @@  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.
 
+cite *commit-ish*
+-----------------
+Cite the supplied *commit-ish* in format 'sha1 ("commit subject")'.
+
 fixes *commit-ish*
 ------------------
-Print the Fixes: line for the supplied *commit-ish* in the linux kernel
+Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel
 CodingStyle approved format.
 
 check-patch|cp [*commit-ish* [.. *commit-ish*]]