diff options
author | Adrian Kummerlaender | 2015-12-24 10:28:20 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-12-24 10:28:20 +0100 |
commit | 50e1bb1a194c06ed0110bd13b5cca769a38c4157 (patch) | |
tree | 8a4ea0a378607d224779c0e7434a9c4888301bf4 /src | |
parent | ce1460dd98185f80db479c7dc7ca19026149a255 (diff) | |
download | change-50e1bb1a194c06ed0110bd13b5cca769a38c4157.tar change-50e1bb1a194c06ed0110bd13b5cca769a38c4157.tar.gz change-50e1bb1a194c06ed0110bd13b5cca769a38c4157.tar.bz2 change-50e1bb1a194c06ed0110bd13b5cca769a38c4157.tar.lz change-50e1bb1a194c06ed0110bd13b5cca769a38c4157.tar.xz change-50e1bb1a194c06ed0110bd13b5cca769a38c4157.tar.zst change-50e1bb1a194c06ed0110bd13b5cca769a38c4157.zip |
Use full path for change tracking
Prevents the same file being tracked multiple times due to relative input paths.
Diffstat (limited to 'src')
-rw-r--r-- | src/tracking/change_tracker.cc | 8 |
1 files changed, 5 insertions, 3 deletions
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::child>( boost::process::launch_shell( this->diff_cmd_ + " - " + file_path, |