Generalize and libify index_is_dirty() to index_differs_from(...)