{"action":"created","issue":{"url":"https://api.github.com/repos/drone-plugins/drone-git/issues/14","labels_url":"https://api.github.com/repos/drone-plugins/drone-git/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/drone-plugins/drone-git/issues/14/comments","events_url":"https://api.github.com/repos/drone-plugins/drone-git/issues/14/events","html_url":"https://github.com/drone-plugins/drone-git/pull/14","id":124922414,"number":14,"title":"add \"complete\" param for non-shallow fetches","user":{"login":"sqs","id":1976,"avatar_url":"https://avatars.githubusercontent.com/u/1976?v=3","gravatar_id":"","url":"https://api.github.com/users/sqs","html_url":"https://github.com/sqs","followers_url":"https://api.github.com/users/sqs/followers","following_url":"https://api.github.com/users/sqs/following{/other_user}","gists_url":"https://api.github.com/users/sqs/gists{/gist_id}","starred_url":"https://api.github.com/users/sqs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqs/subscriptions","organizations_url":"https://api.github.com/users/sqs/orgs","repos_url":"https://api.github.com/users/sqs/repos","events_url":"https://api.github.com/users/sqs/events{/privacy}","received_events_url":"https://api.github.com/users/sqs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-05T09:01:17Z","updated_at":"2016-01-05T19:29:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/drone-plugins/drone-git/pulls/14","html_url":"https://github.com/drone-plugins/drone-git/pull/14","diff_url":"https://github.com/drone-plugins/drone-git/pull/14.diff","patch_url":"https://github.com/drone-plugins/drone-git/pull/14.patch"},"body":"Shallow fetches are more efficient, but sometimes you need all of the\r\nhistory. Setting a sufficiently large depth is not a good workaround for 2 reasons:\r\n\r\n1. Setting a large depth like 2345678 (which, let's say, is\r\n   effectively infinity) in the YAML actually fails with the following\r\n   error:\r\n\r\n   ```\r\n   panic: Unable to unarmshal vargs. json: cannot unmarshal number 2.345678e+06 into Go value of type int\r\n   ```\r\n\r\n2. All shallow clones require the usage of a temporary scratch\r\n   file/dir (in cgit), and they can't use the fast-path that full-history\r\n   clones use.\r\n\r\nThe reason you sometimes need all of the history is if you want to\r\nbuild a commit that's very old. For example, a commit that's the\r\n1000th-old commit on a branch would require a depth of 1000, but it's\r\nunlikely that the builder would know how many commits ago the commit\r\nwas. So, the builder would need to avoid using shallow clones\r\naltogether."},"comment":{"url":"https://api.github.com/repos/drone-plugins/drone-git/issues/comments/169104840","html_url":"https://github.com/drone-plugins/drone-git/pull/14#issuecomment-169104840","issue_url":"https://api.github.com/repos/drone-plugins/drone-git/issues/14","id":169104840,"user":{"login":"sqs","id":1976,"avatar_url":"https://avatars.githubusercontent.com/u/1976?v=3","gravatar_id":"","url":"https://api.github.com/users/sqs","html_url":"https://github.com/sqs","followers_url":"https://api.github.com/users/sqs/followers","following_url":"https://api.github.com/users/sqs/following{/other_user}","gists_url":"https://api.github.com/users/sqs/gists{/gist_id}","starred_url":"https://api.github.com/users/sqs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqs/subscriptions","organizations_url":"https://api.github.com/users/sqs/orgs","repos_url":"https://api.github.com/users/sqs/repos","events_url":"https://api.github.com/users/sqs/events{/privacy}","received_events_url":"https://api.github.com/users/sqs/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T19:29:13Z","updated_at":"2016-01-05T19:29:13Z","body":"@tboerger We are using drone-exec as a library not with drone/drone, and not everything has a refspec (individual commits not on any particular branch, for example). You are correct about drone/drone. \r\n\r\n@bradrydzewski: That would be fine for my use case. I don't think shallow clones save too much time on most repos, but you would know the use cases better. Also, the current scheme will make it impossible to build retroactively on a branch, or if a merge with more than 50 (by default) commits occurs in between creating the build and running drone-git. So it seems to me that shallow cloning should be an opt-in optimization but I defer to you obviously!"}}