#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "abspath.h"
#include "copy.h"
#include "environment.h"
#include "exec-cmd.h"
#include "gettext.h"
#include "hex.h"
#include "object-file.h"
#include "object-name.h"
#include "refs.h"
#include "replace-object.h"
#include "repository.h"
#include "config.h"
#include "dir.h"
#include "setup.h"
#include "shallow.h"
#include "string-list.h"
#include "strvec.h"
#include "chdir-notify.h"
#include "path.h"
#include "quote.h"
#include "tmp-objdir.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h"
#include "exec-cmd.h"
static int inside_git_dir = …;
static int inside_work_tree = …;
static int work_tree_config_is_bogus;
enum allowed_bare_repo { … };
static struct startup_info the_startup_info;
struct startup_info *startup_info = …;
const char *tmp_original_cwd;
static int abspath_part_inside_repo(char *path)
{ … }
char *prefix_path_gently(const char *prefix, int len,
int *remaining_prefix, const char *path)
{ … }
char *prefix_path(const char *prefix, int len, const char *path)
{ … }
int path_inside_repo(const char *prefix, const char *path)
{ … }
int check_filename(const char *prefix, const char *arg)
{ … }
static void NORETURN die_verify_filename(struct repository *r,
const char *prefix,
const char *arg,
int diagnose_misspelt_rev)
{ … }
static int looks_like_pathspec(const char *arg)
{ … }
void verify_filename(const char *prefix,
const char *arg,
int diagnose_misspelt_rev)
{ … }
void verify_non_filename(const char *prefix, const char *arg)
{ … }
int get_common_dir(struct strbuf *sb, const char *gitdir)
{ … }
int get_common_dir_noenv(struct strbuf *sb, const char *gitdir)
{ … }
static int validate_headref(const char *path)
{ … }
int is_git_directory(const char *suspect)
{ … }
int is_nonbare_repository_dir(struct strbuf *path)
{ … }
int is_inside_git_dir(void)
{ … }
int is_inside_work_tree(void)
{ … }
void setup_work_tree(void)
{ … }
static void setup_original_cwd(void)
{ … }
static int read_worktree_config(const char *var, const char *value,
const struct config_context *ctx UNUSED,
void *vdata)
{ … }
enum extension_result { … };
static enum extension_result handle_extension_v0(const char *var,
const char *value,
const char *ext,
struct repository_format *data)
{ … }
static enum extension_result handle_extension(const char *var,
const char *value,
const char *ext,
struct repository_format *data)
{ … }
static int check_repo_format(const char *var, const char *value,
const struct config_context *ctx, void *vdata)
{ … }
static int check_repository_format_gently(const char *gitdir, struct repository_format *candidate, int *nongit_ok)
{ … }
int upgrade_repository_format(int target_version)
{ … }
static void init_repository_format(struct repository_format *format)
{ … }
int read_repository_format(struct repository_format *format, const char *path)
{ … }
void clear_repository_format(struct repository_format *format)
{ … }
int verify_repository_format(const struct repository_format *format,
struct strbuf *err)
{ … }
void read_gitfile_error_die(int error_code, const char *path, const char *dir)
{ … }
const char *read_gitfile_gently(const char *path, int *return_error_code)
{ … }
static const char *setup_explicit_git_dir(const char *gitdirenv,
struct strbuf *cwd,
struct repository_format *repo_fmt,
int *nongit_ok)
{ … }
static const char *setup_discovered_git_dir(const char *gitdir,
struct strbuf *cwd, int offset,
struct repository_format *repo_fmt,
int *nongit_ok)
{ … }
static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,
struct repository_format *repo_fmt,
int *nongit_ok)
{ … }
static dev_t get_device_or_die(const char *path, const char *prefix, int prefix_len)
{ … }
static int canonicalize_ceiling_entry(struct string_list_item *item,
void *cb_data)
{ … }
struct safe_directory_data { … };
static int safe_directory_cb(const char *key, const char *value,
const struct config_context *ctx UNUSED, void *d)
{ … }
static int ensure_valid_ownership(const char *gitfile,
const char *worktree, const char *gitdir,
struct strbuf *report)
{ … }
void die_upon_dubious_ownership(const char *gitfile, const char *worktree,
const char *gitdir)
{ … }
static int allowed_bare_repo_cb(const char *key, const char *value,
const struct config_context *ctx UNUSED,
void *d)
{ … }
static enum allowed_bare_repo get_allowed_bare_repo(void)
{ … }
static const char *allowed_bare_repo_to_string(
enum allowed_bare_repo allowed_bare_repo)
{ … }
static int is_implicit_bare_repo(const char *path)
{ … }
static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
struct strbuf *gitdir,
struct strbuf *report,
int die_on_error)
{ … }
enum discovery_result discover_git_directory_reason(struct strbuf *commondir,
struct strbuf *gitdir)
{ … }
void setup_git_env(const char *git_dir)
{ … }
static void set_git_dir_1(const char *path)
{ … }
static void update_relative_gitdir(const char *name UNUSED,
const char *old_cwd,
const char *new_cwd,
void *data UNUSED)
{ … }
void set_git_dir(const char *path, int make_realpath)
{ … }
static int git_work_tree_initialized;
void set_git_work_tree(const char *new_work_tree)
{ … }
const char *setup_git_directory_gently(int *nongit_ok)
{ … }
int git_config_perm(const char *var, const char *value)
{ … }
void check_repository_format(struct repository_format *fmt)
{ … }
const char *setup_git_directory(void)
{ … }
const char *resolve_gitdir_gently(const char *suspect, int *return_error_code)
{ … }
void sanitize_stdfds(void)
{ … }
int daemonize(void)
{ … }
struct template_dir_cb_data { … };
static int template_dir_cb(const char *key, const char *value,
const struct config_context *ctx UNUSED, void *d)
{ … }
const char *get_template_dir(const char *option_template)
{ … }
#ifdef NO_TRUSTABLE_FILEMODE
#define TEST_FILEMODE …
#else
#define TEST_FILEMODE …
#endif
#define GIT_DEFAULT_HASH_ENVIRONMENT …
static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
DIR *dir)
{ … }
static void copy_templates(const char *option_template)
{ … }
static int needs_work_tree_config(const char *git_dir, const char *work_tree)
{ … }
void initialize_repository_version(int hash_algo,
enum ref_storage_format ref_storage_format,
int reinit)
{ … }
static int is_reinit(void)
{ … }
void create_reference_database(enum ref_storage_format ref_storage_format,
const char *initial_branch, int quiet)
{ … }
static int create_default_files(const char *template_path,
const char *original_git_dir,
const struct repository_format *fmt,
int init_shared_repository)
{ … }
static void create_object_directory(void)
{ … }
static void separate_git_dir(const char *git_dir, const char *git_link)
{ … }
struct default_format_config { … };
static int read_default_format_config(const char *key, const char *value,
const struct config_context *ctx UNUSED,
void *payload)
{ … }
static void repository_format_configure(struct repository_format *repo_fmt,
int hash, enum ref_storage_format ref_format)
{ … }
int init_db(const char *git_dir, const char *real_git_dir,
const char *template_dir, int hash,
enum ref_storage_format ref_storage_format,
const char *initial_branch,
int init_shared_repository, unsigned int flags)
{ … }