New issue
Advanced search Search tips

Issue 790003 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 12
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

“gn format” wants to merge two comments that should be distinct

Project Member Reported by mark@chromium.org, Nov 30 2017

Issue description

https://chromium.googlesource.com/crashpad/crashpad/+/2bb56fafe3bd0c7a381ff4a1f54a82f772407a62/build/chromium_compatibility/build/config/compiler/compiler.gni is a file that’s empty except for comments. There’s a license boilerplate at the top, then a blank line, and then a comment describing what the file’s purpose is.

“gn format” wants to remove the blank line between the license boilerplate and the descriptive comment.

mark@mela zsh% git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
mark@mela zsh% gn --version
514519
mark@mela zsh% gn format build/chromium_compatibility/build/config/compiler/compiler.gni
Wrote formatted to '/chrome/crashpad/crashpad/build/chromium_compatibility/build/config/compiler/compiler.gni'.
mark@mela zsh% git diff
diff --git a/build/chromium_compatibility/build/config/compiler/compiler.gni b/build/chromium_compatibility/build/config/compiler/compiler.gni
index f615259a5cb2..4aa779a01c39 100644
--- a/build/chromium_compatibility/build/config/compiler/compiler.gni
+++ b/build/chromium_compatibility/build/config/compiler/compiler.gni
@@ -11,6 +11,5 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
 # This is a stub to match Chromium, but is unused when building standalone in
 # Crashpad.

This doesn’t happen when the file has some non-comment stuff in it. For example, https://chromium.googlesource.com/crashpad/crashpad/+/2bb56fafe3bd0c7a381ff4a1f54a82f772407a62/build/chromium_compatibility/build/config/compiler/BUILD.gn formats correctly.

mark@mela zsh% gn format build/chromium_compatibility/build/config/compiler/BUILD.gn
mark@mela zsh% git diff build/chromium_compatibility/build/config/compiler/BUILD.gn
 
Cc: scottmg@chromium.org
Cc: -scottmg@chromium.org
Owner: scottmg@chromium.org
Status: Started (was: Untriaged)

Comment 3 by mark@chromium.org, Nov 30 2017

Ha! Well, if I had known it was gonna be YOU…
Yeah, I'm sneaky that way :).
Project Member

Comment 5 by bugdroid1@chromium.org, Nov 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8f449e3d6a1f0060dc18243be0ed9e1a1af1b919

commit 8f449e3d6a1f0060dc18243be0ed9e1a1af1b919
Author: Scott Graham <scottmg@chromium.org>
Date: Thu Nov 30 21:14:13 2017

gn: Fix formatting of file containing only 2 block comments

Also, make --dump-tree work with --stdin by sending the tree to stderr.

Bug:  790003 
Change-Id: Ie9fde86826cb28b873f726543c034f5c9992cd84
Reviewed-on: https://chromium-review.googlesource.com/801092
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520687}
[modify] https://crrev.com/8f449e3d6a1f0060dc18243be0ed9e1a1af1b919/tools/gn/command_format.cc
[modify] https://crrev.com/8f449e3d6a1f0060dc18243be0ed9e1a1af1b919/tools/gn/command_format_unittest.cc
[add] https://crrev.com/8f449e3d6a1f0060dc18243be0ed9e1a1af1b919/tools/gn/format_test_data/068.gn
[add] https://crrev.com/8f449e3d6a1f0060dc18243be0ed9e1a1af1b919/tools/gn/format_test_data/068.golden

Status: Fixed (was: Started)

Sign in to add a comment