Skip to content

Commit 20cf41d

Browse files
stefanbellergitster
authored andcommitted
cache.h: document add_[file_]to_index
Helped-by: Junio C Hamano <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3bd72ad commit 20cf41d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cache.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,18 @@ extern int remove_file_from_index(struct index_state *, const char *path);
614614
#define ADD_CACHE_IGNORE_ERRORS 4
615615
#define ADD_CACHE_IGNORE_REMOVAL 8
616616
#define ADD_CACHE_INTENT 16
617+
/*
618+
* These two are used to add the contents of the file at path
619+
* to the index, marking the working tree up-to-date by storing
620+
* the cached stat info in the resulting cache entry. A caller
621+
* that has already run lstat(2) on the path can call
622+
* add_to_index(), and all others can call add_file_to_index();
623+
* the latter will do necessary lstat(2) internally before
624+
* calling the former.
625+
*/
617626
extern int add_to_index(struct index_state *, const char *path, struct stat *, int flags);
618627
extern int add_file_to_index(struct index_state *, const char *path, int flags);
628+
619629
extern struct cache_entry *make_cache_entry(unsigned int mode, const unsigned char *sha1, const char *path, int stage, unsigned int refresh_options);
620630
extern int chmod_index_entry(struct index_state *, struct cache_entry *ce, char flip);
621631
extern int ce_same_name(const struct cache_entry *a, const struct cache_entry *b);

0 commit comments

Comments
 (0)