)]}'
{
  "commit": "97cc440d84f050f99ff0161f9414bfa2ffa38f65",
  "tree": "7e79b62722b87cd25d3c61933e1fc09d22daac2b",
  "parents": [
    "d874bb911222d211f0201ae1cd4b73428e7c1030"
  ],
  "author": {
    "name": "Scott Graham",
    "email": "scottmg@chromium.org",
    "time": "Tue Jan 21 12:14:43 2020 -0800"
  },
  "committer": {
    "name": "Commit Bot",
    "email": "commit-bot@chromium.org",
    "time": "Wed Jan 22 22:15:03 2020 +0000"
  },
  "message": "format: Fix not getting to fixed point in one step\n\nIn https://gn-review.googlesource.com/c/gn/+/7140/ some styles of suffix\ncomments the formatter would wrap the suffix comments. But on reapplying\nthe formatter a second time, the parse tree is slightly different. The\nsecond time through, the wrapped comment is the only thing on a line\nseparating two statements.\n\n  a \u003d                 1\n    b + c  # x        2\n           # y        3\n  d \u003d e               4\n\nThe ParseNode doesn\u0027t have a LocationRange that includes the suffix\ncomments, so when the formatter attempts to determine if there was a\nblank line between two statements, it incorrectly decides there should\nbe an additional blank line added (because the end of the first\nstatement is not directly next to the start of the next one). That is,\nthe \"end\" of the \"a\u003db+c\" is line 2, not line 3.\n\nI fiddled around with trying to amend the parse tree to make the\ncomments be included in the range of the node, but I didn\u0027t come up with\na reasonable way to do that. Instead, have the formatter calculate the\n\"real\" range at formatting time, so instead of simply using line numbers\nfor A and B to determine if they\u0027re split, it walks down A looking for\nsuffix comments and finds the lowest down one and uses that instead. In\nthe example above, the walk will determine that \"a\u003db+c\" really ends on\nline 3, so is adjacent to \"d\u003de\" on line 4 and no blank line should be\ninserted.\n\nThis makes the recent Chromium test reformat\nhttps://chromium-review.googlesource.com/c/chromium/src/+/2011169/\n\"stick\" in that no further changes are made if the formatter is run on\nit again.\n\nBug: gn:141\nChange-Id: If320a87feec9671d2368a799e9e396866698561d\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/7180\nCommit-Queue: Scott Graham \u003cscottmg@chromium.org\u003e\nReviewed-by: Brett Wilson \u003cbrettw@chromium.org\u003e\nReviewed-by: Nico Weber \u003cthakis@chromium.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "623d8e2e5c3fff538148b38a3196605f6e0307cb",
      "old_mode": 33188,
      "old_path": "src/gn/command_format.cc",
      "new_id": "dafc732f3d73bdb12be9c96869cd186597b7349d",
      "new_mode": 33188,
      "new_path": "src/gn/command_format.cc"
    },
    {
      "type": "modify",
      "old_id": "4dcf3bb7566741ed0617a6b965ad6c54cfe96308",
      "old_mode": 33188,
      "old_path": "src/gn/command_format_unittest.cc",
      "new_id": "5f814b95e95ee95fea02dc0750222ac4915f950c",
      "new_mode": 33188,
      "new_path": "src/gn/command_format_unittest.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "d9d494e6c1671ac843dd15571c345addcf72a2f5",
      "new_mode": 33188,
      "new_path": "src/gn/format_test_data/081.gn"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c4ee25f454777a7b9a78e4d3fb441977257545c4",
      "new_mode": 33188,
      "new_path": "src/gn/format_test_data/081.golden"
    }
  ]
}
