]> rtime.felk.cvut.cz Git - sojka/duhome.git/commitdiff
Do not fail during initial status when there are no files
authorMichal Sojka <michal.sojka@cvut.cz>
Fri, 27 Jul 2018 13:08:08 +0000 (15:08 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 27 Jul 2018 13:08:08 +0000 (15:08 +0200)
duhome

diff --git a/duhome b/duhome
index fce4328d0a18c8055ca829e5397c859c1c316eaa..0102e98ec98012efc9339cb82eeb6fa63099bd51 100755 (executable)
--- a/duhome
+++ b/duhome
@@ -12,7 +12,9 @@ case "$1" in
        ;;
     save)
        cd $DATA
-       git rm --force --quiet '*' # Remove old data - perhaps, some homes were removed
+       if [ -n "$(git ls-files)" ]; then
+           git rm --force --quiet '*' # Remove old data - perhaps, some homes were removed
+       fi
        for i in /home/*; do
            du -shx $i | cut -f1 > ${i#/home/};
            git add ${i#/home/}