#include "revision.h"
static const char builtin_add_usage[] =
-"git-add [-n] [-v] [-f] [--interactive | -i] [-u] [--] <filepattern>...";
+"git-add [-n] [-v] [-f] [--interactive | -i] [-u] [--refresh] [--] <filepattern>...";
static int take_worktree_changes;
static const char *excludes_file;
const char *path = p->one->path;
switch (p->status) {
default:
- die("unexpacted diff status %c", p->status);
+ die("unexpected diff status %c", p->status);
case DIFF_STATUS_UNMERGED:
case DIFF_STATUS_MODIFIED:
+ case DIFF_STATUS_TYPE_CHANGED:
add_file_to_cache(path, verbose);
break;
case DIFF_STATUS_DELETED:
remove_file_from_cache(path);
- cache_tree_invalidate_path(active_cache_tree, path);
if (verbose)
printf("remove '%s'\n", path);
break;
static struct lock_file lock_file;
-static const char ignore_warning[] =
+static const char ignore_error[] =
"The following paths are ignored by one of your .gitignore files:\n";
int cmd_add(int argc, const char **argv, const char *prefix)
die("index file corrupt");
if (dir.ignored_nr) {
- fprintf(stderr, ignore_warning);
+ fprintf(stderr, ignore_error);
for (i = 0; i < dir.ignored_nr; i++) {
fprintf(stderr, "%s\n", dir.ignored[i]->name);
}
fprintf(stderr, "Use -f if you really want to add them.\n");
- exit(1);
+ die("no files added");
}
for (i = 0; i < dir.nr; i++)