Skip to content
Snippets Groups Projects
Unverified Commit adc9aad3 authored by zoten's avatar zoten Committed by GitHub
Browse files

Restore "renamed" flag on file rename event (#68)

* Restore "renamed" flag on file rename event

* More granular events for file moves

See discussion [here](https://github.com/falood/file_system/issues/67

)

Co-authored-by: default avatarLuca Dei Zotti <luca.deizotti@athonet.com>
parent d62aed95
Branches
No related tags found
No related merge requests found
......@@ -157,9 +157,9 @@ defmodule FileSystem.Backends.FSInotify do
end
defp convert_flag("CREATE"), do: :created
defp convert_flag("MOVED_TO"), do: :created
defp convert_flag("MOVED_TO"), do: :moved_to
defp convert_flag("DELETE"), do: :deleted
defp convert_flag("MOVED_FROM"), do: :deleted
defp convert_flag("MOVED_FROM"), do: :moved_from
defp convert_flag("ISDIR"), do: :isdir
defp convert_flag("MODIFY"), do: :modified
defp convert_flag("CLOSE_WRITE"), do: :modified
......
......@@ -42,10 +42,15 @@ defmodule FileSystem.Backends.FSInotifyTest do
end
test "dir moved to" do
assert {"/one/two/file", [:created]} ==
assert {"/one/two/file", [:moved_to]} ==
~w|/one/two/ MOVED_TO file| |> to_port_line |> parse_line
end
test "dir moved from" do
assert {"/one/two/file", [:moved_from]} ==
~w|/one/two/ MOVED_FROM file| |> to_port_line |> parse_line
end
test "dir is_dir create" do
assert {"/one/two/dir", [:created, :isdir]} ==
~w|/one/two/ CREATE,ISDIR dir| |> to_port_line |> parse_line
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment