sapling/eden/fs/store/DiffContext.cpp
Xavier Deguillard 09f97fa27a store: diff should respect the mount case sensitivity
Summary:
During a diff operation, files that have a case change should not reported as
changed for case insensitive mount. This is a follow up to D29150552 (37ccaa9231) where the
TreeInode code was taught to ignore case changes for case insensitive mounts.

Reviewed By: kmancini

Differential Revision: D29952464

fbshipit-source-id: e5fa8eccc1c1984a680838fd8589a0278989d9d0
2021-07-29 11:29:42 -07:00

65 lines
1.8 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#include "eden/fs/store/DiffContext.h"
#include <thrift/lib/cpp2/async/ResponseChannel.h>
#include "eden/fs/model/git/GitIgnoreStack.h"
#include "eden/fs/model/git/TopLevelIgnores.h"
#include "eden/fs/store/IObjectStore.h"
using apache::thrift::ResponseChannelRequest;
namespace facebook::eden {
DiffContext::DiffContext(
DiffCallback* cb,
bool listIgnored,
CaseSensitivity caseSensitive,
const ObjectStore* os,
std::unique_ptr<TopLevelIgnores> topLevelIgnores,
LoadFileFunction loadFileContentsFromPath,
ResponseChannelRequest* request)
: callback{cb},
store{os},
listIgnored{listIgnored},
caseSensitive{caseSensitive},
topLevelIgnores_(std::move(topLevelIgnores)),
loadFileContentsFromPath_{loadFileContentsFromPath},
request_{request} {}
DiffContext::DiffContext(DiffCallback* cb, const ObjectStore* os)
: callback{cb},
store{os},
listIgnored{true},
caseSensitive{kPathMapDefaultCaseSensitive},
topLevelIgnores_{std::unique_ptr<TopLevelIgnores>()},
loadFileContentsFromPath_{nullptr},
request_{nullptr} {};
DiffContext::~DiffContext() = default;
const GitIgnoreStack* DiffContext::getToplevelIgnore() const {
return topLevelIgnores_->getStack();
}
DiffContext::LoadFileFunction DiffContext::getLoadFileContentsFromPath() const {
return loadFileContentsFromPath_;
}
bool DiffContext::isCancelled() const {
// If request_ is null we do not have an associated thrift
// request that can be cancelled, so we are always still active
if (request_ && !request_->isActive()) {
return true;
}
return false;
}
} // namespace facebook::eden