Use google-java-format for styling google-java-format is an open-source tool[1] for mechanically converting Java code to follow the Google Java Style Guide[2] formatting recommendations. The tool is inspired in part by gofmt[3], which has been very successful in the Go community. Any automatic formatter is going to make some decisions that not everyone agrees with, but the goal is to avoid pointless discussions in reviews that detract from actually understanding the code. My personal experience with this tool is that it adds many more newlines than I would write in my own code, leading to deeper indentation. It took me a while to get used to it, but I'm fine with it now. (It's worth pointing out that the deeper indentation is also more bearable because Gitiles uses a 100-column limit; for an 80-column limit it might be less readable.) Converting all at once like this definitely hurts blame-ability, but honestly at this point in Gitiles most of the lines were written once, by me, so we're not losing too much. [1] https://github.com/google/google-java-format [2] https://google.github.io/styleguide/javaguide.html [3] https://blog.golang.org/go-fmt-your-code Change-Id: I289c5ea97f416b9b709db1033bdb8357fdaa9690
diff --git a/gitiles-servlet/src/test/java/com/google/gitiles/LogServletTest.java b/gitiles-servlet/src/test/java/com/google/gitiles/LogServletTest.java index 2eadf54..5d1d1f6 100644 --- a/gitiles-servlet/src/test/java/com/google/gitiles/LogServletTest.java +++ b/gitiles-servlet/src/test/java/com/google/gitiles/LogServletTest.java
@@ -71,15 +71,8 @@ @Test public void follow() throws Exception { String contents = "contents"; - RevCommit c1 = repo.branch("master") - .commit() - .add("foo", contents) - .create(); - RevCommit c2 = repo.branch("master") - .commit() - .rm("foo") - .add("bar", contents) - .create(); + RevCommit c1 = repo.branch("master").commit().add("foo", contents).create(); + RevCommit c2 = repo.branch("master").commit().rm("foo").add("bar", contents).create(); repo.getRevWalk().parseBody(c1); repo.getRevWalk().parseBody(c2);