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;
* 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);
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);
#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);
/* 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()`. */
* 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);
/* 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);
*/
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);
* 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;
#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.
*/
};
-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);
#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);
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,
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);
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 {