Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-clang-format clears files listed in .clang-format-ignore #102459

Closed
martinarendar opened this issue Aug 8, 2024 · 0 comments · Fixed by #102629
Closed

git-clang-format clears files listed in .clang-format-ignore #102459

martinarendar opened this issue Aug 8, 2024 · 0 comments · Fixed by #102629
Assignees

Comments

@martinarendar
Copy link

When using git clang-format with .clang-format-ignore, the files listed in .clang-format-ignore are beeing cleared.

Example:
A simple main.cpp file located under [project root, location of .clang-format and .clang-format-ignore]/src/main.cpp:

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

If I add src/main.cpp to .clang-format-ignore and run git clang-format -f --style=file the contents of main.cpp get erased.
If I run clang-format -i --style=file src/main.cpp the file is ignored and everything works like it's supposed to.

@owenca owenca self-assigned this Aug 9, 2024
@owenca owenca added this to the LLVM 19.X Release milestone Aug 9, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage in LLVM Release Status Aug 9, 2024
owenca added a commit to owenca/llvm-project that referenced this issue Aug 9, 2024
With the --force (or -f) option, git-clang-format wipes out input files
excluded by a .clang-format-ignore file if they have unstaged changes.

This patch adds a hidden clang-format option --list-ignored that lists such
excluded files for git-clang-format to filter out.

Fixes llvm#102459.
@tru tru moved this from Needs Triage to Needs Fix in LLVM Release Status Aug 10, 2024
owenca added a commit that referenced this issue Aug 10, 2024
With the --force (or -f) option, git-clang-format wipes out input files
excluded by a .clang-format-ignore file if they have unstaged changes.

This patch adds a hidden clang-format option --list-ignored that lists
such excluded files for git-clang-format to filter out.

Fixes #102459.
@github-project-automation github-project-automation bot moved this from Needs Fix to Done in LLVM Release Status Aug 10, 2024
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Aug 10, 2024
With the --force (or -f) option, git-clang-format wipes out input files
excluded by a .clang-format-ignore file if they have unstaged changes.

This patch adds a hidden clang-format option --list-ignored that lists
such excluded files for git-clang-format to filter out.

Fixes llvm#102459.

(cherry picked from commit 986bc3d)
tru pushed a commit to llvmbot/llvm-project that referenced this issue Aug 13, 2024
With the --force (or -f) option, git-clang-format wipes out input files
excluded by a .clang-format-ignore file if they have unstaged changes.

This patch adds a hidden clang-format option --list-ignored that lists
such excluded files for git-clang-format to filter out.

Fixes llvm#102459.

(cherry picked from commit 986bc3d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

2 participants