2017-03-24 23:42:39 +03:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2017-04-29 05:14:25 +03:00
|
|
|
#include "eden/fs/model/git/GitIgnoreStack.h"
|
|
|
|
|
2017-03-24 23:42:39 +03:00
|
|
|
namespace facebook {
|
|
|
|
namespace eden {
|
|
|
|
|
2017-04-29 05:14:25 +03:00
|
|
|
class InodeDiffCallback;
|
|
|
|
class ObjectStore;
|
|
|
|
|
2017-03-24 23:42:39 +03:00
|
|
|
/**
|
|
|
|
* A small helper class to store parameters for a TreeInode::diff() operation.
|
|
|
|
*
|
|
|
|
* These are parameters that remain fixed across all subdirectories being
|
|
|
|
* diffed. This class is mostly just for convenience so that we do not have to
|
|
|
|
* pass these items in individually as separate parameters to each function
|
|
|
|
* being called.
|
|
|
|
*/
|
|
|
|
class DiffContext {
|
|
|
|
public:
|
2017-10-17 08:22:18 +03:00
|
|
|
DiffContext(InodeDiffCallback* cb, bool listIgnored, ObjectStore* os)
|
|
|
|
: callback{cb}, store{os}, listIgnored{listIgnored} {
|
2017-04-29 05:14:25 +03:00
|
|
|
// TODO: Load the system-wide ignore settings and user-specific
|
|
|
|
// ignore settings into rootIgnore_.
|
|
|
|
}
|
|
|
|
|
|
|
|
const GitIgnoreStack* getToplevelIgnore() const {
|
|
|
|
return &rootIgnore_;
|
|
|
|
}
|
2017-03-24 23:42:39 +03:00
|
|
|
|
|
|
|
InodeDiffCallback* const callback;
|
|
|
|
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;
|
2017-04-29 05:14:25 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
GitIgnoreStack rootIgnore_{nullptr};
|
2017-03-24 23:42:39 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|