Merge branch 'ar/add-unreadable'

* ar/add-unreadable:
  Add a config option to ignore errors for git-add
  Add a test for git-add --ignore-errors
  Add --ignore-errors to git-add to allow it to skip files with read errors
  Extend interface of add_files_to_cache to allow ignore indexing errors
  Make the exit code of add_file_to_index actually useful
This commit is contained in:
Junio C Hamano
2008-05-21 14:16:46 -07:00
8 changed files with 114 additions and 21 deletions

View File

@ -179,9 +179,10 @@ static void add_remove_files(struct path_list *list)
struct stat st;
struct path_list_item *p = &(list->items[i]);
if (!lstat(p->path, &st))
add_to_cache(p->path, &st, 0);
else
if (!lstat(p->path, &st)) {
if (add_to_cache(p->path, &st, 0))
die("updating files failed");
} else
remove_file_from_cache(p->path);
}
}
@ -246,7 +247,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
*/
if (all || (also && pathspec && *pathspec)) {
int fd = hold_locked_index(&index_lock, 1);
add_files_to_cache(0, also ? prefix : NULL, pathspec);
add_files_to_cache(also ? prefix : NULL, pathspec, 0);
refresh_cache(REFRESH_QUIET);
if (write_cache(fd, active_cache, active_nr) ||
close_lock_file(&index_lock))