Repositories / agent-snapshot.git
agent-snapshot.git
Clone (read-only): git clone http://git.guha-anderson.com/git/agent-snapshot.git
@@ -205,9 +205,17 @@ bool path_is_at_or_under(const fs::path& path, const fs::path& root) { return true; } +bool is_git_internal_path(const fs::path& path) { + for (const auto& part : path) { + if (part == ".git") return true; + } + return false; +} + bool is_ignored_path(const fs::path& raw_path) { if (raw_path.empty()) return false; fs::path path = best_effort_canonical(raw_path); + if (is_git_internal_path(path)) return true; for (const auto& ignored : ignored_paths) { if (path_is_at_or_under(path, ignored)) return true; } @@ -467,7 +475,10 @@ void finalize_records() { rec.after = stat_metadata(path).value_or(Metadata{}); if (!rec.after.exists) rec.after.tombstone = rec.operations.count("delete") > 0; rec.after_git = classify_git(path); - if (should_capture_content(path, rec.after, rec.after_git)) { + const bool written_regular_file = + rec.operations.count("write") > 0 && rec.after.exists && rec.after.regular; + if ((written_regular_file && !owned_by_other_and_not_writable(path)) || + should_capture_content(path, rec.after, rec.after_git)) { rec.after.blob = store_blob(path); } }