Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
}

Expand Down