When running `git cl format` BUILD.gn files are formatted and source files are sorted according to their name. Ideally, this sort step should also remove duplicates from the list. For example, a dependency list of
deps = [
"foo",
"bar",
"baz",
"bar",
]
should be formatted as
deps = [
"bar",
"baz",
"foo",
]
and not
deps = [
"bar",
"bar",
"baz",
"foo",
]
Admittedly this case is relatively rare, but I just hit it when rebasing a CL that is renaming directories.
Glancing at the source this should be fixed by adding a call to std::unique() following the std::sort() step in ListNode::SortList().
This wouldn't be able to remove duplicates spanning multiple SortRanges(), but I don't think that is necessarily a problem.
Comment 1 by scottmg@chromium.org
, Feb 5 2018