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

Package suggested git script with Python package #15

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
15 changes: 2 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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, export `GIT_AUTOSHARE=1` in your shell.

Usage
~~~~~
Expand Down
8 changes: 8 additions & 0 deletions scripts/git
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
if [[ "$GIT_AUTOSHARE" == "1" && "$1" == "clone" ]]
then
shift
/usr/bin/git autoshare-clone "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to affect people with git in other paths.

Suggested change
/usr/bin/git autoshare-clone "$@"
"$0" autoshare-clone "$@"

else
/usr/bin/git "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/usr/bin/git "$@"
"$0" "$@"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work I am afraid, as $0 (git) will resolve to the current script and cause a loop...

Copy link

@Tardo Tardo Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe shomething like

Suggested change
/usr/bin/git "$@"
${GIT_BIN:-/usr/bin/git} "$@"

??

fi
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
"git-autoshare-submodule-add=git_autoshare.submodule:add",
]
},
scripts=["scripts/git"]
)