Fix annoying bind; prompt for auto commit
This commit is contained in:
@@ -1,17 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#Scripts to detect and push changes if exist; Runs in Git direcories, called by GitDaemon script.
|
#Scripts to detect and push changes if exist; Runs in Git direcories, called by GitDaemon script.
|
||||||
source ~/.bash_profile > /dev/null
|
source ~/.zshrc > /dev/null 2>&1
|
||||||
source ~/.zshrc > /dev/null
|
#This system is opt in; only kick in if there's a .autocommit file.
|
||||||
#Exclude directories with the .noautocommit file;
|
if [[ -f .autocommit ]]; then
|
||||||
if [[ -f .autocommit ]]; then
|
|
||||||
if [[ -z $(git status | grep "nothing") ]]; then
|
if [[ -z $(git status | grep "nothing") ]]; then
|
||||||
#If working state is not clean - assume dirty directory
|
#If working state is not clean - assume dirty directory
|
||||||
echo "[git]: Directory $(pwd) has changes uncommited to git. Adding changes..."
|
echo "[git]: Directory $(pwd) has changes uncommited to git."
|
||||||
git add . -A #Adds only essentials via reverse gitignore
|
echo "Auto-Commit detected changes?"
|
||||||
echo "[git]: Committing changes..."
|
read COMMIT
|
||||||
git commit -m "Scripted commit - $(date)"
|
if [[ $COMMIT == "Y" ]] || [[ $COMMIT == "y" ]]; then
|
||||||
git push >/dev/null 2>&1
|
git add . -A #Adds only essentials via reverse gitignore
|
||||||
|
echo "[git]: Committing changes..."
|
||||||
|
git commit -m "Scripted commit - $(date)"
|
||||||
|
git push >/dev/null 2>&1
|
||||||
|
elif [[ $COMMIT == "N" ]] || [[ $COMMIT == "n" ]]; then
|
||||||
|
echo "[git]: Ignoring changes per user request."
|
||||||
|
fi
|
||||||
elif [[ -n $(git status | grep "nothing") ]]; then
|
elif [[ -n $(git status | grep "nothing") ]]; then
|
||||||
echo "[git]: Directory has no uncommited changes." > /dev/null
|
echo "[git]: Directory has no uncommited changes."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user