aboutsummaryrefslogtreecommitdiff
path: root/src/tracking/change_tracker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tracking/change_tracker.cc')
-rw-r--r--src/tracking/change_tracker.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/tracking/change_tracker.cc b/src/tracking/change_tracker.cc
index 913604e..9bbdcb6 100644
--- a/src/tracking/change_tracker.cc
+++ b/src/tracking/change_tracker.cc
@@ -24,10 +24,14 @@ boost::process::context getDefaultContext() {
namespace tracking {
-ChangeTracker::ChangeTracker(utility::Logger* logger):
+ChangeTracker::ChangeTracker(utility::Logger* logger, const std::string& diff_cmd):
+ diff_cmd_(diff_cmd),
logger_(logger),
children_() { }
+ChangeTracker::ChangeTracker(utility::Logger* logger):
+ ChangeTracker(logger, "diff -p") { }
+
ChangeTracker::~ChangeTracker() {
for ( auto&& tracked : this->children_ ) {
std::get<DIFF_PROCESS>(tracked)->get_stdin().close();
@@ -70,7 +74,10 @@ bool ChangeTracker::track(const std::string& file_path) {
auto result = this->children_.emplace(
file_path,
std::make_unique<boost::process::child>(
- boost::process::launch_shell("diff -p - " + file_path, getDefaultContext())
+ boost::process::launch_shell(
+ this->diff_cmd_ + " - " + file_path,
+ getDefaultContext()
+ )
)
);