1
0
Fork 0

GIT_ADD_ARGS to -A instead of . & trailing whitespace

master
Felix 6 years ago
parent 61c1aacd7d
commit 3cee3b4089
  1. 10
      gitwatch.sh

@ -22,7 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#############################################################################
#
# Idea and original code taken from http://stackoverflow.com/a/965274
# Idea and original code taken from http://stackoverflow.com/a/965274
# (but heavily modified by now)
#
# Requires the command 'inotifywait' to be available, which is part of
@ -93,9 +93,9 @@ stderr () {
echo $1 >&2
}
while getopts b:d:hm:p:r:s: option # Process command line options
do
case "${option}" in
while getopts b:d:hm:p:r:s: option # Process command line options
do
case "${option}" in
b) BRANCH=${OPTARG};;
d) DATE_FMT=${OPTARG};;
h) shelp; exit;;
@ -132,7 +132,7 @@ IN=$(readlink -f "$1")
if [ -d $1 ]; then # if the target is a directory
TARGETDIR=$(sed -e "s/\/*$//" <<<"$IN") # dir to CD into before using git commands: trim trailing slash, if any
INCOMMAND="$INW --exclude=\"^${TARGETDIR}/.git\" -qqr -e close_write,move,delete,create $TARGETDIR" # construct inotifywait-commandline
GIT_ADD_ARGS="." # add "." (CWD) recursively to index
GIT_ADD_ARGS="-A" # add "." (CWD) recursively to index
GIT_COMMIT_ARGS="-a" # add -a switch to "commit" call just to be sure
elif [ -f $1 ]; then # if the target is a single file
TARGETDIR=$(dirname "$IN") # dir to CD into before using git commands: extract from file name

Loading…
Cancel
Save