#!/bin/sh

EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
NEW_HEAD=$2

if git ls-tree -r -d $NEW_HEAD |awk '{print $3}'|grep -q $EMPTY_TREE; then
    echo >&2
    echo "WARNING: empty directories exist but are not tracked by git:" >&2
    echo >&2
    git ls-tree -r -d $NEW_HEAD|grep $EMPTY_TREE|awk '{print $4}' >&2
    echo >&2
    echo "These will silently disappear on commit, causing extraneous" >&2
    echo "unintended changes. See: LP: #1687057." >&2
    echo >&2
fi
