Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [0.4.4] - 2026-04-07

### Fixed

- Skip file transfer for mappings with no differences (#39)
- `transfer_mappings` now filters using cached diff results to only transfer mappings that have actual changes
- Prevents unnecessary file mtime updates that caused Neovim to reload all plugins on every `dotsync pull`
- No redundant file comparisons — leverages the already-computed `@differs` from the display phase

## [0.4.3] - 2026-03-22

### Fixed
Expand All @@ -13,7 +22,6 @@

- Fix `cp_r_regular_files` crash on pre-existing symlinks during backup (#35)
- Add `FileUtils.rm_f` before `FileUtils.ln_s` to handle leftover symlinks from partial backup runs

## [0.4.1] - 2026-03-17

### Fixed
Expand Down Expand Up @@ -498,6 +506,9 @@ Add gem executables

Initial version

[0.4.4]: https://github.com/dsaenztagarro/dotsync/compare/v0.4.3...v0.4.4
[0.4.3]: https://github.com/dsaenztagarro/dotsync/compare/v0.4.2...v0.4.3
[0.4.2]: https://github.com/dsaenztagarro/dotsync/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/dsaenztagarro/dotsync/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/dsaenztagarro/dotsync/compare/v0.3.3...v0.4.0
[0.3.3]: https://github.com/dsaenztagarro/dotsync/compare/v0.3.2...v0.3.3
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
dotsync (0.4.1)
dotsync (0.4.2)
fileutils (~> 1.7.3)
find (~> 0.2.0)
listen (~> 3.9.0)
Expand Down
7 changes: 6 additions & 1 deletion lib/dotsync/actions/concerns/mappings_transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ def transfer_mappings
errors = []
mutex = Mutex.new

# Only transfer mappings that have actual differences (uses cached diffs)
changed_mappings = valid_mappings.each_with_index.filter_map do |mapping, idx|
mapping if differs[idx].any?
end

# Process mappings in parallel - each mapping is independent
Dotsync::Parallel.each(valid_mappings) do |mapping|
Dotsync::Parallel.each(changed_mappings) do |mapping|
Dotsync::FileTransfer.new(mapping).transfer
rescue Dotsync::PermissionError => e
mutex.synchronize { errors << ["Permission denied: #{e.message}", "Try: chmod +w <path> or check file permissions"] }
Expand Down
2 changes: 1 addition & 1 deletion lib/dotsync/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Dotsync
VERSION = "0.4.3"
VERSION = "0.4.4"
end
9 changes: 7 additions & 2 deletions spec/dotsync/actions/pull_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
allow(logger).to receive(:action)
FileUtils.mkdir_p(mapping1.src)
FileUtils.mkdir_p(mapping1.dest)
File.write(File.join(mapping1.src, "file1"), "src content")
File.write(File.join(mapping1.dest, "file1"), "dest content")
File.write(mapping2.src, "#{mapping2.src} content")
File.write(mapping2.dest, "#{mapping2.dest} content")
end
Expand Down Expand Up @@ -84,14 +86,16 @@
])
expect_show_differences_legend
expect_show_differences([
{ text: "#{icon_diff_updated}/tmp/dotsync/dest/file2", color: color_diff_updated }
{ text: "#{icon_diff_updated}/tmp/dotsync/dest/file2", color: color_diff_updated },
{ text: "#{icon_diff_updated}/tmp/dotsync/dest/folder_dest/file1", color: color_diff_updated }
])

action.execute
end

context "without differences" do
before do
File.write(File.join(mapping1.dest, "file1"), "src content")
File.write(mapping2.dest, "#{mapping2.src} content")
end

Expand Down Expand Up @@ -126,7 +130,7 @@
end

it "displays confirmation prompt" do
expect(logger).to receive(:info).with("About to modify 1 file(s).", icon: :warning)
expect(logger).to receive(:info).with("About to modify 2 file(s).", icon: :warning)

action.execute(apply: true)
end
Expand Down Expand Up @@ -260,6 +264,7 @@
context "backup" do
context "without differences" do
before do
File.write(File.join(mapping1.dest, "file1"), "src content")
File.write(mapping2.src, "#{mapping2.src} content")
File.write(mapping2.dest, "#{mapping2.src} content")
end
Expand Down
8 changes: 5 additions & 3 deletions spec/dotsync/actions/push_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
allow(logger).to receive(:log)
allow(logger).to receive(:action)
FileUtils.mkdir_p(root)
FileUtils.touch(mapping1.src)
FileUtils.touch(mapping1.dest)
File.write(mapping1.src, "src1 content")
File.write(mapping1.dest, "dest1 content")
File.write(mapping2.src, "#{mapping2.src} content")
File.write(mapping2.dest, "#{mapping2.dest} content")
end
Expand Down Expand Up @@ -75,6 +75,7 @@
])
expect_show_differences_legend
expect_show_differences([
{ text: "#{icon_diff_updated}/tmp/dotsync/dest1", color: color_diff_updated },
{ text: "#{icon_diff_updated}/tmp/dotsync/dest2", color: color_diff_updated }
])

Expand All @@ -83,6 +84,7 @@

context "without differences" do
before do
File.write(mapping1.dest, "src1 content")
File.write(mapping2.dest, "#{mapping2.src} content")
end

Expand Down Expand Up @@ -126,7 +128,7 @@
end

it "displays confirmation prompt" do
expect(logger).to receive(:info).with("About to modify 1 file(s).", icon: :warning)
expect(logger).to receive(:info).with("About to modify 2 file(s).", icon: :warning)

action.execute(apply: true)
end
Expand Down
Loading