aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tracking/change_tracker.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tracking/change_tracker.cc b/src/tracking/change_tracker.cc
index 490d7cb..92be10c 100644
--- a/src/tracking/change_tracker.cc
+++ b/src/tracking/change_tracker.cc
@@ -20,6 +20,11 @@ boost::process::context getDefaultContext() {
return context;
}
+std::string getDiffCommand(
+ const std::string& diff_cmd, const std::string& full_path) {
+ return diff_cmd + " --label " + full_path + " - " + full_path;
+}
+
}
namespace tracking {
@@ -73,11 +78,15 @@ bool ChangeTracker::is_tracked(const std::string& file_path) const {
// file provided if the second file argument is standard input
//
bool ChangeTracker::track(const std::string& file_path) {
+ const std::string full_file_path{
+ boost::filesystem::canonical(file_path).string()
+ };
+
auto result = this->children_.emplace(
- boost::filesystem::canonical(file_path).string(),
+ full_file_path,
std::make_unique<boost::process::child>(
boost::process::launch_shell(
- this->diff_cmd_ + " - " + file_path,
+ getDiffCommand(this->diff_cmd_, full_file_path),
getDefaultContext()
)
)