<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 27, 2019 at 12:48 PM Fangrui Song via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Many git commits in the monorepo look like the following:<br>
<br>
[Tag0][Tag1] Title line<br>
<br>
Summary:<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque mauris neque, porta nec tristique at, sagittis vel nisi. Fusce pharetra nunc et mauris consequat venenatis.<br>
<br>
Reviewers: username0, username1<br>
<br>
Reviewed By: username0<br>
<br>
Subscribers: username2, username3, llvm-commits<br>
<br>
Tags: #llvm<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/Dxxxxx" rel="noreferrer" target="_blank">https://reviews.llvm.org/Dxxxxx</a><br>
<br>
These Phabricator metadata lines (`Reviewers:`, `Reviewed By:`, etc) are created automatically when the author uploads the patch via `arc diff 'HEAD^'`.<br>
The summary and metadata can be copied from Phabricator to the local commit via `arc amend`.<br>
<br>
Among the metadata tags, `Differential Revision:` is the most useful one. It associates a commit with a Phabricator differential (Dxxxxx) and allows the differential to be closed automatically when the commit is pushed to llvm-project master.<br>
<br>
The other tags (Subscribers:, Reviewers:, Reviewed By:, Tags:, and the `Summary:` line) are not useful. They just clutter up the commit message. Shall we mention on <a href="https://llvm.org/docs/DeveloperPolicy.html" rel="noreferrer" target="_blank">https://llvm.org/docs/DeveloperPolicy.html</a> that developers are recommended to delete metadata tags before committing?</blockquote><div><br></div><div>That's be great!</div><div>I suspect we can provide a bash function to add to one's .bashrc to make it trivial:<br></div><div><br></div><div>function arcfilter() { git log -1 --pretty=%B | awk '/Reviewers: /{p=1; sub(/Reviewers: .*Differential Revision: /, "")}; /Differential Revision: /{p=0;}; !p' | git commit --amend -F - ; }<br></div><div><br></div><div>Just running `arcfilter` before pushing will filter the commit it out automatically!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> It'd be nice if some pre-receive hooks can be set up to enforce deleting some really unnecessary metadata tags.</blockquote><div><br></div><div>Unfortunately you can't add pre-receive hook on GitHub as far as I know.</div><div><br></div><div>-- </div><div>Mehd</div><div><br></div></div></div></div>