Created
August 16, 2019 04:39
-
-
Save XVicarious/5cbf3f8c3d68c0e5bd4efbf2da222426 to your computer and use it in GitHub Desktop.
for use with external versioning on syncthing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/env sh | |
set -eu | |
versions=~/.local/share/syncthing/git_versioning/ | |
if [[ ! -e $versions ]]; then | |
mkdir -p $versions | |
fi | |
pushd $1 | |
if [[ ! -e $versions/$1.git/ ]]; then | |
if [[ -e .stignore ]]; then | |
ln -sr .stignore .gitignore | |
echo ".gitignore" >> .stignore | |
else | |
echo ".gitignore" > .stignore | |
ln -sr .stignore .gitignore | |
fi | |
echo "$2" >> .stignore | |
git init --separate-git-dir $versions/$1.git/ | |
git add . | |
sed -i '$ d' .stignore | |
git commit -m "Initial commit" | |
fi | |
git add $1 | |
git commit -m "Updated $1" | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i should note i didn't test this at all yet. I started running it live now, so we'll see what happens.