Gerrit/Commit message guidelines/ja

変更のコミット メッセージは重要な役割を果たします. あなたの変更について、他の人が最初に目にする場所です.

件名
コミット メッセージの最初の行は件名として知られています. 件名は 80 文字未満にする必要があります (50〜70 文字を目指します).


 * 件名の行では変更を要約します. これはリポジトリに永遠に残ることを心に留めておいてください.
 * 件名の行では命令形を使用してください. 命令形は、誰かに指示を与えているように聞こえます. "Change", "Add", "Fix", "Remove", "Update", "Refactor", "Document" などの単語で始めます. いい例は "Add Badge::query for querying the API"、"Allow zeroes in SimpleBadge::add".  悪い例は "Added Badge::query method"、"Fixed Badge::query method"、"Badge can query the API"、"Zeroes work when adding badges".
 * 件名の末尾にピリオド (ドット) を付けないでください.
 * 必要に応じて、関連するコンポーネントを件名の前に付けます. コンポーネントは、コミットが変更する全般的な領域です.

本文
本文を書く際は、以下の質問について考えてください:


 * この変更を行う必要がある理由は? 現在のコードの何が問題点になっていますか?
 * この方法で変更する必要がある理由は? 他の方法はありますか?
 * 他のアプローチを検討しましたか? その場合は、それらのアプローチがそれほどよくなかった理由を説明してください.
 * レビュアーはどのようにして、コードが正しく機能していることをテストまたは検証できますか?

Do:


 * 本文と件名を 1 行の空行で区切ります.
 * メッセージ本文を折り返して、行が 100 文字未満になるようにします. ただし、URL を分割または折り返しをしないでください. URL が長くても保持してください.
 * "Bug" と "Change-Id" のメタデータを以下の例とまったく同じように整形し、本文の最終行の後に空行を入れた後に一緒に配置します.
 * Refer to other (merged) commits by using a (short) Git commit hash. If necessary, refer to not-yet-merged commits by using a Gerrit Change-Id.

Don't:


 * Do not refer to other commits with a Gerrit URL, instead use the Git commit hash. This allows easy navigation of the Git repository when offline. It also allows users of all repository viewers (Gerrit, Gitiles, Phabricator, GitHub, and local Git interfaces) to automatically navigate to other commits within the same interface. A URL can only be resolved when online and using Gerrit, which breaks the ability for people to navigate quickly.
 * Do not use a URL as the only explanation for a change. If the change is justified by discussions elsewhere or external documentation, then briefly summarise the relevant points in the commit message.

いい例
jquery.badge: Add ability to display the number zero

Cupcake ipsum dolor sit. Amet tart cheesecake tiramisu chocolate cake topping. Icing ice cream sweet roll. Biscuit dragée toffee wypas.

Does not yet address T44834 or T176. Follow-up to Id5e7cbb1.

Bug: T42 Change-Id: I88c5f819c42d9fe1468be6b2cf74413d7d6d6907

悪い例
Improved the code by fixing a bug.

Changed the files a.php and b.php

Bug: T42 Change-Id: I88c5f819c42d9fe1468be6b2cf74413d7d6d6907

件名
Most programs we use that display Git commit, render the subject line as plain text. This means URLs do not work, and selecting/copying of text often is not possible. Therefore, do not mention Phabricator tasks, Git commits, or urls inside the subject line. Instead, mention those in the body text, or footer meta-data. That way, they can be universally selected, copied, or clicked.


 * Gerrit uses the subject in: e-mail notifications, IRC notifications, search results.
 * GitHub uses the subject in: commit history, commit subject.
 * The Git CLI uses the subject in:,  ,  ,  , etc.
 * and much more!
 * and much more!

コンポーネント
You may start the subject line with a component, which will indicate what area of the project is changed by your commit.

It should be one of the following:
 * A directory of PHP classes under  or , such as "installer", "jobqueue", "objectcache", "resourceloader", "rdbms", etc.
 * A PHP class name, such as "Title", "User", "OutputPage", etc.; typically for classes without subdirectory in.
 * ResourceLoader module name (like "mediawiki.Title", "mediawiki.util", etc.).
 * Generic keyword affecting multiple areas relating to the type of change, such as:
 * "build" - for changes to files relating to the development workflow, such as updates to,  , etc.
 * "tests", "qunit", or "phpunit" - for changes that only affect unit or integration test suites, or the test suite runners.

Phabricator
To reference a bug or task, in the commit message mention it inline using the Txxx notation (e.g. " That was caused by T169. ")

To express that a commit resolves (even partially) or is specially relevant to a bug, add  in the footer at the end of the commit message. (If you're amending a commit message, insert it immediately above the  line, without an empty line between them.)

Bug: T169

A bot will automatically leave a comment on the Phabricator task about any significant events (being merged, abandoned, etc.). If a patch resolves two or more bugs, put each   reference on its own line at the bottom.

相互参照
Whenever you refer to another commit, use the SHA-1 git hash of the merged commit. If the commit in still pending review, use the Gerrit Change-Id hash instead of the git hash because the hash relates to an individual patch set (which changes when rebased, thus creating a dead-end).

変更 ID
's  tool will automatically append the "Change-Id: Ixxx" keyword to new commits.

依存関係
If you have cross-repo dependencies (your commit depends on another commit in a different repository), declare them by adding  to the last paragraph. ("Ixxx"... is the  of the other commit.) This will instruct Zuul to test the commit together with that one.