From 50e1bb1a194c06ed0110bd13b5cca769a38c4157 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 24 Dec 2015 10:28:20 +0100 Subject: Use full path for change tracking Prevents the same file being tracked multiple times due to relative input paths. --- src/tracking/change_tracker.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tracking/change_tracker.cc b/src/tracking/change_tracker.cc index 9bbdcb6..490d7cb 100644 --- a/src/tracking/change_tracker.cc +++ b/src/tracking/change_tracker.cc @@ -30,7 +30,7 @@ ChangeTracker::ChangeTracker(utility::Logger* logger, const std::string& diff_cm children_() { } ChangeTracker::ChangeTracker(utility::Logger* logger): - ChangeTracker(logger, "diff -p") { } + ChangeTracker(logger, "diff -u") { } ChangeTracker::~ChangeTracker() { for ( auto&& tracked : this->children_ ) { @@ -43,7 +43,9 @@ ChangeTracker::~ChangeTracker() { } bool ChangeTracker::is_tracked(const std::string& file_path) const { - return this->children_.find(file_path) != this->children_.end(); + return this->children_.find( + boost::filesystem::canonical(file_path).string() + ) != this->children_.end(); } // Begins tracking changes to a file reachable by a given path @@ -72,7 +74,7 @@ bool ChangeTracker::is_tracked(const std::string& file_path) const { // bool ChangeTracker::track(const std::string& file_path) { auto result = this->children_.emplace( - file_path, + boost::filesystem::canonical(file_path).string(), std::make_unique( boost::process::launch_shell( this->diff_cmd_ + " - " + file_path, -- cgit v1.2.3