{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/watchman/issues/136","labels_url":"https://api.github.com/repos/facebook/watchman/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/facebook/watchman/issues/136/comments","events_url":"https://api.github.com/repos/facebook/watchman/issues/136/events","html_url":"https://github.com/facebook/watchman/pull/136","id":101711352,"number":136,"title":"introduce cmd_sync","user":{"login":"bmdhacks","id":1010987,"avatar_url":"https://avatars.githubusercontent.com/u/1010987?v=3","gravatar_id":"","url":"https://api.github.com/users/bmdhacks","html_url":"https://github.com/bmdhacks","followers_url":"https://api.github.com/users/bmdhacks/followers","following_url":"https://api.github.com/users/bmdhacks/following{/other_user}","gists_url":"https://api.github.com/users/bmdhacks/gists{/gist_id}","starred_url":"https://api.github.com/users/bmdhacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmdhacks/subscriptions","organizations_url":"https://api.github.com/users/bmdhacks/orgs","repos_url":"https://api.github.com/users/bmdhacks/repos","events_url":"https://api.github.com/users/bmdhacks/events{/privacy}","received_events_url":"https://api.github.com/users/bmdhacks/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/watchman/labels/CLA%20Signed","name":"CLA Signed","color":"009900"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-18T17:48:55Z","updated_at":"2015-08-18T19:12:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/watchman/pulls/136","html_url":"https://github.com/facebook/watchman/pull/136","diff_url":"https://github.com/facebook/watchman/pull/136.diff","patch_url":"https://github.com/facebook/watchman/pull/136.patch"},"body":"Problem\r\n\r\nWhen doing large changes to the filesystem with git, the amount of\r\nchanges received from the next watchman query take a long time to\r\ntransfer.  This is despite the fact that we know of all these changes\r\nsince we were the ones performing them.\r\n\r\nSolution\r\n\r\nAdd a 'sync' command which syncs the root and returns a clock\r\nrepresenting the current time.  This is effectively fast-forwarding all\r\nthe updates we just performed.\r\n\r\nNotes\r\n\r\nI wasn't sure if adding an extra command was preferable to just replacing\r\nclock's behavior, or adding arguments to clock."},"comment":{"url":"https://api.github.com/repos/facebook/watchman/issues/comments/132321612","html_url":"https://github.com/facebook/watchman/pull/136#issuecomment-132321612","issue_url":"https://api.github.com/repos/facebook/watchman/issues/136","id":132321612,"user":{"login":"bmdhacks","id":1010987,"avatar_url":"https://avatars.githubusercontent.com/u/1010987?v=3","gravatar_id":"","url":"https://api.github.com/users/bmdhacks","html_url":"https://github.com/bmdhacks","followers_url":"https://api.github.com/users/bmdhacks/followers","following_url":"https://api.github.com/users/bmdhacks/following{/other_user}","gists_url":"https://api.github.com/users/bmdhacks/gists{/gist_id}","starred_url":"https://api.github.com/users/bmdhacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmdhacks/subscriptions","organizations_url":"https://api.github.com/users/bmdhacks/orgs","repos_url":"https://api.github.com/users/bmdhacks/repos","events_url":"https://api.github.com/users/bmdhacks/events{/privacy}","received_events_url":"https://api.github.com/users/bmdhacks/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T19:12:27Z","updated_at":"2015-08-18T19:12:27Z","body":"Some bakground.  This is in the context of twitter's usage of watchman with git:\r\n\r\nWe've discovered a bug in OSX where big changesets confuse fsevents such that certain operations are not reported, but the flags are also not set indicating that something has been missed.  I can reproduce this by doing a git-pull over a years worth of the twitter repo, but I've been unable to separate it in a reproducible test-case that I can distribute.  I've confirmed with my own fsevents code that this is not a watchman bug.  It seems to be related to symlinks, and the fact that git creates symlinks before it creates the files they point to.\r\n\r\nFurthermore, when I do a big git-pull, it creates a huge list of changes that have to round-trip from:\r\ngit-pull --> OS --> fsevents --> watchman --> git-status\r\nThis is stupid since git knows the files it just changed (and is more accurate since the above OSX symlink bug may arise).  \r\n\r\nThe solution is to use this supplied 'sync' command to watchman, where we do a watchman 'since', record the state, write out the git files and record those, then 'sync' with watchman to get the proper clock.  This is better than a 'since' because we don't want to transfer the ton of changes that we already know about.\r\n\r\nHope that clarifies what I'm aiming for."}}