-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial fsmonitor
implementation
#362
Conversation
should_recurse: bool, | ||
} | ||
let repo_root = RepoPath::root(); | ||
let repo_root_pathbuf = repo_root.to_fs_path(&self.working_copy_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the same as self.working_copy_path.to_path_buf()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinvonz The working_copy_path
is relative here, so we won't be able to examine the file on disk without absolutizing it using to_fs_path
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it looks like we canonicalize the path in the "constructor" here:
Line 292 in a4a1481
working_copy_path: working_copy_path.canonicalize().unwrap(), |
let previous_clock = None; | ||
fsmonitor.query_changed_files(previous_clock).await | ||
}) | ||
.await |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never used async/await, so please forgive this possibly naive question. Why do we start an async task (with spawn()
, IIUC) if we're going to wait for it to finish here right away?
dir, | ||
disk_dir: repo_root_pathbuf.join(path), | ||
|
||
// FIXME: it's possible that we missed a `.gitignore` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can fix this by creating a FilesMatcher
from changed_files
and then intersect that with the sparse_matcher
. It's just that we don't have a simple way of intersecting matchers yet. However, I have one lying around from some unfinished work on making auto-add optional (#323). Let me send that and you can see if that helps. To clarify, the idea is to always create a single initial WorkItem
(thanks for creating a struct for that, btw) and use different matchers instead.
I plan to use this matcher for some future `jj add` command (for #323). The idea is that we'll do a path-restricted walk of the working copy based on the intersection of the sparse patterns and any patterns specified by the user. However, I think it will be useful before that, for @arxanas's fsmonitor feature (#362).
I plan to use this matcher for some future `jj add` command (for #323). The idea is that we'll do a path-restricted walk of the working copy based on the intersection of the sparse patterns and any patterns specified by the user. However, I think it will be useful before that, for @arxanas's fsmonitor feature (#362).
This identifies the directory as Watchman-enabled. Additional config settings can go in this file.
e2ada5c
to
bac43af
Compare
I'm not working on a large repository as part of my work anymore, so I haven't needed this. Might resurrect later. |
It might be a good idea to make a separate crate for
fsmonitor
, as it has some pretty heavyweight dependencies.