{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4562","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4562/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4562/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4562/events","html_url":"https://github.com/ansible/ansible-modules-core/pull/4562","id":173507096,"number":4562,"title":"Speedup git module on clone and pull","user":{"login":"robinro","id":107032,"avatar_url":"https://avatars.githubusercontent.com/u/107032?v=3","gravatar_id":"","url":"https://api.github.com/users/robinro","html_url":"https://github.com/robinro","followers_url":"https://api.github.com/users/robinro/followers","following_url":"https://api.github.com/users/robinro/following{/other_user}","gists_url":"https://api.github.com/users/robinro/gists{/gist_id}","starred_url":"https://api.github.com/users/robinro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robinro/subscriptions","organizations_url":"https://api.github.com/users/robinro/orgs","repos_url":"https://api.github.com/users/robinro/repos","events_url":"https://api.github.com/users/robinro/events{/privacy}","received_events_url":"https://api.github.com/users/robinro/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/bugfix_pull_request","name":"bugfix_pull_request","color":"ded270"},{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/core_review","name":"core_review","color":"fad8c7"}],"state":"open","locked":false,"assignee":{"login":"alikins","id":15162,"avatar_url":"https://avatars.githubusercontent.com/u/15162?v=3","gravatar_id":"","url":"https://api.github.com/users/alikins","html_url":"https://github.com/alikins","followers_url":"https://api.github.com/users/alikins/followers","following_url":"https://api.github.com/users/alikins/following{/other_user}","gists_url":"https://api.github.com/users/alikins/gists{/gist_id}","starred_url":"https://api.github.com/users/alikins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alikins/subscriptions","organizations_url":"https://api.github.com/users/alikins/orgs","repos_url":"https://api.github.com/users/alikins/repos","events_url":"https://api.github.com/users/alikins/events{/privacy}","received_events_url":"https://api.github.com/users/alikins/received_events","type":"User","site_admin":false},"assignees":[{"login":"alikins","id":15162,"avatar_url":"https://avatars.githubusercontent.com/u/15162?v=3","gravatar_id":"","url":"https://api.github.com/users/alikins","html_url":"https://github.com/alikins","followers_url":"https://api.github.com/users/alikins/followers","following_url":"https://api.github.com/users/alikins/following{/other_user}","gists_url":"https://api.github.com/users/alikins/gists{/gist_id}","starred_url":"https://api.github.com/users/alikins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alikins/subscriptions","organizations_url":"https://api.github.com/users/alikins/orgs","repos_url":"https://api.github.com/users/alikins/repos","events_url":"https://api.github.com/users/alikins/events{/privacy}","received_events_url":"https://api.github.com/users/alikins/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/milestones/4","html_url":"https://github.com/ansible/ansible-modules-core/milestones/2.2.0","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/milestones/4/labels","id":1756290,"number":4,"title":"2.2.0","description":"","creator":{"login":"alikins","id":15162,"avatar_url":"https://avatars.githubusercontent.com/u/15162?v=3","gravatar_id":"","url":"https://api.github.com/users/alikins","html_url":"https://github.com/alikins","followers_url":"https://api.github.com/users/alikins/followers","following_url":"https://api.github.com/users/alikins/following{/other_user}","gists_url":"https://api.github.com/users/alikins/gists{/gist_id}","starred_url":"https://api.github.com/users/alikins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alikins/subscriptions","organizations_url":"https://api.github.com/users/alikins/orgs","repos_url":"https://api.github.com/users/alikins/repos","events_url":"https://api.github.com/users/alikins/events{/privacy}","received_events_url":"https://api.github.com/users/alikins/received_events","type":"User","site_admin":false},"open_issues":51,"closed_issues":65,"state":"open","created_at":"2016-05-09T19:02:33Z","updated_at":"2016-09-12T15:29:39Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-08-26T17:49:51Z","updated_at":"2016-09-12T16:16:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/4562","html_url":"https://github.com/ansible/ansible-modules-core/pull/4562","diff_url":"https://github.com/ansible/ansible-modules-core/pull/4562.diff","patch_url":"https://github.com/ansible/ansible-modules-core/pull/4562.patch"},"body":"##### ISSUE TYPE\r\n - Bugfix Pull Request\r\n\r\n##### COMPONENT NAME\r\nsource_control/git.py\r\n\r\n##### ANSIBLE VERSION\r\ndevel\r\n\r\n##### SUMMARY\r\nThis is based on the discussion in https://github.com/ansible/ansible-modules-core/issues/149 and https://github.com/ansible/ansible/issues/14501.\r\n\r\nThe git module does an unnecessary amount of communication with the git server on clone and pull. At least in trivial cases the data going over the network should be kept minimal. This PR reduces the number of calls to ls-remote for standard cases. It brings clone and pull very close to the raw git timings when cloning a repo without any arguments specified.\r\n\r\n##### Example Playbook\r\n```\r\n- hosts: localhost\r\n  tasks:\r\n    - name: ensure target is empty\r\n      file: name=/tmp/ansible.git state=absent\r\n\r\n    - name: SHELL clone repo\r\n      shell: git clone https://github.com/ansible/ansible-modules-core /tmp/ansible.git\r\n\r\n    - name: SHELL pull repo\r\n      shell: \r\n        cmd: git fetch --tags && git reset --hard origin/HEAD\r\n        chdir: /tmp/ansible.git\r\n\r\n    - name: ensure target is empty\r\n      file: name=/tmp/ansible.git state=absent\r\n\r\n    - name: MODULE clone repo\r\n      git:\r\n        repo: https://github.com/ansible/ansible-modules-core\r\n        dest: /tmp/ansible.git\r\n\r\n    - name: MODULE pull repo\r\n      git:\r\n        repo: https://github.com/ansible/ansible-modules-core\r\n        dest: /tmp/ansible.git\r\n\r\n    - name: ensure target is empty\r\n      file: name=/tmp/ansible.git state=absent\r\n\r\n    - name: MODULE-VERSION clone repo\r\n      git:\r\n        repo: https://github.com/ansible/ansible-modules-core\r\n        dest: /tmp/ansible.git\r\n        version: devel\r\n\r\n    - name: MODULE-VERSION pull repo\r\n      git:\r\n        repo: https://github.com/ansible/ansible-modules-core\r\n        dest: /tmp/ansible.git\r\n        version: devel\r\n```\r\n\r\n##### Output before:\r\n```\r\nMODULE-VERSION clone repo ----------------------------------------------- 4.21s\r\nMODULE clone repo ------------------------------------------------------- 4.36s\r\nSHELL clone repo -------------------------------------------------------- 2.56s\r\nMODULE-VERSION pull repo ------------------------------------------------ 5.49s\r\nMODULE pull repo -------------------------------------------------------- 1.10s\r\nSHELL pull repo --------------------------------------------------------- 1.01s\r\n```\r\n\r\n##### Output after:\r\n\r\n```\r\nMODULE-VERSION clone repo ----------------------------------------------- 3.23s\r\nMODULE clone repo ------------------------------------------------------- 2.72s\r\nSHELL clone repo -------------------------------------------------------- 2.49s\r\nMODULE-VERSION pull repo ------------------------------------------------ 1.88s\r\nMODULE pull repo -------------------------------------------------------- 1.05s\r\nSHELL pull repo --------------------------------------------------------- 1.04s\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/246401129","html_url":"https://github.com/ansible/ansible-modules-core/pull/4562#issuecomment-246401129","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4562","id":246401129,"user":{"login":"alikins","id":15162,"avatar_url":"https://avatars.githubusercontent.com/u/15162?v=3","gravatar_id":"","url":"https://api.github.com/users/alikins","html_url":"https://github.com/alikins","followers_url":"https://api.github.com/users/alikins/followers","following_url":"https://api.github.com/users/alikins/following{/other_user}","gists_url":"https://api.github.com/users/alikins/gists{/gist_id}","starred_url":"https://api.github.com/users/alikins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alikins/subscriptions","organizations_url":"https://api.github.com/users/alikins/orgs","repos_url":"https://api.github.com/users/alikins/repos","events_url":"https://api.github.com/users/alikins/events{/privacy}","received_events_url":"https://api.github.com/users/alikins/received_events","type":"User","site_admin":false},"created_at":"2016-09-12T16:16:13Z","updated_at":"2016-09-12T16:16:13Z","body":"A few example runs of old version new using the example playbook:\r\n\r\n```\r\nMonday 12 September 2016  11:40:32 -0400 (0:00:07.911)       0:00:39.340 ****** \r\n=============================================================================== \r\nMODULE-VERSION clone repo ---------------------------------------------- 15.51s\r\nMODULE-VERSION pull repo ------------------------------------------------ 7.91s\r\nMODULE clone repo ------------------------------------------------------- 6.32s\r\nSHELL clone repo -------------------------------------------------------- 4.01s\r\nMODULE pull repo -------------------------------------------------------- 3.80s\r\nSHELL pull repo --------------------------------------------------------- 0.64s\r\nsetup ------------------------------------------------------------------- 0.61s\r\nensure target is empty -------------------------------------------------- 0.23s\r\nensure target is empty -------------------------------------------------- 0.15s\r\nensure target is empty -------------------------------------------------- 0.14s\r\n\r\n\r\nMonday 12 September 2016  11:41:39 -0400 (0:00:04.168)       0:00:31.720 ****** \r\n=============================================================================== \r\nMODULE clone repo ------------------------------------------------------- 9.98s\r\nSHELL clone repo -------------------------------------------------------- 7.72s\r\nMODULE-VERSION clone repo ----------------------------------------------- 6.13s\r\nMODULE-VERSION pull repo ------------------------------------------------ 4.17s\r\nSHELL pull repo --------------------------------------------------------- 1.97s\r\nMODULE pull repo -------------------------------------------------------- 0.69s\r\nsetup ------------------------------------------------------------------- 0.56s\r\nensure target is empty -------------------------------------------------- 0.22s\r\nensure target is empty -------------------------------------------------- 0.14s\r\nensure target is empty -------------------------------------------------- 0.13s\r\n\r\n\r\nMonday 12 September 2016  11:42:54 -0400 (0:00:04.913)       0:00:28.121 ****** \r\n=============================================================================== \r\nMODULE-VERSION clone repo ----------------------------------------------- 8.37s\r\nSHELL clone repo -------------------------------------------------------- 5.97s\r\nMODULE clone repo ------------------------------------------------------- 5.48s\r\nMODULE-VERSION pull repo ------------------------------------------------ 4.91s\r\nSHELL pull repo --------------------------------------------------------- 1.04s\r\nMODULE pull repo -------------------------------------------------------- 1.00s\r\nsetup ------------------------------------------------------------------- 0.81s\r\nensure target is empty -------------------------------------------------- 0.22s\r\nensure target is empty -------------------------------------------------- 0.16s\r\nensure target is empty -------------------------------------------------- 0.14s\r\n\r\nMonday 12 September 2016  11:43:54 -0400 (0:00:04.971)       0:00:33.683 ****** \r\n=============================================================================== \r\nMODULE clone repo ------------------------------------------------------- 9.85s\r\nMODULE-VERSION clone repo ----------------------------------------------- 8.12s\r\nSHELL clone repo -------------------------------------------------------- 7.73s\r\nMODULE-VERSION pull repo ------------------------------------------------ 4.97s\r\nMODULE pull repo -------------------------------------------------------- 1.20s\r\nSHELL pull repo --------------------------------------------------------- 0.80s\r\nsetup ------------------------------------------------------------------- 0.47s\r\nensure target is empty -------------------------------------------------- 0.25s\r\nensure target is empty -------------------------------------------------- 0.14s\r\nensure target is empty -------------------------------------------------- 0.14s\r\n```\r\n\r\nAnd with the new version:\r\n```\r\nMonday 12 September 2016  11:47:36 -0400 (0:00:01.049)       0:00:23.053 ****** \r\n=============================================================================== \r\nSHELL clone repo -------------------------------------------------------- 7.01s\r\nMODULE-VERSION clone repo ----------------------------------------------- 6.12s\r\nMODULE clone repo ------------------------------------------------------- 5.73s\r\nMODULE-VERSION pull repo ------------------------------------------------ 1.05s\r\nSHELL pull repo --------------------------------------------------------- 1.04s\r\nsetup ------------------------------------------------------------------- 0.82s\r\nMODULE pull repo -------------------------------------------------------- 0.77s\r\nensure target is empty -------------------------------------------------- 0.23s\r\nensure target is empty -------------------------------------------------- 0.14s\r\nensure target is empty -------------------------------------------------- 0.13s\r\n\r\nMonday 12 September 2016  11:48:11 -0400 (0:00:05.910)       0:00:22.932 ****** \r\n=============================================================================== \r\nMODULE-VERSION clone repo ----------------------------------------------- 6.46s\r\nMODULE-VERSION pull repo ------------------------------------------------ 5.91s\r\nSHELL clone repo -------------------------------------------------------- 4.28s\r\nMODULE clone repo ------------------------------------------------------- 3.84s\r\nSHELL pull repo --------------------------------------------------------- 0.68s\r\nMODULE pull repo -------------------------------------------------------- 0.67s\r\nsetup ------------------------------------------------------------------- 0.58s\r\nensure target is empty -------------------------------------------------- 0.23s\r\nensure target is empty -------------------------------------------------- 0.14s\r\nensure target is empty -------------------------------------------------- 0.14s\r\n\r\nMonday 12 September 2016  11:49:26 -0400 (0:00:01.327)       0:00:24.266 ****** \r\n=============================================================================== \r\nSHELL clone repo -------------------------------------------------------- 6.36s\r\nMODULE clone repo ------------------------------------------------------- 6.27s\r\nMODULE-VERSION clone repo ----------------------------------------------- 6.18s\r\nSHELL pull repo --------------------------------------------------------- 1.95s\r\nMODULE-VERSION pull repo ------------------------------------------------ 1.33s\r\nMODULE pull repo -------------------------------------------------------- 1.10s\r\nsetup ------------------------------------------------------------------- 0.57s\r\nensure target is empty -------------------------------------------------- 0.23s\r\nensure target is empty -------------------------------------------------- 0.13s\r\nensure target is empty -------------------------------------------------- 0.13s\r\n```"}}
{"actor":{"display_login":"alikins"}}