Skip to main content

A git clone wrapper that automatically uses --reference to save time and space.

Project description

License: GPL-3 https://badge.fury.io/py/git-autoshare.svg https://travis-ci.org/acsone/git-autoshare.svg?branch=master https://codecov.io/gh/acsone/git-autoshare/branch/master/graph/badge.svg

A git clone wrapper that automatically uses –reference to save disk space and download time.

Installation

To install git-autoshare in a fancy way, we recommend using pipsi.

Pipsi is a powerful tool which allows you to install Python scripts into isolated virtual environments.

To install pipsi, first run this:

$ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python

Follow the instructions, you’ll have to update your PATH.

Then simply run:

$ pipsi install git-autoshare

To upgrade git-autoshare at any time:

$ pipsi upgrade git-autoshare

If you want git autoshare-clone to be invoked transparently in place of git clone, create the following bash script, name id git, and place it in your PATH before /usr/bin/git:

#!/bin/bash
if [ "$1" == "clone" ]
then
    shift
    /usr/bin/git autoshare-clone "$@"
else
    /usr/bin/git "$@"
fi

Usage

Configuration file

To configure it, create a file named git-autoshare/repos.yml in your user configuration directory (often ~/.config on Linux). This file must have the following structre:

host:
    repo:
        - organization
        - ...
    ...:
...:

It lists all git hosts, repositories, and organizations that are subject to the sharing of git objects. Here is an example:

github.com:
    odoo:
        - odoo
        - OCA
    mis-builder:
        - OCA
        - acsone

git autoshare-clone command

If configured like the example above, when you git clone the odoo or mis-builder repositories from one of these github organizations, git autoshare-clone will automatically insert the --reference option in the git clone command. For example:

$ git autoshare-clone https://github.com/odoo/odoo

will be transformed into:

$ /usr/bin/git clone --reference ~/.cache/git-autoshare/github.com/odoo https://github.com/odoo/odoo

git autoshare-prefetch command

The autoshare-prefetch command is mostly meant to be run in a cron job:

$ git autoshare-prefetch --quiet

will update the cache directory by fetching all repositories mentioned in repos.yml.

It can also prefetch one single repository, for example:

$ git autoshare-prefetch https://github.com/odoo/odoo.git

Environment variables

The cache directory is named git-autoshare where appdirs.user_cache_dir is. This location can be configured with the GIT_AUTOSHARE_CACHE_DIR environment variable.

The default configuration file is named repos.yml where appdirs.user_config_dir is. This location can be configured with the GIT_AUTOSHARE_CONFIG_DIR environment variable.

By default git-autoshare invokes git as /usr/bin/git. This can be configured with the GIT_AUTOSHARE_GIT_BIN environment variable.

Credits

Author:

Maintainer:

ACSONE SA/NV

This project is maintained by ACSONE SA/NV.

Changes

1.0.0a2 (2017-10-10)

  • first packaged version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git-autoshare-1.0.0a2.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

git_autoshare-1.0.0a2-py2.py3-none-any.whl (8.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file git-autoshare-1.0.0a2.tar.gz.

File metadata

File hashes

Hashes for git-autoshare-1.0.0a2.tar.gz
Algorithm Hash digest
SHA256 ef6e81db9317bbfdab814201ee97987c02701c1d880dc7f19c3c956b34692064
MD5 c912cd6302de7820ef048fc079fff30c
BLAKE2b-256 fd363111f9c38daac63abba551157d152d9f39c9b7fc2a6a6d1baf84cd0ef23a

See more details on using hashes here.

File details

Details for the file git_autoshare-1.0.0a2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for git_autoshare-1.0.0a2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4dd6cb0f70a4727f4c2a0f7fa0f0920a62e167fa6dbb16d7a874a0091c782460
MD5 cdf84aacae330153a13fb462c621589f
BLAKE2b-256 c7d48de45b9d144f2deba531c2219f308895c8e68e587ba32e9b6d22430f8e2f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page