diff options
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c index 91b2628e3c..ebace34d05 100644 --- a/read-cache.c +++ b/read-cache.c @@ -9,9 +9,13 @@ const char *sha1_file_directory = NULL; struct cache_entry **active_cache = NULL; unsigned int active_nr = 0, active_alloc = 0; -void usage(const char *err) +void usage(const char *err, ...) { - fprintf(stderr, "read-tree: %s\n", err); + va_list args; + + va_start(args, err); + vfprintf(stderr, err, args); + va_end(args); exit(1); } @@ -294,7 +298,7 @@ int remove_file_from_cache(char *path) return 0; } -int add_cache_entry(struct cache_entry *ce) +int add_cache_entry(struct cache_entry *ce, int ok_to_add) { int pos; @@ -306,6 +310,9 @@ int add_cache_entry(struct cache_entry *ce) return 0; } + if (!ok_to_add) + return -1; + /* Make sure the array is big enough .. */ if (active_nr == active_alloc) { active_alloc = alloc_nr(active_alloc); |