414
#define add_file_to_cache(path, flags) add_file_to_index(&the_index, (path), (flags))
415
#define chmod_cache_entry(ce, flip) chmod_index_entry(&the_index, (ce), (flip))
416
#define refresh_cache(flags) refresh_index(&the_index, (flags), NULL, NULL, NULL)
417
+#define refresh_and_write_cache(refresh_flags, write_flags, gentle) repo_refresh_and_write_index(the_repository, (refresh_flags), (write_flags), (gentle), NULL, NULL, NULL)
418
#define ce_match_stat(ce, st, options) ie_match_stat(&the_index, (ce), (st), (options))
419
#define ce_modified(ce, st, options) ie_modified(&the_index, (ce), (st), (options))
420
#define cache_dir_exists(name, namelen) index_dir_exists(&the_index, (name), (namelen))
813
#define REFRESH_IN_PORCELAIN 0x0020 /* user friendly output, not "needs update" */
814
#define REFRESH_PROGRESS 0x0040 /* show progress bar if stderr is tty */
815
int refresh_index(struct index_state *, unsigned int flags, const struct pathspec *pathspec, char *seen, const char *header_msg);
816
+/*
817
+ * Refresh the index and write it to disk.
818
+ *
819
+ * 'refresh_flags' is passed directly to 'refresh_index()', while
820
+ * 'COMMIT_LOCK | write_flags' is passed to 'write_locked_index()', so
821
+ * the lockfile is always either committed or rolled back.
822
+ *
823
+ * If 'gentle' is passed, errors locking the index are ignored.
824
+ *
825
+ * Return 1 if refreshing the index returns an error, -1 if writing
826
+ * the index to disk fails, 0 on success.
827
+ *
828
+ * Note that if refreshing the index returns an error, we still write
829
+ * out the index (unless locking fails).
830
+ */
831
+int repo_refresh_and_write_index(struct repository*, unsigned int refresh_flags, unsigned int write_flags, int gentle, const struct pathspec *, char *seen, const char *header_msg);
832
+
833
struct cache_entry *refresh_cache_entry(struct index_state *, struct cache_entry *, unsigned int);
834
835
void set_alternate_index_output(const char *);