]> git.ipfire.org Git - thirdparty/git.git/blobdiff - cache.h
Merge branch 'cc/list-objects-filter-wo-sparse-path'
[thirdparty/git.git] / cache.h
diff --git a/cache.h b/cache.h
index e21a10b3804de5c4a0ebfb8e9142f8ac48c1caa3..b4bb2e2c11adff0061065fa975874c7c4a2a318b 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -339,7 +339,10 @@ struct index_state {
        struct cache_time timestamp;
        unsigned name_hash_initialized : 1,
                 initialized : 1,
-                drop_cache_tree : 1;
+                drop_cache_tree : 1,
+                updated_workdir : 1,
+                updated_skipworktree : 1,
+                fsmonitor_has_run_once : 1;
        struct hashmap name_hash;
        struct hashmap dir_hash;
        struct object_id oid;
@@ -616,7 +619,7 @@ void setup_work_tree(void);
  * either 0 upon success and non-zero if no repository was found.
  */
 int discover_git_directory(struct strbuf *commondir,
-                                 struct strbuf *gitdir);
+                          struct strbuf *gitdir);
 const char *setup_git_directory_gently(int *);
 const char *setup_git_directory(void);
 char *prefix_path(const char *prefix, int len, const char *path);
@@ -636,8 +639,8 @@ char *prefix_filename(const char *prefix, const char *path);
 
 int check_filename(const char *prefix, const char *name);
 void verify_filename(const char *prefix,
-                           const char *name,
-                           int diagnose_misspelt_rev);
+                    const char *name,
+                    int diagnose_misspelt_rev);
 void verify_non_filename(const char *prefix, const char *name);
 int path_inside_repo(const char *prefix, const char *path);
 
@@ -645,7 +648,7 @@ int path_inside_repo(const char *prefix, const char *path);
 #define INIT_DB_EXIST_OK 0x0002
 
 int init_db(const char *git_dir, const char *real_git_dir,
-                  const char *template_dir, unsigned int flags);
+           const char *template_dir, unsigned int flags);
 
 void sanitize_stdfds(void);
 int daemonize(void);
@@ -673,12 +676,12 @@ int daemonize(void);
 /* Initialize and use the cache information */
 struct lock_file;
 void preload_index(struct index_state *index,
-                         const struct pathspec *pathspec,
-                         unsigned int refresh_flags);
+                  const struct pathspec *pathspec,
+                  unsigned int refresh_flags);
 int do_read_index(struct index_state *istate, const char *path,
-                        int must_exist); /* for testting only! */
+                 int must_exist); /* for testting only! */
 int read_index_from(struct index_state *, const char *path,
-                          const char *gitdir);
+                   const char *gitdir);
 int is_index_unborn(struct index_state *);
 
 /* For use with `write_locked_index()`. */
@@ -718,8 +721,8 @@ int unmerged_index(const struct index_state *);
  * to it.
  */
 int repo_index_has_changes(struct repository *repo,
-                                 struct tree *tree,
-                                 struct strbuf *sb);
+                          struct tree *tree,
+                          struct strbuf *sb);
 
 int verify_path(const char *path, unsigned mode);
 int strcmp_offset(const char *s1, const char *s2, size_t *first_change);
@@ -797,7 +800,7 @@ void *read_blob_data_from_index(const struct index_state *, const char *, unsign
 /* don't refresh_fsmonitor state or do stat comparison even if CE_FSMONITOR_VALID is true */
 #define CE_MATCH_IGNORE_FSMONITOR 0X20
 int is_racy_timestamp(const struct index_state *istate,
-                            const struct cache_entry *ce);
+                     const struct cache_entry *ce);
 int ie_match_stat(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
 int ie_modified(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
 
@@ -821,7 +824,7 @@ void fill_stat_data(struct stat_data *sd, struct stat *st);
  */
 int match_stat_data(const struct stat_data *sd, struct stat *st);
 int match_stat_data_racy(const struct index_state *istate,
-                               const struct stat_data *sd, struct stat *st);
+                        const struct stat_data *sd, struct stat *st);
 
 void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
 
@@ -1045,8 +1048,10 @@ void check_repository_format(void);
  * Note that while this version avoids the static buffer, it is not fully
  * reentrant, as it calls into other non-reentrant git code.
  */
-const char *find_unique_abbrev(const struct object_id *oid, int len);
-int find_unique_abbrev_r(char *hex, const struct object_id *oid, int len);
+const char *repo_find_unique_abbrev(struct repository *r, const struct object_id *oid, int len);
+#define find_unique_abbrev(oid, len) repo_find_unique_abbrev(the_repository, oid, len)
+int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);
+#define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)
 
 extern const unsigned char null_sha1[GIT_MAX_RAWSZ];
 extern const struct object_id null_oid;
@@ -1331,7 +1336,7 @@ static inline int hex2chr(const char *s)
 #define FALLBACK_DEFAULT_ABBREV 7
 
 struct object_context {
-       unsigned mode;
+       unsigned short mode;
        /*
         * symlink_path is only used by get_tree_entry_follow_symlinks,
         * and only for symlinks that point outside the repository.
@@ -1378,19 +1383,32 @@ enum get_oid_result {
                       */
 };
 
