{"action":"created","comment":{"url":"https://api.github.com/repos/syncthing/syncthing/pulls/comments/62968939","id":62968939,"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'.","path":"lib/model/model.go","position":48,"original_position":48,"commit_id":"22e01fd3a8c398d96004273338a08d188eadff39","original_commit_id":"22e01fd3a8c398d96004273338a08d188eadff39","user":{"login":"calmh","id":125426,"avatar_url":"https://avatars.githubusercontent.com/u/125426?v=3","gravatar_id":"","url":"https://api.github.com/users/calmh","html_url":"https://github.com/calmh","followers_url":"https://api.github.com/users/calmh/followers","following_url":"https://api.github.com/users/calmh/following{/other_user}","gists_url":"https://api.github.com/users/calmh/gists{/gist_id}","starred_url":"https://api.github.com/users/calmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calmh/subscriptions","organizations_url":"https://api.github.com/users/calmh/orgs","repos_url":"https://api.github.com/users/calmh/repos","events_url":"https://api.github.com/users/calmh/events{/privacy}","received_events_url":"https://api.github.com/users/calmh/received_events","type":"User","site_admin":false},"body":"\"truly\"","created_at":"2016-05-12T06:10:54Z","updated_at":"2016-05-12T06:10:54Z","html_url":"https://github.com/syncthing/syncthing/pull/3055#discussion_r62968939","pull_request_url":"https://api.github.com/repos/syncthing/syncthing/pulls/3055","_links":{"self":{"href":"https://api.github.com/repos/syncthing/syncthing/pulls/comments/62968939"},"html":{"href":"https://github.com/syncthing/syncthing/pull/3055#discussion_r62968939"},"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-12T06:10:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ef03df3a86c153f84180388bb8dd36d2974b7e30","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/22e01fd3a8c398d96004273338a08d188eadff39","head":{"label":"nrm21:globallog","ref":"globallog","sha":"22e01fd3a8c398d96004273338a08d188eadff39","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-12T02:04:45Z","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":69284,"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":"d628b731d1f7287905a613e903002d27f6635001","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-12T05:25:52Z","pushed_at":"2016-05-12T02:04:49Z","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":111601,"stargazers_count":12133,"watchers_count":12133,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":929,"mirror_url":null,"open_issues_count":182,"forks":929,"open_issues":182,"watchers":12133,"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/22e01fd3a8c398d96004273338a08d188eadff39"}}}}