Skip to content

Instantly share code, notes, and snippets.

@XVicarious
Created August 16, 2019 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XVicarious/5cbf3f8c3d68c0e5bd4efbf2da222426 to your computer and use it in GitHub Desktop.
Save XVicarious/5cbf3f8c3d68c0e5bd4efbf2da222426 to your computer and use it in GitHub Desktop.
for use with external versioning on syncthing.
#!/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
@XVicarious
Copy link
Author

i should note i didn't test this at all yet. I started running it live now, so we'll see what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment