From 9cd810b4788fc786bb850a1d032068e4d3ddf870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marques?= Date: Thu, 21 Oct 2021 12:06:46 +0100 Subject: [PATCH] Package suggested git script with Python package --- README.rst | 15 ++------------- scripts/git | 8 ++++++++ setup.py | 1 + 3 files changed, 11 insertions(+), 13 deletions(-) create mode 100755 scripts/git diff --git a/README.rst b/README.rst index 90c007e..9ba3980 100644 --- a/README.rst +++ b/README.rst @@ -30,19 +30,8 @@ To upgrade git-autoshare at any time:: $ pipx upgrade git-autoshare -If you want ``git autoshare-clone`` to be invoked transparently in place of ``git clone``, -create the following bash script, name it ``git``, and place it in your ``PATH`` before ``/usr/bin/git``: - - .. code:: bash - - #!/bin/bash - if [ "$1" == "clone" ] - then - shift - /usr/bin/git autoshare-clone "$@" - else - /usr/bin/git "$@" - fi +This will also install a simple script to transparently replace your calls to ``git clone`` with calls to +``git autoshare-clone``. To enable it, set the `GIT_AUTOSHARE` variable in your shell to a positive value. Usage ~~~~~ diff --git a/scripts/git b/scripts/git new file mode 100755 index 0000000..fa73186 --- /dev/null +++ b/scripts/git @@ -0,0 +1,8 @@ +#!/bin/bash +if [[ "$GIT_AUTOSHARE" && "$1" == "clone" ]] +then + shift + /usr/bin/git autoshare-clone "$@" +else + /usr/bin/git "$@" +fi \ No newline at end of file diff --git a/setup.py b/setup.py index 4b6e074..23f447f 100644 --- a/setup.py +++ b/setup.py @@ -32,4 +32,5 @@ "git-autoshare-submodule-add=git_autoshare.submodule:add", ] }, + scripts=["scripts/git"] )