Internal use of dim_cite doesn't need the "commit" word,
but dim cite is marked as a developer command and developers
using this command probably want to cite the commit to copy
and paste the exact style that kernel request when mentioning
another commit.

And if lazy guys like me end up forgetting to add the word
commit the CI will complain:

-:9: ERROR:GIT_COMMIT_ID: Please use git commit description style
'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 7fe78985cd08
("drm/i915/csr: restructure CSR firmware definition macros")'
v3: Rebase by Rodrigo after 7fe78985cd08 ("drm/i915/csr: restructure CSR

Reference: https://patchwork.freedesktop.org/series/49678/
Cc: Jani Nikula <jani.nik...@intel.com>
Cc: Paulo Zanoni <paulo.r.zan...@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.v...@intel.com>
---
 dim | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/dim b/dim
index 72c86db560a7..07dd8efac850 100755
--- a/dim
+++ b/dim
@@ -1216,6 +1216,14 @@ function git_list_fixes
            "$@"
 }
 
+function commit_cite
+{
+       cd $DIM_PREFIX/$DIM_REPO
+
+       git log -1 $1 "--pretty=format:%H (\"%s\")%n" | \
+               sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
+}
+
 function cherry_pick_branch
 {
        local branch log fail_log intel_remote needed have_fixes
@@ -1228,7 +1236,7 @@ function cherry_pick_branch
 
        # Look for commits in dinq tagged as fixes.
        for commit in $(git_list_fixes 
$intel_remote/$branch..$intel_remote/drm-intel-next-queued -- 
drivers/gpu/drm/i915); do
-               echo -n "Considering $(dim_cite $commit)... "
+               echo -n "Considering $(commit_cite $commit)... "
 
                # Look at history for already cherry-picked fixes.
                # Note: use *local* branches to account for unpushed commits.
@@ -1255,7 +1263,7 @@ function cherry_pick_branch
 
                        # FIXME: see if the commit to be fixed has been
                        # backported!
-                       echo -n "Fixes: $(dim_cite $fixes). "
+                       echo -n "Fixes: $(commit_cite $fixes). "
                        if [[ "$(git merge-base $branch $fixes)" = "$fixes" ]]; 
then
                                needed=1
                        fi
@@ -1270,8 +1278,8 @@ function cherry_pick_branch
                echo "Try to cherry-pick."
                commit_list_references $commit
                if ! git cherry-pick -x -s $commit; then
-                       echo "FAILED: $(dim_cite $commit)"
-                       (dim_cite $commit) >> $fail_log
+                       echo "FAILED: $(commit_cite $commit)"
+                       (commit_cite $commit) >> $fail_log
                        git cherry-pick --abort
                fi
        done
@@ -2253,10 +2261,7 @@ function dim_cite
 
        sha1=${1:?$usage}
 
-       cd $DIM_PREFIX/$DIM_REPO
-
-       git log -1 $sha1 "--pretty=format:%H (\"%s\")%n" | \
-               sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
+       echo "commit $(commit_cite $sha1)"
 }
 
 function dim_fixes
@@ -2266,7 +2271,7 @@ function dim_fixes
        sha1=${1:?$usage}
 
        cd $DIM_PREFIX/$DIM_REPO
-       echo "Fixes: $(dim_cite $sha1)"
+       echo "Fixes: $(commit_cite $sha1)"
 
        (
                git show --no-patch $sha1 | \
-- 
2.17.1

_______________________________________________
dim-tools mailing list
dim-tools@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dim-tools

Reply via email to