]> rtime.felk.cvut.cz Git - sojka/duhome.git/blobdiff - duhome
Show correct information even after removing a home directory
[sojka/duhome.git] / duhome
diff --git a/duhome b/duhome
index 01310eb32d8e612b72a61575a02bf4a6db837c6d..09e8ff3d5a7c1270d679d279854ef13782561f44 100755 (executable)
--- a/duhome
+++ b/duhome
@@ -12,6 +12,7 @@ case "$1" in
        ;;
     save)
        cd $DATA
+       git rm '*' # Remove old data - perhaps, some homes were removed
        for i in /home/*; do
            du -shx $i | cut -f1 > ${i#/home/};
            git add ${i#/home/}
@@ -21,11 +22,14 @@ case "$1" in
        cd $DATA
        shift
        GIT_AUTHOR_NAME="$0" GIT_AUTHOR_EMAIL="$USER@$(hostname -f)" \
-           git commit -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
+           echo "$f:$(git show "HEAD:$f")"
+       done | sort -h -k2 -t:
        ;;
     log)
        cd $DATA