-int get_oid(const char *str, struct object_id *oid);
-int get_oid_commit(const char *str, struct object_id *oid);
-int get_oid_committish(const char *str, struct object_id *oid);
-int get_oid_tree(const char *str, struct object_id *oid);
-int get_oid_treeish(const char *str, struct object_id *oid);
-int get_oid_blob(const char *str, struct object_id *oid);
-void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
+int repo_get_oid(struct repository *r, const char *str, struct object_id *oid);
+int get_oidf(struct object_id *oid, const char *fmt, ...);
+int repo_get_oid_commit(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_committish(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_tree(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_treeish(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_blob(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_mb(struct repository *r, const char *str, struct object_id *oid);
+void maybe_die_on_misspelt_object_name(struct repository *repo,
+                                      const char *name,
+                                      const char *prefix);
 enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
-                               unsigned flags, struct object_id *oid,
-                               struct object_context *oc);
+                                        unsigned flags, struct object_id *oid,
+                                        struct object_context *oc);
+
+#define get_oid(str, oid)              repo_get_oid(the_repository, str, oid)
+#define get_oid_commit(str, oid)       repo_get_oid_commit(the_repository, str, oid)
+#define get_oid_committish(str, oid)   repo_get_oid_committish(the_repository, str, oid)
+#define get_oid_tree(str, oid)         repo_get_oid_tree(the_repository, str, oid)
+#define get_oid_treeish(str, oid)      repo_get_oid_treeish(the_repository, str, oid)
+#define get_oid_blob(str, oid)         repo_get_oid_blob(the_repository, str, oid)
+#define get_oid_mb(str, oid)           repo_get_oid_mb(the_repository, str, oid)
 
 typedef int each_abbrev_fn(const struct object_id *oid, void *);
-int for_each_abbrev(const char *prefix, each_abbrev_fn, void *);
+int repo_for_each_abbrev(struct repository *r, const char *prefix, each_abbrev_fn, void *);
+#define for_each_abbrev(prefix, fn, data) repo_for_each_abbrev(the_repository, prefix, fn, data)
 
 int set_disambiguate_hint_config(const char *var, const char *value);
 
@@ -1468,9 +1486,12 @@ int parse_oid_hex(const char *hex, struct object_id *oid, const char **end);
 #define INTERPRET_BRANCH_LOCAL (1<<0)
 #define INTERPRET_BRANCH_REMOTE (1<<1)
 #define INTERPRET_BRANCH_HEAD (1<<2)
-int interpret_branch_name(const char *str, int len, struct strbuf *,
-                                unsigned allowed);
-int get_oid_mb(const char *str, struct object_id *oid);
+int repo_interpret_branch_name(struct repository *r,
+                              const char *str, int len,
+                              struct strbuf *buf,
+                              unsigned allowed);
+#define interpret_branch_name(str, len, buf, allowed) \
+       repo_interpret_branch_name(the_repository, str, len, buf, allowed)
 
 int validate_headref(const char *ref);
 
@@ -1480,12 +1501,15 @@ int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)
 int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);
 
 void *read_object_with_reference(const struct object_id *oid,
-                                       const char *required_type,
-                                       unsigned long *size,
-                                       struct object_id *oid_ret);
+                                const char *required_type,
+                                unsigned long *size,
+                                struct object_id *oid_ret);
 
-struct object *peel_to_type(const char *name, int namelen,
-                                  struct object *o, enum object_type);
+struct object *repo_peel_to_type(struct repository *r,
+                                const char *name, int namelen,
+                                struct object *o, enum object_type);
+#define peel_to_type(name, namelen, obj, type) \
+       repo_peel_to_type(the_repository, name, namelen, obj, type)
 
 enum date_mode_type {
        DATE_NORMAL = 0,
@@ -1542,8 +1566,8 @@ enum want_ident {
 const char *git_author_info(int);
 const char *git_committer_info(int);
 const char *fmt_ident(const char *name, const char *email,
-               enum want_ident whose_ident,
-               const char *date_str, int);
+                     enum want_ident whose_ident,
+                     const char *date_str, int);
 const char *fmt_name(enum want_ident);
 const char *ident_default_name(void);
 const char *ident_default_email(void);
@@ -1552,6 +1576,10 @@ const char *git_sequence_editor(void);
 const char *git_pager(int stdout_is_tty);
 int is_terminal_dumb(void);
 int git_ident_config(const char *, const char *, void *);
+/*
+ * Prepare an ident to fall back on if the user didn't configure it.
+ */
+void prepare_fallback_ident(const char *name, const char *email);
 void reset_ident_date(void);
 
 struct ident_split {
@@ -1690,7 +1718,7 @@ extern const char *git_mailmap_blob;
 /* IO helper functions */
 void maybe_flush_or_die(FILE *, const char *);
 __attribute__((format (printf, 2, 3)))
-extern void fprintf_or_die(FILE *, const char *fmt, ...);
+void fprintf_or_die(FILE *, const char *fmt, ...);
 
 #define COPY_READ_ERROR (-2)
 #define COPY_WRITE_ERROR (-3)
@@ -1724,7 +1752,7 @@ void write_file_buf(const char *path, const char *buf, size_t len);
  *   write_file(path, "counter: %d", ctr);
  */
 __attribute__((format (printf, 2, 3)))
-extern void write_file(const char *path, const char *fmt, ...);
+void write_file(const char *path, const char *fmt, ...);
 
 /* pager.c */
 void setup_pager(void);