sapling/eden/fs/inodes/DiffContext.h
Eamonn Kent 2f39c5297e DiffContext changes to use TopLevelIgnores
Summary:
Make use of the TopLevelIgnores class to hold the system and user
GitIgnoreStack details. This is a cleaner implementation making ownership
semantics more intuitive. In later commits we will provide acess to the
TopLevelIgnores as part of the ServerState. It will be dynamically loaded.

Reviewed By: simpkins

Differential Revision: D8906226

fbshipit-source-id: d955436582498861ac4b4113a47f357432c8f32e
2018-07-19 17:21:38 -07:00

60 lines
1.6 KiB
C++

/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#pragma once
#include <folly/Range.h>
namespace facebook {
namespace eden {
class InodeDiffCallback;
class GitIgnoreStack;
class ObjectStore;
class UserInfo;
class TopLevelIgnores;
/**
* A helper class to store parameters for a TreeInode::diff() operation.
*
* These parameters remain fixed across all subdirectories being diffed.
* Primarily intent is to compound related diff attributes.
*/
class DiffContext {
public:
DiffContext(
InodeDiffCallback* cb,
bool listIgnored,
const ObjectStore* os,
std::unique_ptr<TopLevelIgnores> topLevelIgnores);
DiffContext(const DiffContext&) = delete;
DiffContext& operator=(const DiffContext&) = delete;
DiffContext(DiffContext&&) = delete;
DiffContext& operator=(DiffContext&&) = delete;
~DiffContext();
InodeDiffCallback* const callback;
const ObjectStore* const store;
/**
* If listIgnored is true information about ignored files will be reported.
* If listIgnored is false then ignoredFile() will never be called on the
* callback. The diff operation may be faster with listIgnored=false, since
* it can completely omit processing ignored subdirectories.
*/
bool const listIgnored;
const GitIgnoreStack* getToplevelIgnore() const;
private:
std::unique_ptr<TopLevelIgnores> topLevelIgnores_;
};
} // namespace eden
} // namespace facebook