{"action":"created","comment":{"url":"https://api.github.com/repos/odeke-em/drive/pulls/comments/41465132","id":41465132,"diff_hunk":"@@ -51,8 +52,47 @@ func (g *Commands) Pull(byId bool) error {\n \tcl, clashes, err := pullLikeResolve(g, byId)\n \n \tif len(clashes) >= 1 {\n-\t\twarnClashesPersist(g.log, clashes)\n-\t\treturn ErrClashesDetected\n+\t\tif g.opts.FixClashes {\n+\t\t\tg.log.Logln(\"Some clashes found\")\n+\t\t\tif g.opts.canPrompt() {\n+\t\t\t\tif !promptForChanges(\"Try fixing them [Y/N] ? \") {\n+\t\t\t\t\treturn ErrClashesDetected\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tsort.Sort(ByPath(clashes))\n+\n+\t\t\tlastPath := \"\"\n+\t\t\ti := 0\n+\t\t\tfor _, v := range clashes {\n+\t\t\t\tif v.Path != lastPath {\n+\t\t\t\t\tlastPath = v.Path\n+\t\t\t\t\ti = 2\n+\t\t\t\t\tcontinue\n+\t\t\t\t}\n+\n+\t\t\t\tvar newPath string\n+\t\t\t\tfor {\n+\t\t\t\t\text := filepath.Ext(v.Path)\n+\t\t\t\t\tname := strings.TrimSuffix(v.Path, ext)\n+\t\t\t\t\tnewPath = fmt.Sprintf(\"%v_%d%v\", name, i, ext)\n+\t\t\t\t\ti++\n+\n+\t\t\t\t\tvar dupCheck *File\n+\t\t\t\t\tdupCheck, err = g.rem.FindByPath(newPath)\n+\t\t\t\t\tif err != nil && dupCheck == nil {\n+\t\t\t\t\t\tnewPath = filepath.Base(newPath)\n+\t\t\t\t\t\tbreak\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\n+\t\t\t\tg.log.Logln(fmt.Sprintf(\"%v %v -> %v\", v.Path, v.Src.Id, newPath))\n+\t\t\t\tg.rem.rename(v.Src.Id, newPath)","path":"src/pull.go","position":48,"original_position":48,"commit_id":"7a9f2d971430aebacdf5c68a7005d87f4f6ddd0d","original_commit_id":"7a9f2d971430aebacdf5c68a7005d87f4f6ddd0d","user":{"login":"odeke-em","id":4898263,"avatar_url":"https://avatars.githubusercontent.com/u/4898263?v=3","gravatar_id":"","url":"https://api.github.com/users/odeke-em","html_url":"https://github.com/odeke-em","followers_url":"https://api.github.com/users/odeke-em/followers","following_url":"https://api.github.com/users/odeke-em/following{/other_user}","gists_url":"https://api.github.com/users/odeke-em/gists{/gist_id}","starred_url":"https://api.github.com/users/odeke-em/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odeke-em/subscriptions","organizations_url":"https://api.github.com/users/odeke-em/orgs","repos_url":"https://api.github.com/users/odeke-em/repos","events_url":"https://api.github.com/users/odeke-em/events{/privacy}","received_events_url":"https://api.github.com/users/odeke-em/received_events","type":"User","site_admin":false},"body":"```go\r\nif err := g.rem.rename(v.Src.Id, newPath); err != nil {\r\n    return err\r\n}\r\n```","created_at":"2015-10-08T00:29:07Z","updated_at":"2015-10-08T00:29:07Z","html_url":"https://github.com/odeke-em/drive/pull/418#discussion_r41465132","pull_request_url":"https://api.github.com/repos/odeke-em/drive/pulls/418","_links":{"self":{"href":"https://api.github.com/repos/odeke-em/drive/pulls/comments/41465132"},"html":{"href":"https://github.com/odeke-em/drive/pull/418#discussion_r41465132"},"pull_request":{"href":"https://api.github.com/repos/odeke-em/drive/pulls/418"}}},"pull_request":{"url":"https://api.github.com/repos/odeke-em/drive/pulls/418","id":47084720,"html_url":"https://github.com/odeke-em/drive/pull/418","diff_url":"https://github.com/odeke-em/drive/pull/418.diff","patch_url":"https://github.com/odeke-em/drive/pull/418.patch","issue_url":"https://api.github.com/repos/odeke-em/drive/issues/418","number":418,"state":"open","locked":false,"title":"fix-clashes [RFC]","user":{"login":"kadamski","id":11685,"avatar_url":"https://avatars.githubusercontent.com/u/11685?v=3","gravatar_id":"","url":"https://api.github.com/users/kadamski","html_url":"https://github.com/kadamski","followers_url":"https://api.github.com/users/kadamski/followers","following_url":"https://api.github.com/users/kadamski/following{/other_user}","gists_url":"https://api.github.com/users/kadamski/gists{/gist_id}","starred_url":"https://api.github.com/users/kadamski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadamski/subscriptions","organizations_url":"https://api.github.com/users/kadamski/orgs","repos_url":"https://api.github.com/users/kadamski/repos","events_url":"https://api.github.com/users/kadamski/events{/privacy}","received_events_url":"https://api.github.com/users/kadamski/received_events","type":"User","site_admin":false},"body":"This pull request is a draft. I would like to know if you are interested in implementing such a mechanism to automatically rename files on drive to prevent name clashes. Right now, if some clashes occur, user is advised to go to drive and resolve name conflicts before doing pull. While this is probably the safest option, I personally wouldn't bother when there is more than a few clashes. This functionality is racy and may not be safe but it does automate the task and I think may still be useful if users are properly warned. What do you think?\r\n\r\nI don't know neither code base nor Go so I'm aware that the code itself requires polishing.","created_at":"2015-10-07T21:29:38Z","updated_at":"2015-10-08T00:29:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"660099d71ec434e755808204b0298f8cb31aca60","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/odeke-em/drive/pulls/418/commits","review_comments_url":"https://api.github.com/repos/odeke-em/drive/pulls/418/comments","review_comment_url":"https://api.github.com/repos/odeke-em/drive/pulls/comments{/number}","comments_url":"https://api.github.com/repos/odeke-em/drive/issues/418/comments","statuses_url":"https://api.github.com/repos/odeke-em/drive/statuses/7a9f2d971430aebacdf5c68a7005d87f4f6ddd0d","head":{"label":"kadamski:fixclashes","ref":"fixclashes","sha":"7a9f2d971430aebacdf5c68a7005d87f4f6ddd0d","user":{"login":"kadamski","id":11685,"avatar_url":"https://avatars.githubusercontent.com/u/11685?v=3","gravatar_id":"","url":"https://api.github.com/users/kadamski","html_url":"https://github.com/kadamski","followers_url":"https://api.github.com/users/kadamski/followers","following_url":"https://api.github.com/users/kadamski/following{/other_user}","gists_url":"https://api.github.com/users/kadamski/gists{/gist_id}","starred_url":"https://api.github.com/users/kadamski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadamski/subscriptions","organizations_url":"https://api.github.com/users/kadamski/orgs","repos_url":"https://api.github.com/users/kadamski/repos","events_url":"https://api.github.com/users/kadamski/events{/privacy}","received_events_url":"https://api.github.com/users/kadamski/received_events","type":"User","site_admin":false},"repo":{"id":43845032,"name":"drive","full_name":"kadamski/drive","owner":{"login":"kadamski","id":11685,"avatar_url":"https://avatars.githubusercontent.com/u/11685?v=3","gravatar_id":"","url":"https://api.github.com/users/kadamski","html_url":"https://github.com/kadamski","followers_url":"https://api.github.com/users/kadamski/followers","following_url":"https://api.github.com/users/kadamski/following{/other_user}","gists_url":"https://api.github.com/users/kadamski/gists{/gist_id}","starred_url":"https://api.github.com/users/kadamski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadamski/subscriptions","organizations_url":"https://api.github.com/users/kadamski/orgs","repos_url":"https://api.github.com/users/kadamski/repos","events_url":"https://api.github.com/users/kadamski/events{/privacy}","received_events_url":"https://api.github.com/users/kadamski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kadamski/drive","description":"Google Drive client for the commandline","fork":true,"url":"https://api.github.com/repos/kadamski/drive","forks_url":"https://api.github.com/repos/kadamski/drive/forks","keys_url":"https://api.github.com/repos/kadamski/drive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kadamski/drive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kadamski/drive/teams","hooks_url":"https://api.github.com/repos/kadamski/drive/hooks","issue_events_url":"https://api.github.com/repos/kadamski/drive/issues/events{/number}","events_url":"https://api.github.com/repos/kadamski/drive/events","assignees_url":"https://api.github.com/repos/kadamski/drive/assignees{/user}","branches_url":"https://api.github.com/repos/kadamski/drive/branches{/branch}","tags_url":"https://api.github.com/repos/kadamski/drive/tags","blobs_url":"https://api.github.com/repos/kadamski/drive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kadamski/drive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kadamski/drive/git/refs{/sha}","trees_url":"https://api.github.com/repos/kadamski/drive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kadamski/drive/statuses/{sha}","languages_url":"https://api.github.com/repos/kadamski/drive/languages","stargazers_url":"https://api.github.com/repos/kadamski/drive/stargazers","contributors_url":"https://api.github.com/repos/kadamski/drive/contributors","subscribers_url":"https://api.github.com/repos/kadamski/drive/subscribers","subscription_url":"https://api.github.com/repos/kadamski/drive/subscription","commits_url":"https://api.github.com/repos/kadamski/drive/commits{/sha}","git_commits_url":"https://api.github.com/repos/kadamski/drive/git/commits{/sha}","comments_url":"https://api.github.com/repos/kadamski/drive/comments{/number}","issue_comment_url":"https://api.github.com/repos/kadamski/drive/issues/comments{/number}","contents_url":"https://api.github.com/repos/kadamski/drive/contents/{+path}","compare_url":"https://api.github.com/repos/kadamski/drive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kadamski/drive/merges","archive_url":"https://api.github.com/repos/kadamski/drive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kadamski/drive/downloads","issues_url":"https://api.github.com/repos/kadamski/drive/issues{/number}","pulls_url":"https://api.github.com/repos/kadamski/drive/pulls{/number}","milestones_url":"https://api.github.com/repos/kadamski/drive/milestones{/number}","notifications_url":"https://api.github.com/repos/kadamski/drive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kadamski/drive/labels{/name}","releases_url":"https://api.github.com/repos/kadamski/drive/releases{/id}","created_at":"2015-10-07T21:12:21Z","updated_at":"2015-10-07T21:12:22Z","pushed_at":"2015-10-07T21:21:17Z","git_url":"git://github.com/kadamski/drive.git","ssh_url":"git@github.com:kadamski/drive.git","clone_url":"https://github.com/kadamski/drive.git","svn_url":"https://github.com/kadamski/drive","homepage":"","size":5618,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"odeke-em:master","ref":"master","sha":"a08589a2613d7f8493ed357a2ae0b96e439c4d65","user":{"login":"odeke-em","id":4898263,"avatar_url":"https://avatars.githubusercontent.com/u/4898263?v=3","gravatar_id":"","url":"https://api.github.com/users/odeke-em","html_url":"https://github.com/odeke-em","followers_url":"https://api.github.com/users/odeke-em/followers","following_url":"https://api.github.com/users/odeke-em/following{/other_user}","gists_url":"https://api.github.com/users/odeke-em/gists{/gist_id}","starred_url":"https://api.github.com/users/odeke-em/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odeke-em/subscriptions","organizations_url":"https://api.github.com/users/odeke-em/orgs","repos_url":"https://api.github.com/users/odeke-em/repos","events_url":"https://api.github.com/users/odeke-em/events{/privacy}","received_events_url":"https://api.github.com/users/odeke-em/received_events","type":"User","site_admin":false},"repo":{"id":26109545,"name":"drive","full_name":"odeke-em/drive","owner":{"login":"odeke-em","id":4898263,"avatar_url":"https://avatars.githubusercontent.com/u/4898263?v=3","gravatar_id":"","url":"https://api.github.com/users/odeke-em","html_url":"https://github.com/odeke-em","followers_url":"https://api.github.com/users/odeke-em/followers","following_url":"https://api.github.com/users/odeke-em/following{/other_user}","gists_url":"https://api.github.com/users/odeke-em/gists{/gist_id}","starred_url":"https://api.github.com/users/odeke-em/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odeke-em/subscriptions","organizations_url":"https://api.github.com/users/odeke-em/orgs","repos_url":"https://api.github.com/users/odeke-em/repos","events_url":"https://api.github.com/users/odeke-em/events{/privacy}","received_events_url":"https://api.github.com/users/odeke-em/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/odeke-em/drive","description":"Google Drive client for the commandline","fork":true,"url":"https://api.github.com/repos/odeke-em/drive","forks_url":"https://api.github.com/repos/odeke-em/drive/forks","keys_url":"https://api.github.com/repos/odeke-em/drive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odeke-em/drive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odeke-em/drive/teams","hooks_url":"https://api.github.com/repos/odeke-em/drive/hooks","issue_events_url":"https://api.github.com/repos/odeke-em/drive/issues/events{/number}","events_url":"https://api.github.com/repos/odeke-em/drive/events","assignees_url":"https://api.github.com/repos/odeke-em/drive/assignees{/user}","branches_url":"https://api.github.com/repos/odeke-em/drive/branches{/branch}","tags_url":"https://api.github.com/repos/odeke-em/drive/tags","blobs_url":"https://api.github.com/repos/odeke-em/drive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odeke-em/drive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odeke-em/drive/git/refs{/sha}","trees_url":"https://api.github.com/repos/odeke-em/drive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odeke-em/drive/statuses/{sha}","languages_url":"https://api.github.com/repos/odeke-em/drive/languages","stargazers_url":"https://api.github.com/repos/odeke-em/drive/stargazers","contributors_url":"https://api.github.com/repos/odeke-em/drive/contributors","subscribers_url":"https://api.github.com/repos/odeke-em/drive/subscribers","subscription_url":"https://api.github.com/repos/odeke-em/drive/subscription","commits_url":"https://api.github.com/repos/odeke-em/drive/commits{/sha}","git_commits_url":"https://api.github.com/repos/odeke-em/drive/git/commits{/sha}","comments_url":"https://api.github.com/repos/odeke-em/drive/comments{/number}","issue_comment_url":"https://api.github.com/repos/odeke-em/drive/issues/comments{/number}","contents_url":"https://api.github.com/repos/odeke-em/drive/contents/{+path}","compare_url":"https://api.github.com/repos/odeke-em/drive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odeke-em/drive/merges","archive_url":"https://api.github.com/repos/odeke-em/drive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odeke-em/drive/downloads","issues_url":"https://api.github.com/repos/odeke-em/drive/issues{/number}","pulls_url":"https://api.github.com/repos/odeke-em/drive/pulls{/number}","milestones_url":"https://api.github.com/repos/odeke-em/drive/milestones{/number}","notifications_url":"https://api.github.com/repos/odeke-em/drive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odeke-em/drive/labels{/name}","releases_url":"https://api.github.com/repos/odeke-em/drive/releases{/id}","created_at":"2014-11-03T08:18:11Z","updated_at":"2015-10-07T22:26:35Z","pushed_at":"2015-10-07T21:29:38Z","git_url":"git://github.com/odeke-em/drive.git","ssh_url":"git@github.com:odeke-em/drive.git","clone_url":"https://github.com/odeke-em/drive.git","svn_url":"https://github.com/odeke-em/drive","homepage":"","size":5618,"stargazers_count":1319,"watchers_count":1319,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":105,"mirror_url":null,"open_issues_count":44,"forks":105,"open_issues":44,"watchers":1319,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/odeke-em/drive/pulls/418"},"html":{"href":"https://github.com/odeke-em/drive/pull/418"},"issue":{"href":"https://api.github.com/repos/odeke-em/drive/issues/418"},"comments":{"href":"https://api.github.com/repos/odeke-em/drive/issues/418/comments"},"review_comments":{"href":"https://api.github.com/repos/odeke-em/drive/pulls/418/comments"},"review_comment":{"href":"https://api.github.com/repos/odeke-em/drive/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/odeke-em/drive/pulls/418/commits"},"statuses":{"href":"https://api.github.com/repos/odeke-em/drive/statuses/7a9f2d971430aebacdf5c68a7005d87f4f6ddd0d"}}}}