mach clang-format doesn't format the current revision

RESOLVED FIXED in Firefox 55

Status

RESOLVED FIXED
2 years ago
10 months ago

People

(Reporter: cpearce, Assigned: cpearce)

Tracking

unspecified
mozilla55

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
The `mach clang-format` command doesn't work well with history rewriting.

If I have three commits A, B, C, where C is the tip. If I `hg up A` and `./mach clang-format` (with the intention of following up with `hg amend ; hg evolve `) stuff changed in C gets formatted.

This is because clang-format's CommandProvider uses "-r tip^" to express the changes to be formatted. It should be using "-r .^" as that means "the current revision and any changes in the working dir", which is what we're trying to format.
Comment hidden (mozreview-request)

Comment 2

2 years ago
mozreview-review
Comment on attachment 8849291 [details]
Bug 1348982 - Make 'mach clang-format' format the current revision instead of the tip.

https://reviewboard.mozilla.org/r/122110/#review124732

Good catch.

Strictly speaking `hg diff -c .` is probably semantically better. But I don't think it really matters in this case.
Attachment #8849291 - Flags: review?(gps) → review+

Comment 3

2 years ago
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6270b8fc98ab
Make 'mach clang-format' format the current revision instead of the tip. r=gps

Comment 4

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/6270b8fc98ab
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55

Updated

10 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.