-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: master
Are you sure you want to change the base?
Conversation
The only idea I might have is to create a separate package with only the bash script and depend on it in an extra. But... meh. |
1f3c51f
to
9da8cd3
Compare
@sbidoul Maybe not the most elegant solution, but I just added the option to explicitly opt-in to the script replacement through a shell variable... |
9cd810b
to
79dab85
Compare
if [[ "$GIT_AUTOSHARE" == "1" && "$1" == "clone" ]] | ||
then | ||
shift | ||
/usr/bin/git autoshare-clone "$@" |
There was a problem hiding this comment.
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.
/usr/bin/git autoshare-clone "$@" | |
"$0" autoshare-clone "$@" |
shift | ||
/usr/bin/git autoshare-clone "$@" | ||
else | ||
/usr/bin/git "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/usr/bin/git "$@" | |
"$0" "$@" |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe shomething like
/usr/bin/git "$@" | |
${GIT_BIN:-/usr/bin/git} "$@" |
??
79dab85
to
e014d09
Compare
As suggested in acsone/git-aggregator#55
@sbidoul @yajo this solves the problem by using a pure Bash script. However, I still haven't found a way of making it optional on install... Any ideas?
Some notes on what was already explored:
git
command is not viable due to Python load times.setuptools
allows you to define optional commands to be insatalled, but AFAIK only throughentry_points
, which is only meant for Python modules.git clone
(git-clone
) as that would not introduce more delays thatautoshare
itself and it would only affect theclone
operation. However, even when I havegit-clone
in the path,git clone
still redirects to the normal command. I guess it is one of those subcommands that can't be replaced...@Tecnativa
TT32042