X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=contrib%2Fgit-hooks%2Fcommit-msg;h=b93c79658f07be2008994bf5386f4197552bb6a4;hp=c1fed2ee1f9b4a43bb6ee5a6daf65c9d49cfbfad;hb=4d6bff6be51ff6e336f73b2822ac5100254b9431;hpb=ee01da2222471b03711567820a80345ce6635293 diff --git a/contrib/git-hooks/commit-msg b/contrib/git-hooks/commit-msg index c1fed2e..b93c796 100755 --- a/contrib/git-hooks/commit-msg +++ b/contrib/git-hooks/commit-msg @@ -19,6 +19,7 @@ init() { readonly SAVE="$(basename $ORIGINAL).$(date +%Y%m%d.%H%M%S)" readonly SIGNOFF="Signed-off-by:" readonly CHANGEID="Change-Id:" + readonly FIXES="Fixes:" readonly TESTPARAMS="Test-Parameters:" readonly INNOCUOUS=$(echo \ Acked-by \ @@ -99,6 +100,21 @@ function do_changeid() { HAS_CHANGEID=true } +function do_testparams() { + ck_wrapup + + grep -q mdsfilesystemtype <<< $LINE && + error "mdsfilesystemtype is deprecated, use mdtfilesystemtype" +} + +function do_fixes() { + ck_wrapup + + local commit=$(awk '{ print $2 }' <<<$LINE) + git describe --tags $commit 2>&1 | grep "[Nn]ot a valid" && + error "has invalid $FIXES commit hash" +} + # All "innocuous" lines specify a person and email address # function do_innocuous() { @@ -168,39 +184,40 @@ usage() { exec 1>&2 cat <<- EOF - See http://wiki.whamcloud.com/display/PUB/Commit+Comments + See https://wiki.whamcloud.com/display/PUB/Commit+Comments for full details. An example valid commit comment is: LU-nnn component: short description of change under 64 columns The "component:" should be a lower-case single-word subsystem of the - Lustre code that best encompasses the change being made. Examples of - components include modules like: llite, lov, lmv, osc, mdc, ldlm, lnet, - ptlrpc, mds, oss, osd, ldiskfs, libcfs, socklnd, o2iblnd; functional - subsystems like: recovery, quota, grant; and auxilliary areas like: - build, tests, docs. This list is not exhaustive, but is a guideline. - - The commit comment should contain a detailed explanation of the change - being made. This can be as long as you'd like. Please give details - of what problem was solved (including error messages or problems that - were seen), a good high-level description of how it was solved, and - which parts of the code were changed (including important functions - that were changed, if this is useful to understand the patch, and - for easier searching). Wrap lines at/under $WIDTH_REG columns. - - Finish the comment with a blank line and a blank-line-free - sign off section: + Lustre code best covering the patch. Example components include: + llite, lov, lmv, osc, mdc, ldlm, lnet, ptlrpc, mds, oss, osd, + ldiskfs, libcfs, socklnd, o2iblnd; recovery, quota, grant; + build, tests, docs. This list is not exhaustive, but a guideline. + + The comment body should explan the change being made. This can be + as long as needed. Please include details of the problem that was + solved (including error messages that were seen), a good high-level + description of how it was solved, and which parts of the code were + changed (including important functions that were changed, if this is + useful to understand the patch, and for easier searching). + Performance patches should quanify the improvements being seen. + Wrap lines at/under $WIDTH_REG columns. + + Finish the comment with a blank line followed by the signoff section: $SIGNOFF Your Real Name $CHANGEID Ixxxx(added automatically if missing)xxxx - The "$CHANGEID" line should only be there when updating a previous - commit/submission. Copy the one from the original commit. + The "$CHANGEID" line should only be present when updating a previous + commit/submission. Copy the $CHANGEID from the original commit. It + will automatically be added by the Git commit-msg hook if missing. - The "sign off section" may also include several other tag lines: + The "signoff section" may optionally include other tag lines: $(for T in $(tr '|' ' ' <<< "$INNOCUOUS"); do \ echo " $T: Some Person "; \ done) + $FIXES git_commit_hash ("optional summary of original broken patch") $TESTPARAMS optional additional test parameters {Organization}-bug-id: associated external change identifier EOF @@ -215,9 +232,10 @@ exec 3< "$ORIGINAL" 4> "$REVISED" || exit 1 while IFS= read -u3 LINE; do ((NUM += 1)) case "$LINE" in - $SIGNOFF* ) do_signoff ;; - $CHANGEID* ) do_changeid ;; - $TESTPARAMS* ) ck_wrapup ;; + $SIGNOFF* ) do_signoff ;; + $CHANGEID* ) do_changeid ;; + $FIXES* ) do_fixes ;; + $TESTPARAMS* ) do_testparams ;; "") HAS_LAST_BLANK=true