summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c
index 5d967e8..ac9a8e7 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -472,7 +472,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
int pretend = flags & ADD_CACHE_PRETEND;
if (!S_ISREG(st_mode) && !S_ISLNK(st_mode) && !S_ISDIR(st_mode))
- die("%s: can only add regular files, symbolic links or git-directories", path);
+ return error("%s: can only add regular files, symbolic links or git-directories", path);
namelen = strlen(path);
if (S_ISDIR(st_mode)) {
@@ -507,7 +507,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
return 0;
}
if (index_path(ce->sha1, path, st, 1))
- die("unable to index file %s", path);
+ return error("unable to index file %s", path);
if (ignore_case && alias && different_name(ce, alias))
ce = create_alias_ce(ce, alias);
ce->ce_flags |= CE_ADDED;
@@ -521,7 +521,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
if (pretend)
;
else if (add_index_entry(istate, ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE))
- die("unable to add %s to index",path);
+ return error("unable to add %s to index",path);
if (verbose && !was_same)
printf("add '%s'\n", path);
return 0;
@@ -953,6 +953,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
int allow_unmerged = (flags & REFRESH_UNMERGED) != 0;
int quiet = (flags & REFRESH_QUIET) != 0;
int not_new = (flags & REFRESH_IGNORE_MISSING) != 0;
+ int ignore_submodules = (flags & REFRESH_IGNORE_SUBMODULES) != 0;
unsigned int options = really ? CE_MATCH_IGNORE_VALID : 0;
for (i = 0; i < istate->cache_nr; i++) {
@@ -960,6 +961,9 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
int cache_errno = 0;
ce = istate->cache[i];
+ if (ignore_submodules && S_ISGITLINK(ce->ce_mode))
+ continue;
+
if (ce_stage(ce)) {
while ((i < istate->cache_nr) &&
! strcmp(istate->cache[i]->name, ce->name))