https://github.com/mrexodia updated https://github.com/llvm/llvm-project/pull/170003
>From 7c74cf4d11949b4de8d575104e57ffad4b9854c2 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie <[email protected]> Date: Sat, 29 Nov 2025 17:07:37 +0100 Subject: [PATCH] Add .gitignore file in .cache/clangd/index --- .../clangd/index/BackgroundIndexStorage.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp index d887b09482a95..7b8843c4e5523 100644 --- a/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp +++ b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp @@ -45,6 +45,20 @@ class DiskBackedIndexStorage : public BackgroundIndexStorage { if (EC != OK) { elog("Failed to create directory {0} for index storage: {1}", DiskShardRoot, EC.message()); + } else { + // Create a .gitignore file in the directory to ignore all files. + llvm::SmallString<128> GitignorePath(DiskShardRoot); + llvm::sys::path::append(GitignorePath, ".gitignore"); + if (!llvm::sys::fs::exists(GitignorePath)) { + llvm::raw_fd_ostream GitignoreFile(GitignorePath, EC, + llvm::sys::fs::OF_None); + if (EC == OK) { + GitignoreFile << "*\n"; + } else { + elog("Failed to create .gitignore in {0}: {1}", DiskShardRoot, + EC.message()); + } + } } } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
