{"action":"created","comment":{"url":"https://api.github.com/repos/syncthing/syncthing/pulls/comments/63272367","id":63272367,"diff_hunk":"@@ -1243,18 +1243,65 @@ func (m *Model) updateLocals(folder string, fs []protocol.FileInfo) {\n \t\treturn\n \t}\n \tfiles.Update(protocol.LocalDeviceID, fs)\n-\n+\t\n \tfilenames := make([]string, len(fs))\n \tfor i, file := range fs {\n \t\tfilenames[i] = file.Name\n \t}\n-\n+\t\n \tevents.Default.Log(events.LocalIndexUpdated, map[string]interface{}{\n \t\t\"folder\":    folder,\n \t\t\"items\":     len(fs),\n \t\t\"filenames\": filenames,\n \t\t\"version\":   files.LocalVersion(protocol.LocalDeviceID),\n \t})\n+\t\n+\t// Lets us know if file/folder change was originated locally or from a network\n+\t// sync update.  Now write these to a global log file.\n+\tif remoteUpdate != true {\n+\t\tm.localDiskUpdate(m.folderCfgs[folder].Path(), fs)\n+\t}\n+}\n+\n+func (m *Model) localDiskUpdate(path string, files []protocol.FileInfo) {\n+\t// For windows paths, strip unwanted chars from the front\n+\tpath = strings.Replace(path, \"\\\\\\\\?\\\\\", \"\", 1) \n+\t\n+\tfor _, file := range files {\n+\t\tobjType := \"file\"\n+\t\taction := \"modified\"\n+\t\t\n+\t\tfor _, version := range file.Version {\n+\t\t\tif m.shortID == version.ID {\n+\t\t\t\t// If our local vector is verison 1 AND it is the only version vector so far seen for this file then\n+\t\t\t\t// it is a new file.  Else if it is > 1 it's not new, and if it is 1 but another shortId version vector\n+\t\t\t\t// exists then it is new for us but created elsewhere so the file is still not new but modified by us.\n+\t\t\t\t// Only if it is truely new do we change this to 'added', else we leave it as 'modified'.\n+\t\t\t\tif version.Value == 1 && len(file.Version) == 1 {\n+\t\t\t\t\taction = \"added\"\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}","path":"lib/model/model.go","position":null,"original_position":53,"commit_id":"460aa597e2c4a2f0997a11d9d0a1a8c0d4e1dbda","original_commit_id":"22e01fd3a8c398d96004273338a08d188eadff39","user":{"login":"AudriusButkevicius","id":1144861,"avatar_url":"https://avatars.githubusercontent.com/u/1144861?v=3","gravatar_id":"","url":"https://api.github.com/users/AudriusButkevicius","html_url":"https://github.com/AudriusButkevicius","followers_url":"https://api.github.com/users/AudriusButkevicius/followers","following_url":"https://api.github.com/users/AudriusButkevicius/following{/other_user}","gists_url":"https://api.github.com/users/AudriusButkevicius/gists{/gist_id}","starred_url":"https://api.github.com/users/AudriusButkevicius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudriusButkevicius/subscriptions","organizations_url":"https://api.github.com/users/AudriusButkevicius/orgs","repos_url":"https://api.github.com/users/AudriusButkevicius/repos","events_url":"https://api.github.com/users/AudriusButkevicius/events{/privacy}","received_events_url":"https://api.github.com/users/AudriusButkevicius/received_events","type":"User","site_admin":false},"body":"It's not a bug, thats how it works. File has IsDeleted() option, but you'd need the old old version of it from before the update to check that.","created_at":"2016-05-14T07:05:14Z","updated_at":"2016-05-14T07:05:14Z","html_url":"https://github.com/syncthing/syncthing/pull/3055#discussion_r63272367","pull_request_url":"https://api.github.com/repos/syncthing/syncthing/pulls/3055","_links":{"self":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/comments/63272367"},"html":{"href":"https://github.com/syncthing/syncthing/pull/3055#discussion_r63272367"},"pull_request":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/3055"}}},"pull_request":{"url":"https://api.github.com/repos/syncthing/syncthing/pulls/3055","id":69261499,"html_url":"https://github.com/syncthing/syncthing/pull/3055","diff_url":"https://github.com/syncthing/syncthing/pull/3055.diff","patch_url":"https://github.com/syncthing/syncthing/pull/3055.patch","issue_url":"https://api.github.com/repos/syncthing/syncthing/issues/3055","number":3055,"state":"open","locked":false,"title":"New file/folder modification log added","user":{"login":"nrm21","id":15898046,"avatar_url":"https://avatars.githubusercontent.com/u/15898046?v=3","gravatar_id":"","url":"https://api.github.com/users/nrm21","html_url":"https://github.com/nrm21","followers_url":"https://api.github.com/users/nrm21/followers","following_url":"https://api.github.com/users/nrm21/following{/other_user}","gists_url":"https://api.github.com/users/nrm21/gists{/gist_id}","starred_url":"https://api.github.com/users/nrm21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nrm21/subscriptions","organizations_url":"https://api.github.com/users/nrm21/orgs","repos_url":"https://api.github.com/users/nrm21/repos","events_url":"https://api.github.com/users/nrm21/events{/privacy}","received_events_url":"https://api.github.com/users/nrm21/received_events","type":"User","site_admin":false},"body":"### Purpose\r\n\r\nCurrently if a synced client makes a file change that clobbers or deletes data across all nodes, it can be hard to trace back to the offending client.  This can be troublesome if the event occurs repeatedly over time do to some external event that ST has no control over.\r\n\r\nThis feature adds a log file in the ST config dir called filemods.log.  This file contains a simple timestamped log entry of all file and folder changes (one per line) that were performed by THIS computer only (from local folder scan, not from network sync).  It purposefully IGNORES all file and folder changes made by other computers.\r\n\r\nIf desired, in later updates to the code a single \"global log\" of all changes could be made by merging the lines of text in each of these files if necessary.  However even now it makes it much easier for a human to trace what offending computer made a change be viewing each client's log individually.  There should be no duplicate logs since all clients record ONLY their own local changes.\r\n\r\n(Mostly) Satisfies issue #2860 \r\n\r\n### Testing\r\n\r\nCan be tested by adding deleting and changing files on this node and other nodes running same code.  Then checking each nodes 'filemods.log' to ensure that only changes that HE made are recorded.","created_at":"2016-05-08T06:00:34Z","updated_at":"2016-05-14T07:05:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1f1d38b81725f17bd3feb7f6482528060d7267e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/syncthing/syncthing/pulls/3055/commits","review_comments_url":"https://api.github.com/repos/syncthing/syncthing/pulls/3055/comments","review_comment_url":"https://api.github.com/repos/syncthing/syncthing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/syncthing/syncthing/issues/3055/comments","statuses_url":"https://api.github.com/repos/syncthing/syncthing/statuses/460aa597e2c4a2f0997a11d9d0a1a8c0d4e1dbda","head":{"label":"nrm21:globallog","ref":"globallog","sha":"460aa597e2c4a2f0997a11d9d0a1a8c0d4e1dbda","user":{"login":"nrm21","id":15898046,"avatar_url":"https://avatars.githubusercontent.com/u/15898046?v=3","gravatar_id":"","url":"https://api.github.com/users/nrm21","html_url":"https://github.com/nrm21","followers_url":"https://api.github.com/users/nrm21/followers","following_url":"https://api.github.com/users/nrm21/following{/other_user}","gists_url":"https://api.github.com/users/nrm21/gists{/gist_id}","starred_url":"https://api.github.com/users/nrm21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nrm21/subscriptions","organizations_url":"https://api.github.com/users/nrm21/orgs","repos_url":"https://api.github.com/users/nrm21/repos","events_url":"https://api.github.com/users/nrm21/events{/privacy}","received_events_url":"https://api.github.com/users/nrm21/received_events","type":"User","site_admin":false},"repo":{"id":47054512,"name":"syncthing","full_name":"nrm21/syncthing","owner":{"login":"nrm21","id":15898046,"avatar_url":"https://avatars.githubusercontent.com/u/15898046?v=3","gravatar_id":"","url":"https://api.github.com/users/nrm21","html_url":"https://github.com/nrm21","followers_url":"https://api.github.com/users/nrm21/followers","following_url":"https://api.github.com/users/nrm21/following{/other_user}","gists_url":"https://api.github.com/users/nrm21/gists{/gist_id}","starred_url":"https://api.github.com/users/nrm21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nrm21/subscriptions","organizations_url":"https://api.github.com/users/nrm21/orgs","repos_url":"https://api.github.com/users/nrm21/repos","events_url":"https://api.github.com/users/nrm21/events{/privacy}","received_events_url":"https://api.github.com/users/nrm21/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nrm21/syncthing","description":"Open Source Continuous File Synchronization","fork":true,"url":"https://api.github.com/repos/nrm21/syncthing","forks_url":"https://api.github.com/repos/nrm21/syncthing/forks","keys_url":"https://api.github.com/repos/nrm21/syncthing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nrm21/syncthing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nrm21/syncthing/teams","hooks_url":"https://api.github.com/repos/nrm21/syncthing/hooks","issue_events_url":"https://api.github.com/repos/nrm21/syncthing/issues/events{/number}","events_url":"https://api.github.com/repos/nrm21/syncthing/events","assignees_url":"https://api.github.com/repos/nrm21/syncthing/assignees{/user}","branches_url":"https://api.github.com/repos/nrm21/syncthing/branches{/branch}","tags_url":"https://api.github.com/repos/nrm21/syncthing/tags","blobs_url":"https://api.github.com/repos/nrm21/syncthing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nrm21/syncthing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nrm21/syncthing/git/refs{/sha}","trees_url":"https://api.github.com/repos/nrm21/syncthing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nrm21/syncthing/statuses/{sha}","languages_url":"https://api.github.com/repos/nrm21/syncthing/languages","stargazers_url":"https://api.github.com/repos/nrm21/syncthing/stargazers","contributors_url":"https://api.github.com/repos/nrm21/syncthing/contributors","subscribers_url":"https://api.github.com/repos/nrm21/syncthing/subscribers","subscription_url":"https://api.github.com/repos/nrm21/syncthing/subscription","commits_url":"https://api.github.com/repos/nrm21/syncthing/commits{/sha}","git_commits_url":"https://api.github.com/repos/nrm21/syncthing/git/commits{/sha}","comments_url":"https://api.github.com/repos/nrm21/syncthing/comments{/number}","issue_comment_url":"https://api.github.com/repos/nrm21/syncthing/issues/comments{/number}","contents_url":"https://api.github.com/repos/nrm21/syncthing/contents/{+path}","compare_url":"https://api.github.com/repos/nrm21/syncthing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nrm21/syncthing/merges","archive_url":"https://api.github.com/repos/nrm21/syncthing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nrm21/syncthing/downloads","issues_url":"https://api.github.com/repos/nrm21/syncthing/issues{/number}","pulls_url":"https://api.github.com/repos/nrm21/syncthing/pulls{/number}","milestones_url":"https://api.github.com/repos/nrm21/syncthing/milestones{/number}","notifications_url":"https://api.github.com/repos/nrm21/syncthing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nrm21/syncthing/labels{/name}","releases_url":"https://api.github.com/repos/nrm21/syncthing/releases{/id}","deployments_url":"https://api.github.com/repos/nrm21/syncthing/deployments","created_at":"2015-11-29T07:40:38Z","updated_at":"2016-04-10T18:31:48Z","pushed_at":"2016-05-14T04:13:54Z","git_url":"git://github.com/nrm21/syncthing.git","ssh_url":"git@github.com:nrm21/syncthing.git","clone_url":"https://github.com/nrm21/syncthing.git","svn_url":"https://github.com/nrm21/syncthing","homepage":"http://forum.syncthing.net/","size":69323,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"syncthing:master","ref":"master","sha":"5d2414dfa92cdcbcb55acb8b5d238482af964ec8","user":{"login":"syncthing","id":7628018,"avatar_url":"https://avatars.githubusercontent.com/u/7628018?v=3","gravatar_id":"","url":"https://api.github.com/users/syncthing","html_url":"https://github.com/syncthing","followers_url":"https://api.github.com/users/syncthing/followers","following_url":"https://api.github.com/users/syncthing/following{/other_user}","gists_url":"https://api.github.com/users/syncthing/gists{/gist_id}","starred_url":"https://api.github.com/users/syncthing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syncthing/subscriptions","organizations_url":"https://api.github.com/users/syncthing/orgs","repos_url":"https://api.github.com/users/syncthing/repos","events_url":"https://api.github.com/users/syncthing/events{/privacy}","received_events_url":"https://api.github.com/users/syncthing/received_events","type":"Organization","site_admin":false},"repo":{"id":14712850,"name":"syncthing","full_name":"syncthing/syncthing","owner":{"login":"syncthing","id":7628018,"avatar_url":"https://avatars.githubusercontent.com/u/7628018?v=3","gravatar_id":"","url":"https://api.github.com/users/syncthing","html_url":"https://github.com/syncthing","followers_url":"https://api.github.com/users/syncthing/followers","following_url":"https://api.github.com/users/syncthing/following{/other_user}","gists_url":"https://api.github.com/users/syncthing/gists{/gist_id}","starred_url":"https://api.github.com/users/syncthing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syncthing/subscriptions","organizations_url":"https://api.github.com/users/syncthing/orgs","repos_url":"https://api.github.com/users/syncthing/repos","events_url":"https://api.github.com/users/syncthing/events{/privacy}","received_events_url":"https://api.github.com/users/syncthing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/syncthing/syncthing","description":"Open Source Continuous File Synchronization","fork":false,"url":"https://api.github.com/repos/syncthing/syncthing","forks_url":"https://api.github.com/repos/syncthing/syncthing/forks","keys_url":"https://api.github.com/repos/syncthing/syncthing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/syncthing/syncthing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/syncthing/syncthing/teams","hooks_url":"https://api.github.com/repos/syncthing/syncthing/hooks","issue_events_url":"https://api.github.com/repos/syncthing/syncthing/issues/events{/number}","events_url":"https://api.github.com/repos/syncthing/syncthing/events","assignees_url":"https://api.github.com/repos/syncthing/syncthing/assignees{/user}","branches_url":"https://api.github.com/repos/syncthing/syncthing/branches{/branch}","tags_url":"https://api.github.com/repos/syncthing/syncthing/tags","blobs_url":"https://api.github.com/repos/syncthing/syncthing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/syncthing/syncthing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/syncthing/syncthing/git/refs{/sha}","trees_url":"https://api.github.com/repos/syncthing/syncthing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/syncthing/syncthing/statuses/{sha}","languages_url":"https://api.github.com/repos/syncthing/syncthing/languages","stargazers_url":"https://api.github.com/repos/syncthing/syncthing/stargazers","contributors_url":"https://api.github.com/repos/syncthing/syncthing/contributors","subscribers_url":"https://api.github.com/repos/syncthing/syncthing/subscribers","subscription_url":"https://api.github.com/repos/syncthing/syncthing/subscription","commits_url":"https://api.github.com/repos/syncthing/syncthing/commits{/sha}","git_commits_url":"https://api.github.com/repos/syncthing/syncthing/git/commits{/sha}","comments_url":"https://api.github.com/repos/syncthing/syncthing/comments{/number}","issue_comment_url":"https://api.github.com/repos/syncthing/syncthing/issues/comments{/number}","contents_url":"https://api.github.com/repos/syncthing/syncthing/contents/{+path}","compare_url":"https://api.github.com/repos/syncthing/syncthing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/syncthing/syncthing/merges","archive_url":"https://api.github.com/repos/syncthing/syncthing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/syncthing/syncthing/downloads","issues_url":"https://api.github.com/repos/syncthing/syncthing/issues{/number}","pulls_url":"https://api.github.com/repos/syncthing/syncthing/pulls{/number}","milestones_url":"https://api.github.com/repos/syncthing/syncthing/milestones{/number}","notifications_url":"https://api.github.com/repos/syncthing/syncthing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/syncthing/syncthing/labels{/name}","releases_url":"https://api.github.com/repos/syncthing/syncthing/releases{/id}","deployments_url":"https://api.github.com/repos/syncthing/syncthing/deployments","created_at":"2013-11-26T09:48:21Z","updated_at":"2016-05-14T04:55:46Z","pushed_at":"2016-05-14T06:03:07Z","git_url":"git://github.com/syncthing/syncthing.git","ssh_url":"git@github.com:syncthing/syncthing.git","clone_url":"https://github.com/syncthing/syncthing.git","svn_url":"https://github.com/syncthing/syncthing","homepage":"http://forum.syncthing.net/","size":111639,"stargazers_count":12149,"watchers_count":12149,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":931,"mirror_url":null,"open_issues_count":183,"forks":931,"open_issues":183,"watchers":12149,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/3055"},"html":{"href":"https://github.com/syncthing/syncthing/pull/3055"},"issue":{"href":"https://api.github.com/repos/syncthing/syncthing/issues/3055"},"comments":{"href":"https://api.github.com/repos/syncthing/syncthing/issues/3055/comments"},"review_comments":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/3055/comments"},"review_comment":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/3055/commits"},"statuses":{"href":"https://api.github.com/repos/syncthing/syncthing/statuses/460aa597e2c4a2f0997a11d9d0a1a8c0d4e1dbda"}}}}