]> rtime.felk.cvut.cz Git - sojka/duhome.git/blobdiff - duhome
Update changelog for 20180727b release
[sojka/duhome.git] / duhome
diff --git a/duhome b/duhome
index a50354791aa9b42ec63f28a4349a1c03ff4f3b26..588f6e4d5dbc3b09555dbf326a232eaebadea9e5 100755 (executable)
--- a/duhome
+++ b/duhome
@@ -12,6 +12,9 @@ case "$1" in
        ;;
     save)
        cd $DATA
+       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/}
@@ -21,11 +24,13 @@ case "$1" in
        cd $DATA
        shift
        GIT_AUTHOR_NAME="$0" GIT_AUTHOR_EMAIL="$USER@$(hostname -f)" \
-           git commit --quite -m 'Automatic commit' "$@" || :
+           git commit --quiet -m 'Automatic commit' "$@" > /dev/null || :
        ;;
     status)
        cd $DATA
-       grep . *|sort -h -k2 -t:
+       git ls-files --with-tree=HEAD | while read f; do
+           printf "%-8s\t%s\n" "$f" "$(git show "HEAD:$f")"
+       done | sort -h -k2
        ;;
     log)
        cd $DATA