aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-03-06 15:08:29 +0100
committerAndreas Fischer <bantu@phpbb.com>2011-03-06 15:08:29 +0100
commit239cb56af09424825f6a83dea42dc3cb10d9a470 (patch)
treec51e2073c99d5085e14a92be4fddd3f755b1fc23
parente8def259ef26477e1f7ae2b338eac34142572458 (diff)
parent7027489c8ebbd1f3a77a6357db8dc6e862cd978d (diff)
downloadforums-239cb56af09424825f6a83dea42dc3cb10d9a470.tar
forums-239cb56af09424825f6a83dea42dc3cb10d9a470.tar.gz
forums-239cb56af09424825f6a83dea42dc3cb10d9a470.tar.bz2
forums-239cb56af09424825f6a83dea42dc3cb10d9a470.tar.xz
forums-239cb56af09424825f6a83dea42dc3cb10d9a470.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/9824] Accept commit messages with less than perfect headings. [ticket/9824] Allow empty lines after ticket reference. [ticket/9824] Use printf instead of echo to render \n. [ticket/9824] Handle empty commit messages in commit-msg hook. [ticket/10059] Fix two misspellings of consistent. [ticket/9824] Add space after [ticket/12345] in prepared commit message. [ticket/9824] Remove space after PHPBB3-12345 in prepared commit message.
-rwxr-xr-xgit-tools/hooks/commit-msg34
-rwxr-xr-xgit-tools/hooks/prepare-commit-msg4
-rw-r--r--phpBB/docs/coding-guidelines.html2
-rw-r--r--phpBB/install/install_install.php2
4 files changed, 36 insertions, 6 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg
index a6777ff9c9..ad4d69a9da 100755
--- a/git-tools/hooks/commit-msg
+++ b/git-tools/hooks/commit-msg
@@ -55,6 +55,17 @@ quit()
fi
}
+# Check for empty commit message
+if ! grep -qv '^#' "$1"
+then
+ # Commit message is empty (or contains only comments).
+ # Let git handle this.
+ # It will abort with a message like so:
+ #
+ # Aborting commit due to empty commit message.
+ exit 0
+fi
+
msg=$(grep -nE '.{81,}' "$1");
if [ $? -eq 0 ]
@@ -107,7 +118,19 @@ do
case $expect in
"header")
err=$ERR_HEADER;
- echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$"
+ echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] .+$"
+ result=$?
+ if ! echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$"
+ then
+ # Don't be too strict.
+ # Commits may be temporary, intended to be squashed later.
+ # Just issue a warning here.
+ echo "Warning: heading should be a sentence beginning with a capital letter." 1>&2
+ echo "You entered:" 1>&2
+ echo "$line" 1>&2
+ fi
+ # restore exit code
+ (exit $result)
;;
"empty")
err=$ERR_EMPTY;
@@ -128,6 +151,10 @@ do
# Should not end up here
false
;;
+ "possibly-eof")
+ # Allow empty and/or comment lines at the end
+ ! tail -n +"$i" "$1" |grep -qvE '^($|#)'
+ ;;
"comment")
echo "$line" | grep -Eq "^#";
;;
@@ -188,7 +215,7 @@ do
in_description=1;
;;
"footer")
- expecting="footer eof";
+ expecting="footer possibly-eof";
if [ "$tickets" = "" ]
then
tickets="$line";
@@ -199,6 +226,9 @@ do
"comment")
# Comments should expect the same thing again
;;
+ "possibly-eof")
+ expecting="eof";
+ ;;
*)
echo "Unrecognised token $expect" >&2;
quit 254;
diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg
index 2bf25e58a4..11d2b6b2f2 100755
--- a/git-tools/hooks/prepare-commit-msg
+++ b/git-tools/hooks/prepare-commit-msg
@@ -35,8 +35,8 @@ then
# Branch is prefixed with 'ticket/', append ticket ID to message
if [ "$branch" != "${branch##ticket/}" ];
then
- tail="\n\nPHPBB3-${branch##ticket/}";
+ tail="$(printf "\n\nPHPBB3-${branch##ticket/}")";
fi
- echo "[$branch]$tail $(cat "$1")" > "$1"
+ echo "[$branch] $tail$(cat "$1")" > "$1"
fi
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index 83985fe9d7..ef4d6b13a1 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -1097,7 +1097,7 @@ append_sid(&quot;{$phpbb_root_path}memberlist.$phpEx&quot;, 'mode=group&amp;amp;
<h4>General function usage: </h4>
- <p>Some of these functions are only chosen over others because of personal preference and having no other benefit than to be consistant over the code.</p>
+ <p>Some of these functions are only chosen over others because of personal preference and having no other benefit than to be consistent over the code.</p>
<ul>
<li>
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 01ed223c27..e18ed43778 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1867,7 +1867,7 @@ class install_install extends module
if (!$user_id)
{
- // If we can't insert this user then continue to the next one to avoid inconsistant data
+ // If we can't insert this user then continue to the next one to avoid inconsistent data
$this->p_master->db_error('Unable to insert bot into users table', $db->sql_error_sql, __LINE__, __FILE__, true);
continue;
}