Add or update an index entry from a file in disk.
an existing index object
filename to add
stage for the entry
0 on success, otherwise an error code