Skip to content

Commit fd1c3bf

Browse files
author
Junio C Hamano
committed
Rename add_file_to_index() to add_file_to_cache()
This function was not called "add_file_to_cache()" only because an ancient program, update-cache, used that name as an internal function name that does something slightly different. Now that is gone, we can take over the better name. The plan is to name all functions that operate on the default index xxx_cache(). Later patches create a variant of them that take an explicit parameter xxx_index(), and then turn xxx_cache() functions into macros that use "the_index". Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7da3bf3 commit fd1c3bf

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

builtin-add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
205205
}
206206

207207
for (i = 0; i < dir.nr; i++)
208-
add_file_to_index(dir.entries[i]->name, verbose);
208+
add_file_to_cache(dir.entries[i]->name, verbose);
209209

210210
if (active_cache_changed) {
211211
if (write_cache(newfd, active_cache, active_nr) ||

builtin-mv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
273273

274274
for (i = 0; i < added.nr; i++) {
275275
const char *path = added.items[i].path;
276-
add_file_to_index(path, verbose);
276+
add_file_to_cache(path, verbose);
277277
}
278278

279279
for (i = 0; i < deleted.nr; i++) {

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ extern int add_cache_entry(struct cache_entry *ce, int option);
187187
extern struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really);
188188
extern int remove_cache_entry_at(int pos);
189189
extern int remove_file_from_cache(const char *path);
190-
extern int add_file_to_index(const char *path, int verbose);
190+
extern int add_file_to_cache(const char *path, int verbose);
191191
extern int ce_same_name(struct cache_entry *a, struct cache_entry *b);
192192
extern int ce_match_stat(struct cache_entry *ce, struct stat *st, int);
193193
extern int ce_modified(struct cache_entry *ce, struct stat *st, int);

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ int remove_file_from_cache(const char *path)
325325
return 0;
326326
}
327327

328-
int add_file_to_index(const char *path, int verbose)
328+
int add_file_to_cache(const char *path, int verbose)
329329
{
330330
int size, namelen;
331331
struct stat st;

0 commit comments

Comments
 (0)