{"action":"created","comment":{"url":"https://api.github.com/repos/progit/progit2-ja/pulls/comments/38815532","id":38815532,"diff_hunk":"@@ -1,126 +1,269 @@\n [[_git_hooks]]\n+//////////////////////////\n === Git Hooks\n+//////////////////////////\n+=== Git フック\n \n (((hooks)))\n+//////////////////////////\n Like many other Version Control Systems, Git has a way to fire off custom scripts when certain important actions occur.\n There are two groups of these hooks: client-side and server-side.\n Client-side hooks are triggered by operations such as committing and merging, while server-side hooks run on network operations such as receiving pushed commits.\n You can use these hooks for all sorts of reasons.\n+//////////////////////////\n+他のバージョンコントロールシステムと同じように、Gitにも特定のアクションが発生した時にカスタムスクリプトを叩く方法があります。\n+このようなフックは、クライアントサイドとサーバーサイドの二つのグループに分けられます。\n+クライアントサイドフックはコミットやマージといったクライアントでの操作の際に、サーバーサイドフックはプッシュされたコミットの受け取りといったネットワーク操作の際に、それぞれ実行されます。\n+これらのフックは、さまざまなな目的に用いることができます。\n \n+//////////////////////////\n ==== Installing a Hook\n+//////////////////////////\n+==== フックをインストールする\n \n+//////////////////////////\n The hooks are all stored in the `hooks` subdirectory of the Git directory.\n In most projects, that's `.git/hooks`.\n When you initialize a new repository with `git init`, Git populates the hooks directory with a bunch of example scripts, many of which are useful by themselves; but they also document the input values of each script.\n All the examples are written as shell scripts, with some Perl thrown in, but any properly named executable scripts will work fine – you can write them in Ruby or Python or what have you.\n If you want to use the bundled hook scripts, you'll have to rename them; their file names all end with `.sample`.\n+//////////////////////////\n+フックは、Gitディレクトリの `hooks` サブディレクトリ（一般的なプロジェクトでは、`.git/hooks` ）に格納されています。\n+`git init` で新しいリポジトリを初期化する時には、Gitに同梱されているスクリプトのサンプルがこの hooks ディレクトリに格納されます。サンプルの多くはそのままでも十分有用ですし、また、各スクリプトの入力値に関するドキュメントもついています。\n+サンプルは全てシェルスクリプトで書かれており、その中の一部では Perl も使われています。ですが、どんなスクリプトでも、実行可能かつ適切に命名されてさえいれば、問題なく動きます。Ruby や Python 等で書くこともできます。\n+これら同梱のフックスクリプトを使用する場合は、ファイル名の末尾が `.sample` となっていますので適宜リネームしてください。\n \n+//////////////////////////\n To enable a hook script, put a file in the `hooks` subdirectory of your Git directory that is named appropriately and is executable.\n From that point forward, it should be called.\n We'll cover most of the major hook filenames here.\n+//////////////////////////\n+フックスクリプトを有効にするには、Gitディレクトリの `hooks` サブディレクトリに、実行可能なファイルを、適切な名前で配置すれば、以降そのファイルが呼び出されます。\n+ここでは重要なフックファイル名をいくつか取り上げます。\n \n+//////////////////////////\n ==== Client-Side Hooks\n+//////////////////////////\n+==== クライアントサイドフック\n \n+//////////////////////////\n There are a lot of client-side hooks.\n This section splits them into committing-workflow hooks, e-mail-workflow scripts, and everything else.\n+//////////////////////////\n+クライアントサイドフックにはたくさんの種類があります。\n+ここではコミットワークフローフック、Eメールワークフロースクリプト、その他クライアントサイドフックに分類します。\n \n [NOTE]\n ====\n+//////////////////////////\n It's important to note that client-side hooks are *not* copied when you clone a repository.\n If your intent with these scripts is to enforce a policy, you'll probably want to do that on the server side; see the example in <<_an_example_git_enforced_policy>>.\n+//////////////////////////\n+特筆すべき点として、クライアントサイドフックはリポジトリをクローンする際には *コピーされません* 。\n+スクリプトを使って何らかのポリシーを強制したいのなら、サーバサイドで行う方がよいでしょう。サンプルが <<_an_example_git_enforced_policy>> にあります。\n ====\n \n+//////////////////////////\n ===== Committing-Workflow Hooks\n+//////////////////////////\n+===== コミットワークフローフック\n \n+//////////////////////////\n The first four hooks have to do with the committing process.\n+//////////////////////////\n+最初の4つのフックはコミットプロセスに関するものです。\n \n+//////////////////////////\n The `pre-commit` hook is run first, before you even type in a commit message.\n It's used to inspect the snapshot that's about to be committed, to see if you've forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code.\n Exiting non-zero from this hook aborts the commit, although you can bypass it with `git commit --no-verify`.\n You can do things like check for code style (run `lint` or something equivalent), check for trailing whitespace (the default hook does exactly this), or check for appropriate documentation on new methods.\n+//////////////////////////\n+`pre-commit` フックは、コミットメッセージが入力される前に実行されます。\n+これは、いまからコミットされるスナップショットを検査したり、何かし忘れた事がないか確認したり、テストが実行できるか確認したり、何かしらコードを検査する目的で使用されます。\n+このフックがゼロでない値を返すと、コミットが中断されます。また、この検査は `git commit --no-verify` で飛ばすこともできます。\n+ここではコーディングスタイルの検査（lintを実行する等）や、行末の空白文字の検査（デフォルトのフックがまさにそうです）、新しく追加されたメソッドのドキュメントが正しいかどうかの検査といったことが可能です。\n \n+//////////////////////////\n The `prepare-commit-msg` hook is run before the commit message editor is fired up but after the default message is created.\n It lets you edit the default message before the commit author sees it.\n This hook takes a few parameters: the path to the file that holds the commit message so far, the type of commit, and the commit SHA-1 if this is an amended commit.\n This hook generally isn't useful for normal commits; rather, it's good for commits where the default message is auto-generated, such as templated commit messages, merge commits, squashed commits, and amended commits.\n You may use it in conjunction with a commit template to programmatically insert information.\n-\n+//////////////////////////\n+`prepare-commit-msg`フックは、コミットメッセージエディターが起動する直前、デフォルトメッセージが生成された直後に実行されます。\n+このフックでは、デフォルトメッセージを、コミットの作者の目に触れる前に編集することができます。\n+このフックにはパラメタがあり、その時点でのコミットメッセージを保存したファイルへのパス、コミットのタイプ、さらにamendされたコミットの場合はコミットの SHA-1 をパラメタとして取ります。\n+このフックは普段のコミットにおいてはあまり有用ではありませんが、テンプレートが用意されているコミットメッセージ・mergeコミット・squashコミット・amendコミットのような、デフォルトメッセージが自動生成されるコミットにおいて効果を発揮します。\n+コミットメッセージのテンプレートと組み合わせれば、プログラムで情報を動的に挿入することができます。\n+\n+//////////////////////////\n The `commit-msg` hook takes one parameter, which again is the path to a temporary file that contains the commit message written by the developer.\n If this script exits non-zero, Git aborts the commit process, so you can use it to validate your project state or commit message before allowing a commit to go through.\n In the last section of this chapter, We'll demonstrate using this hook to check that your commit message is conformant to a required pattern.\n+//////////////////////////\n+`commit-msg` フックは、開発者の書いたコミットメッセージを保存した一時ファイルへのパスをパラメータに取ります。\n+このスクリプトがゼロ以外の値を返した場合、Git はコミットプロセスを中断します。これを使えば、コミットを許可して処理を進める前に、プロジェクトの状態やコミットメッセージを検査できます。\n+この章の最後のセクションでは、このフックを使用してコミットメッセージが要求された様式に沿っているか検査するデモンストレーションを行います。\n \n+//////////////////////////\n After the entire commit process is completed, the `post-commit` hook runs.\n It doesn't take any parameters, but you can easily get the last commit by running `git log -1 HEAD`.\n Generally, this script is used for notification or something similar.\n+//////////////////////////\n+コミットプロセスが全て完了した後には、`post-commit`フックが実行されます。\n+このフックはパラメタを取りませんが、 `git log -1 HEAD` を実行することで直前のコミットを簡単に取り出すことができます。","path":"book/08-customizing-git/sections/hooks.asc","position":116,"original_position":116,"commit_id":"9face44f6a65852da7d13a6a42c6592ebc642ee1","original_commit_id":"9face44f6a65852da7d13a6a42c6592ebc642ee1","user":{"login":"harupong","id":204623,"avatar_url":"https://avatars.githubusercontent.com/u/204623?v=3","gravatar_id":"","url":"https://api.github.com/users/harupong","html_url":"https://github.com/harupong","followers_url":"https://api.github.com/users/harupong/followers","following_url":"https://api.github.com/users/harupong/following{/other_user}","gists_url":"https://api.github.com/users/harupong/gists{/gist_id}","starred_url":"https://api.github.com/users/harupong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harupong/subscriptions","organizations_url":"https://api.github.com/users/harupong/orgs","repos_url":"https://api.github.com/users/harupong/repos","events_url":"https://api.github.com/users/harupong/events{/privacy}","received_events_url":"https://api.github.com/users/harupong/received_events","type":"User","site_admin":false},"body":"> パラメタ\r\n\r\nパラメータ？","created_at":"2015-09-05T22:47:15Z","updated_at":"2015-09-05T22:47:15Z","html_url":"https://github.com/progit/progit2-ja/pull/68#discussion_r38815532","pull_request_url":"https://api.github.com/repos/progit/progit2-ja/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/progit/progit2-ja/pulls/comments/38815532"},"html":{"href":"https://github.com/progit/progit2-ja/pull/68#discussion_r38815532"},"pull_request":{"href":"https://api.github.com/repos/progit/progit2-ja/pulls/68"}}},"pull_request":{"url":"https://api.github.com/repos/progit/progit2-ja/pulls/68","id":42538034,"html_url":"https://github.com/progit/progit2-ja/pull/68","diff_url":"https://github.com/progit/progit2-ja/pull/68.diff","patch_url":"https://github.com/progit/progit2-ja/pull/68.patch","issue_url":"https://api.github.com/repos/progit/progit2-ja/issues/68","number":68,"state":"open","locked":false,"title":"Translate Chapter 8 \"Customizing Git\"","user":{"login":"satob","id":171818,"avatar_url":"https://avatars.githubusercontent.com/u/171818?v=3","gravatar_id":"","url":"https://api.github.com/users/satob","html_url":"https://github.com/satob","followers_url":"https://api.github.com/users/satob/followers","following_url":"https://api.github.com/users/satob/following{/other_user}","gists_url":"https://api.github.com/users/satob/gists{/gist_id}","starred_url":"https://api.github.com/users/satob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satob/subscriptions","organizations_url":"https://api.github.com/users/satob/orgs","repos_url":"https://api.github.com/users/satob/repos","events_url":"https://api.github.com/users/satob/events{/privacy}","received_events_url":"https://api.github.com/users/satob/received_events","type":"User","site_admin":false},"body":"翻訳が完了したファイルから順に本Pull Requestへ追加していきます。","created_at":"2015-08-16T15:19:43Z","updated_at":"2015-09-05T22:47:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b0171af35f7a96d92567936cf74e72265a3e2fd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/progit/progit2-ja/pulls/68/commits","review_comments_url":"https://api.github.com/repos/progit/progit2-ja/pulls/68/comments","review_comment_url":"https://api.github.com/repos/progit/progit2-ja/pulls/comments{/number}","comments_url":"https://api.github.com/repos/progit/progit2-ja/issues/68/comments","statuses_url":"https://api.github.com/repos/progit/progit2-ja/statuses/9face44f6a65852da7d13a6a42c6592ebc642ee1","head":{"label":"satob:update-08-customizing-git","ref":"update-08-customizing-git","sha":"9face44f6a65852da7d13a6a42c6592ebc642ee1","user":{"login":"satob","id":171818,"avatar_url":"https://avatars.githubusercontent.com/u/171818?v=3","gravatar_id":"","url":"https://api.github.com/users/satob","html_url":"https://github.com/satob","followers_url":"https://api.github.com/users/satob/followers","following_url":"https://api.github.com/users/satob/following{/other_user}","gists_url":"https://api.github.com/users/satob/gists{/gist_id}","starred_url":"https://api.github.com/users/satob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satob/subscriptions","organizations_url":"https://api.github.com/users/satob/orgs","repos_url":"https://api.github.com/users/satob/repos","events_url":"https://api.github.com/users/satob/events{/privacy}","received_events_url":"https://api.github.com/users/satob/received_events","type":"User","site_admin":false},"repo":{"id":32406951,"name":"progit2-ja","full_name":"satob/progit2-ja","owner":{"login":"satob","id":171818,"avatar_url":"https://avatars.githubusercontent.com/u/171818?v=3","gravatar_id":"","url":"https://api.github.com/users/satob","html_url":"https://github.com/satob","followers_url":"https://api.github.com/users/satob/followers","following_url":"https://api.github.com/users/satob/following{/other_user}","gists_url":"https://api.github.com/users/satob/gists{/gist_id}","starred_url":"https://api.github.com/users/satob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satob/subscriptions","organizations_url":"https://api.github.com/users/satob/orgs","repos_url":"https://api.github.com/users/satob/repos","events_url":"https://api.github.com/users/satob/events{/privacy}","received_events_url":"https://api.github.com/users/satob/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/satob/progit2-ja","description":"","fork":true,"url":"https://api.github.com/repos/satob/progit2-ja","forks_url":"https://api.github.com/repos/satob/progit2-ja/forks","keys_url":"https://api.github.com/repos/satob/progit2-ja/keys{/key_id}","collaborators_url":"https://api.github.com/repos/satob/progit2-ja/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/satob/progit2-ja/teams","hooks_url":"https://api.github.com/repos/satob/progit2-ja/hooks","issue_events_url":"https://api.github.com/repos/satob/progit2-ja/issues/events{/number}","events_url":"https://api.github.com/repos/satob/progit2-ja/events","assignees_url":"https://api.github.com/repos/satob/progit2-ja/assignees{/user}","branches_url":"https://api.github.com/repos/satob/progit2-ja/branches{/branch}","tags_url":"https://api.github.com/repos/satob/progit2-ja/tags","blobs_url":"https://api.github.com/repos/satob/progit2-ja/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/satob/progit2-ja/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/satob/progit2-ja/git/refs{/sha}","trees_url":"https://api.github.com/repos/satob/progit2-ja/git/trees{/sha}","statuses_url":"https://api.github.com/repos/satob/progit2-ja/statuses/{sha}","languages_url":"https://api.github.com/repos/satob/progit2-ja/languages","stargazers_url":"https://api.github.com/repos/satob/progit2-ja/stargazers","contributors_url":"https://api.github.com/repos/satob/progit2-ja/contributors","subscribers_url":"https://api.github.com/repos/satob/progit2-ja/subscribers","subscription_url":"https://api.github.com/repos/satob/progit2-ja/subscription","commits_url":"https://api.github.com/repos/satob/progit2-ja/commits{/sha}","git_commits_url":"https://api.github.com/repos/satob/progit2-ja/git/commits{/sha}","comments_url":"https://api.github.com/repos/satob/progit2-ja/comments{/number}","issue_comment_url":"https://api.github.com/repos/satob/progit2-ja/issues/comments{/number}","contents_url":"https://api.github.com/repos/satob/progit2-ja/contents/{+path}","compare_url":"https://api.github.com/repos/satob/progit2-ja/compare/{base}...{head}","merges_url":"https://api.github.com/repos/satob/progit2-ja/merges","archive_url":"https://api.github.com/repos/satob/progit2-ja/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/satob/progit2-ja/downloads","issues_url":"https://api.github.com/repos/satob/progit2-ja/issues{/number}","pulls_url":"https://api.github.com/repos/satob/progit2-ja/pulls{/number}","milestones_url":"https://api.github.com/repos/satob/progit2-ja/milestones{/number}","notifications_url":"https://api.github.com/repos/satob/progit2-ja/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/satob/progit2-ja/labels{/name}","releases_url":"https://api.github.com/repos/satob/progit2-ja/releases{/id}","created_at":"2015-03-17T16:50:38Z","updated_at":"2015-05-06T18:07:06Z","pushed_at":"2015-09-04T17:03:53Z","git_url":"git://github.com/satob/progit2-ja.git","ssh_url":"git@github.com:satob/progit2-ja.git","clone_url":"https://github.com/satob/progit2-ja.git","svn_url":"https://github.com/satob/progit2-ja","homepage":null,"size":167231,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"progit:master","ref":"master","sha":"dfe050550d39d7ac09f20f810a7eca68854027d1","user":{"login":"progit","id":95588,"avatar_url":"https://avatars.githubusercontent.com/u/95588?v=3","gravatar_id":"","url":"https://api.github.com/users/progit","html_url":"https://github.com/progit","followers_url":"https://api.github.com/users/progit/followers","following_url":"https://api.github.com/users/progit/following{/other_user}","gists_url":"https://api.github.com/users/progit/gists{/gist_id}","starred_url":"https://api.github.com/users/progit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progit/subscriptions","organizations_url":"https://api.github.com/users/progit/orgs","repos_url":"https://api.github.com/users/progit/repos","events_url":"https://api.github.com/users/progit/events{/privacy}","received_events_url":"https://api.github.com/users/progit/received_events","type":"Organization","site_admin":false},"repo":{"id":25915068,"name":"progit2-ja","full_name":"progit/progit2-ja","owner":{"login":"progit","id":95588,"avatar_url":"https://avatars.githubusercontent.com/u/95588?v=3","gravatar_id":"","url":"https://api.github.com/users/progit","html_url":"https://github.com/progit","followers_url":"https://api.github.com/users/progit/followers","following_url":"https://api.github.com/users/progit/following{/other_user}","gists_url":"https://api.github.com/users/progit/gists{/gist_id}","starred_url":"https://api.github.com/users/progit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progit/subscriptions","organizations_url":"https://api.github.com/users/progit/orgs","repos_url":"https://api.github.com/users/progit/repos","events_url":"https://api.github.com/users/progit/events{/privacy}","received_events_url":"https://api.github.com/users/progit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/progit/progit2-ja","description":"","fork":false,"url":"https://api.github.com/repos/progit/progit2-ja","forks_url":"https://api.github.com/repos/progit/progit2-ja/forks","keys_url":"https://api.github.com/repos/progit/progit2-ja/keys{/key_id}","collaborators_url":"https://api.github.com/repos/progit/progit2-ja/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/progit/progit2-ja/teams","hooks_url":"https://api.github.com/repos/progit/progit2-ja/hooks","issue_events_url":"https://api.github.com/repos/progit/progit2-ja/issues/events{/number}","events_url":"https://api.github.com/repos/progit/progit2-ja/events","assignees_url":"https://api.github.com/repos/progit/progit2-ja/assignees{/user}","branches_url":"https://api.github.com/repos/progit/progit2-ja/branches{/branch}","tags_url":"https://api.github.com/repos/progit/progit2-ja/tags","blobs_url":"https://api.github.com/repos/progit/progit2-ja/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/progit/progit2-ja/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/progit/progit2-ja/git/refs{/sha}","trees_url":"https://api.github.com/repos/progit/progit2-ja/git/trees{/sha}","statuses_url":"https://api.github.com/repos/progit/progit2-ja/statuses/{sha}","languages_url":"https://api.github.com/repos/progit/progit2-ja/languages","stargazers_url":"https://api.github.com/repos/progit/progit2-ja/stargazers","contributors_url":"https://api.github.com/repos/progit/progit2-ja/contributors","subscribers_url":"https://api.github.com/repos/progit/progit2-ja/subscribers","subscription_url":"https://api.github.com/repos/progit/progit2-ja/subscription","commits_url":"https://api.github.com/repos/progit/progit2-ja/commits{/sha}","git_commits_url":"https://api.github.com/repos/progit/progit2-ja/git/commits{/sha}","comments_url":"https://api.github.com/repos/progit/progit2-ja/comments{/number}","issue_comment_url":"https://api.github.com/repos/progit/progit2-ja/issues/comments{/number}","contents_url":"https://api.github.com/repos/progit/progit2-ja/contents/{+path}","compare_url":"https://api.github.com/repos/progit/progit2-ja/compare/{base}...{head}","merges_url":"https://api.github.com/repos/progit/progit2-ja/merges","archive_url":"https://api.github.com/repos/progit/progit2-ja/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/progit/progit2-ja/downloads","issues_url":"https://api.github.com/repos/progit/progit2-ja/issues{/number}","pulls_url":"https://api.github.com/repos/progit/progit2-ja/pulls{/number}","milestones_url":"https://api.github.com/repos/progit/progit2-ja/milestones{/number}","notifications_url":"https://api.github.com/repos/progit/progit2-ja/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/progit/progit2-ja/labels{/name}","releases_url":"https://api.github.com/repos/progit/progit2-ja/releases{/id}","created_at":"2014-10-29T10:12:49Z","updated_at":"2015-09-02T03:27:30Z","pushed_at":"2015-09-04T17:03:53Z","git_url":"git://github.com/progit/progit2-ja.git","ssh_url":"git@github.com:progit/progit2-ja.git","clone_url":"https://github.com/progit/progit2-ja.git","svn_url":"https://github.com/progit/progit2-ja","homepage":null,"size":167932,"stargazers_count":17,"watchers_count":17,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":23,"forks":10,"open_issues":23,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/progit/progit2-ja/pulls/68"},"html":{"href":"https://github.com/progit/progit2-ja/pull/68"},"issue":{"href":"https://api.github.com/repos/progit/progit2-ja/issues/68"},"comments":{"href":"https://api.github.com/repos/progit/progit2-ja/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/progit/progit2-ja/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/progit/progit2-ja/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/progit/progit2-ja/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/progit/progit2-ja/statuses/9face44f6a65852da7d13a6a42c6592ebc642ee1"}}}}