builtin/apply: make add_index_file() return -1 on error