Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimization in git clone using --depth #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docsite/rst/dev_guide/developing_modules_general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Due to dependencies (for example ansible -> paramiko -> pynacl -> libffi):
Common Environment setup
````````````````````````
1. Clone the Ansible repository:
``$ git clone https://github.com/ansible/ansible.git``
``$ git clone --depth 1 https://github.com/ansible/ansible.git``
2. Change directory into the repository root dir: ``$ cd ansible``
3. Create a virtual environment: ``$ python3 -m venv venv`` (or for
Python 2 ``$ virtualenv venv``. Note, this requires you to install
Expand Down
10 changes: 5 additions & 5 deletions docs/docsite/rst/dev_guide/developing_modules_general_OLD._rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Environment setup
=================

1. Clone the Ansible repository:
``$ git clone https://github.com/ansible/ansible.git``
``$ git clone --depth 1 https://github.com/ansible/ansible.git``
2. Change directory into the repository root dir: ``$ cd ansible``
3. Create a virtual environment: ``$ python3 -m venv venv`` (or for
Python 2 ``$ virtualenv venv``. Note, this requires you to install
Expand Down Expand Up @@ -357,7 +357,7 @@ Environment setup
=================

1. Clone the Ansible repository:
``$ git clone https://github.com/ansible/ansible.git``
``$ git clone --depth 1 https://github.com/ansible/ansible.git``
2. Change directory into the repository root dir: ``$ cd ansible``
3. Create a virtual environment: ``$ python3 -m venv venv`` (or for
Python 2 ``$ virtualenv venv``. Note, this requires you to install
Expand Down Expand Up @@ -670,7 +670,7 @@ Environment setup
=================

1. Clone the Ansible repository:
``$ git clone https://github.com/ansible/ansible.git``
``$ git clone --depth 1 https://github.com/ansible/ansible.git``
2. Change directory into the repository root dir: ``$ cd ansible``
3. Create a virtual environment: ``$ python3 -m venv venv`` (or for
Python 2 ``$ virtualenv venv``. Note, this requires you to install
Expand Down Expand Up @@ -983,7 +983,7 @@ Environment setup
=================

1. Clone the Ansible repository:
``$ git clone https://github.com/ansible/ansible.git``
``$ git clone --depth 1 https://github.com/ansible/ansible.git``
2. Change directory into the repository root dir: ``$ cd ansible``
3. Create a virtual environment: ``$ python3 -m venv venv`` (or for
Python 2 ``$ virtualenv venv``. Note, this requires you to install
Expand Down Expand Up @@ -1296,7 +1296,7 @@ Environment setup
=================

1. Clone the Ansible repository:
``$ git clone https://github.com/ansible/ansible.git``
``$ git clone --depth 1 https://github.com/ansible/ansible.git``
2. Change directory into the repository root dir: ``$ cd ansible``
3. Create a virtual environment: ``$ python3 -m venv venv`` (or for
Python 2 ``$ virtualenv venv``. Note, this requires you to install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ To provision the environment as is, run the following:

.. code-block:: shell

git clone https://github.com/jborean93/ansible-windows.git
git clone --depth 1 https://github.com/jborean93/ansible-windows.git
cd vagrant
vagrant up

Expand Down
2 changes: 1 addition & 1 deletion docs/docsite/rst/dev_guide/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Here's how:
Create a fresh area to work::


git clone https://github.com/ansible/ansible.git ansible-pr-testing
git clone --depth 1 https://github.com/ansible/ansible.git ansible-pr-testing
cd ansible-pr-testing

Next, find the pull request you'd like to test and make note of the line at the top which describes the source
Expand Down
4 changes: 2 additions & 2 deletions docs/docsite/rst/installation_guide/intro_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ You can also build an RPM yourself. From the root of a checkout or tarball, use

.. code-block:: bash

$ git clone https://github.com/ansible/ansible.git
$ git clone --depth 1 https://github.com/ansible/ansible.git
$ cd ./ansible
$ make rpm
$ sudo rpm -Uvh ./rpm-build/ansible-*.noarch.rpm
Expand Down Expand Up @@ -312,7 +312,7 @@ To install from source, clone the Ansible git repository:

.. code-block:: bash

$ git clone https://github.com/ansible/ansible.git --recursive
$ git clone --depth 1 https://github.com/ansible/ansible.git --recursive
$ cd ./ansible

Once git has cloned the Ansible repository, setup the Ansible environment:
Expand Down
2 changes: 1 addition & 1 deletion docs/docsite/rst/user_guide/windows_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ installed version and then clone the git repo.
.. code-block:: shell

pip uninstall ansible -y
git clone https://github.com/ansible/ansible.git
git clone --depth 1 https://github.com/ansible/ansible.git
source ansible/hacking/env-setup

# to enable Ansible on login, run the following
Expand Down
4 changes: 2 additions & 2 deletions lib/ansible/modules/source_control/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
version_added: "1.5"
reference:
description:
- Reference repository (see "git clone --reference ...")
- Reference repository (see "git clone --depth 1 --reference ...")
version_added: "1.4"
remote:
description:
Expand Down Expand Up @@ -832,7 +832,7 @@ def switch_version(git_path, module, dest, remote, version, verify_commit, depth
# FIXME check for local_branch first, should have been fetched already
if is_remote_branch(git_path, module, dest, remote, version):
if depth and not is_local_branch(git_path, module, dest, version):
# git clone --depth implies --single-branch, which makes
# git clone --depth 1 --depth implies --single-branch, which makes
# the checkout fail if the version changes
# fetch the remote branch, to be able to check it out next
set_remote_branch(git_path, module, dest, remote, version, depth)
Expand Down
4 changes: 2 additions & 2 deletions packaging/debian/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ __Note__: You must run this target as root or set `PBUILDER_BIN='sudo pbuilder'`

```
apt-get install python-docutils cdbs debootstrap devscripts make pbuilder python-setuptools
git clone https://github.com/ansible/ansible.git
git clone --depth 1 https://github.com/ansible/ansible.git
cd ansible
DEB_DIST='xenial trusty precise' make deb
```

Building in Docker:

```
git clone https://github.com/ansible/ansible.git
git clone --depth 1 https://github.com/ansible/ansible.git
cd ansible
docker build -t ansible-deb-builder -f packaging/debian/Dockerfile .
docker run --privileged -e DEB_DIST='trusty' -v $(pwd):/ansible ansible-deb-builder
Expand Down
2 changes: 1 addition & 1 deletion test/integration/targets/ansible-galaxy/runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ f_ansible_galaxy_status \
galaxy_testdir=$(mktemp -d)
pushd "${galaxy_testdir}"

git clone "${galaxy_local_test_role_git_repo}" "${galaxy_local_test_role}"
git clone --depth 1 "${galaxy_local_test_role_git_repo}" "${galaxy_local_test_role}"
ansible-galaxy init roles-path-bug
pushd roles-path-bug
cat <<EOF > ansible.cfg
Expand Down
2 changes: 1 addition & 1 deletion test/integration/targets/git/tasks/separate-git-dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
register: tempdir

- name: SEPARATE-GIT-DIR | clone with a separate git dir
command: git clone {{ repo_format1 }} {{ checkout_dir }} --separate-git-dir={{ tempdir.stdout }}
command: git clone --depth 1 {{ repo_format1 }} {{ checkout_dir }} --separate-git-dir={{ tempdir.stdout }}

- name: SEPARATE-GIT-DIR | update repo the usual way
git:
Expand Down