Closed Bug 1392012 Opened 7 years ago Closed 7 years ago

./mach clang-format with git doesn't use .clang-format-ignore to ignore some files & dirs

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: Sylvestre, Assigned: dex, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [good first bug][lang=python])

Attachments

(1 file)

Hello, I'm new around here. From what I understood, the format that clang-format uses to ignore files is different for mercurial and git. 
I was referring to https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format
and found that git has a different option called 'ignored' that does the same function as .clang-format-ignored.
Usage would be: 
git clang-format ignored dir

So I think we should change line 272 from:
diff_process = Popen(["git", "diff", "--no-color", "-U0", "HEAD","--","*.c","*.cpp","*.h"], stdout=PIPE)
to:
diff_process = Popen(["git", "diff", "--no-color", "-U0", "HEAD","--","*.c","*.cpp","*.h", "clang-format", "ignored", "dir"], stdout=PIPE)
I don't know how I should mention the directory/file to be ignored. Help would be appreciated.
Please assign this bug to me if I have understood the problem correctly.
Flags: needinfo?(sledru)
did you test your change in the code?
Thanks
Flags: needinfo?(sledru)
Not yet. I am going to proceed with running "./mach clang-format" on this git repo https://github.com/mozilla/gecko-dev.git and then going to try to fix any errors that may occur. Do you know which command I should use to specifically trigger the bug?
Thanks!
Flags: needinfo?(sledru)
You should look for this yourself. This is part of the learning phase!
Flags: needinfo?(sledru)
Assignee: nobody → dex
Comment on attachment 8900921 [details]
Bug 1392012 - ./clang-format with git should exclude files from .clang-format-ignore

https://reviewboard.mozilla.org/r/172358/#review178456

once more, great work, thanks
Attachment #8900921 - Flags: review?(sledru) → review+
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/371686fcf5e0
/clang-format with git should exclude files from .clang-format-ignore r=sylvestre
https://hg.mozilla.org/mozilla-central/rev/371686fcf5e0
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: