diff options
author | Erich Eckner <git@eckner.net> | 2020-01-21 14:52:49 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-01-21 14:52:49 +0100 |
commit | fb21924922aece6b197165cf09e3a40b15fb4dbf (patch) | |
tree | 472c73d1c865c54a41a88466b902d61ed37e878b | |
parent | 403465ff419c5422f5e585267e8b4aa12f1777f9 (diff) | |
download | khal-extras-fb21924922aece6b197165cf09e3a40b15fb4dbf.tar.xz |
watch-calendars: do not cd
-rwxr-xr-x | watch-calendars | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/watch-calendars b/watch-calendars index cbae9be..e55e6b8 100755 --- a/watch-calendars +++ b/watch-calendars @@ -9,17 +9,12 @@ if [ $# -eq 0 ]; then exit $? fi -dir=$( - readlink -e "$1" -) - -cd "${dir}" || exit $? - -while [ -d "${dir}" ]; do - inotifywait -r . -e CREATE,MOVED_TO -t 30 +while [ -d "$1" ]; do + inotifywait -r "$1" -e CREATE,MOVED_TO -t 30 if [ $? -eq 0 ]; then - git commit -am'update by '"$(whoami)"'@'"$(hostname)"' on '"$(date)" + git -C "$1" add . + git -C "$1" commit -m'update by '"$(whoami)"'@'"$(hostname)"' on '"$(date)" fi - git pull --rebase - git push + git -C "$1" pull --rebase + git -C "$1" push done |