/usr/bin/git-sd is in sd 0.75-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #!/bin/sh
replica=$(git config --get sd.local-replica)
if [ -z "$replica" ]; then
gitdir=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$gitdir" ]; then
echo "Can't find a .git directory anywhere in your current directory"
echo "or any higher directories."
exit 1;
fi
# Special case: when in the toplevel directory, rev-parse --git-dir only
# returns '.git' instead of the full path.
if [ "$gitdir" = ".git" ]; then
gitdir="$(pwd)/.git"
fi
replica="$gitdir/sd"
echo "You don't appear to have an sd.local-replica defined in your .git/config"
echo "Setting it to '$replica':"
echo ""
echo " git config --add sd.local-replica $replica"
echo ""
git config --add sd.local-replica "$replica"
fi
if [ "$1" = "init" ] || [ "$1" = "clone" ] && [ "$2" != "-h" ] \
&& [ "$2" != "--help" ]; then
gitemail=$(git config --get user.email)
# It shouldn't happen very often that we're using init or clone from
# an already-existing db, but don't mess around with peoples' configs
# once they've already been created anyway.
if [ -n "$gitemail" ] && [ ! -e "$replica/config" ]; then
echo "Setting your SD email address to your git email:"
echo ""
echo " git config --get user.email"
if [ ! -d "$replica" ]; then
mkdir "$replica"
fi
echo " sd config user.email-address $gitemail"
echo ""
SD_REPO="$replica" sd config user.email-address "$gitemail"
fi
gitorigin=$(git config remote.origin.url 2>/dev/null)
if [ `echo $gitorigin | grep github` ]; then
echo "Cloning issues from $gitorigin:"
echo ""
echo " sd clone --from github:$gitorigin"
echo ""
SD_REPO="$replica" sd clone --from "github:$gitorigin"
fi
fi
SD_REPO="$replica" exec sd "$@"
|