#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "advice.h"
#include "checkout.h"
#include "config.h"
#include "copy.h"
#include "dir.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-file.h"
#include "object-name.h"
#include "parse-options.h"
#include "path.h"
#include "strvec.h"
#include "branch.h"
#include "read-cache-ll.h"
#include "refs.h"
#include "remote.h"
#include "run-command.h"
#include "hook.h"
#include "sigchain.h"
#include "submodule.h"
#include "utf8.h"
#include "worktree.h"
#include "quote.h"
#define BUILTIN_WORKTREE_ADD_USAGE …
#define BUILTIN_WORKTREE_LIST_USAGE …
#define BUILTIN_WORKTREE_LOCK_USAGE …
#define BUILTIN_WORKTREE_MOVE_USAGE …
#define BUILTIN_WORKTREE_PRUNE_USAGE …
#define BUILTIN_WORKTREE_REMOVE_USAGE …
#define BUILTIN_WORKTREE_REPAIR_USAGE …
#define BUILTIN_WORKTREE_UNLOCK_USAGE …
#define WORKTREE_ADD_DWIM_ORPHAN_INFER_TEXT …
#define WORKTREE_ADD_ORPHAN_WITH_DASH_B_HINT_TEXT …
#define WORKTREE_ADD_ORPHAN_NO_DASH_B_HINT_TEXT …
static const char * const git_worktree_usage[] = …;
static const char * const git_worktree_add_usage[] = …;
static const char * const git_worktree_list_usage[] = …;
static const char * const git_worktree_lock_usage[] = …;
static const char * const git_worktree_move_usage[] = …;
static const char * const git_worktree_prune_usage[] = …;
static const char * const git_worktree_remove_usage[] = …;
static const char * const git_worktree_repair_usage[] = …;
static const char * const git_worktree_unlock_usage[] = …;
struct add_opts { … };
static int show_only;
static int verbose;
static int guess_remote;
static timestamp_t expire;
static int git_worktree_config(const char *var, const char *value,
const struct config_context *ctx, void *cb)
{ … }
static int delete_git_dir(const char *id)
{ … }
static void delete_worktrees_dir_if_empty(void)
{ … }
static void prune_worktree(const char *id, const char *reason)
{ … }
static int prune_cmp(const void *a, const void *b)
{ … }
static void prune_dups(struct string_list *l)
{ … }
static void prune_worktrees(void)
{ … }
static int prune(int ac, const char **av, const char *prefix)
{ … }
static char *junk_work_tree;
static char *junk_git_dir;
static int is_junk;
static pid_t junk_pid;
static void remove_junk(void)
{ … }
static void remove_junk_on_signal(int signo)
{ … }
static const char *worktree_basename(const char *path, int *olen)
{ … }
static void check_candidate_path(const char *path,
int force,
struct worktree **worktrees,
const char *cmd)
{ … }
static void copy_sparse_checkout(const char *worktree_git_dir)
{ … }
static void copy_filtered_worktree_config(const char *worktree_git_dir)
{ … }
static int checkout_worktree(const struct add_opts *opts,
struct strvec *child_env)
{ … }
static int make_worktree_orphan(const char * ref, const struct add_opts *opts,
struct strvec *child_env)
{ … }
static int add_worktree(const char *path, const char *refname,
const struct add_opts *opts)
{ … }
static void print_preparing_worktree_line(int detach,
const char *branch,
const char *new_branch,
int force_new_branch)
{ … }
static int first_valid_ref(const char *refname UNUSED,
const char *referent UNUSED,
const struct object_id *oid UNUSED,
int flags UNUSED,
void *cb_data UNUSED)
{ … }
static int can_use_local_refs(const struct add_opts *opts)
{ … }
static int can_use_remote_refs(const struct add_opts *opts)
{ … }
static int dwim_orphan(const struct add_opts *opts, int opt_track, int remote)
{ … }
static char *dwim_branch(const char *path, char **new_branch)
{ … }
static int add(int ac, const char **av, const char *prefix)
{ … }
static void show_worktree_porcelain(struct worktree *wt, int line_terminator)
{ … }
static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)
{ … }
static void measure_widths(struct worktree **wt, int *abbrev, int *maxlen)
{ … }
static int pathcmp(const void *a_, const void *b_)
{ … }
static void pathsort(struct worktree **wt)
{ … }
static int list(int ac, const char **av, const char *prefix)
{ … }
static int lock_worktree(int ac, const char **av, const char *prefix)
{ … }
static int unlock_worktree(int ac, const char **av, const char *prefix)
{ … }
static void validate_no_submodules(const struct worktree *wt)
{ … }
static int move_worktree(int ac, const char **av, const char *prefix)
{ … }
static void check_clean_worktree(struct worktree *wt,
const char *original_path)
{ … }
static int delete_git_work_tree(struct worktree *wt)
{ … }
static int remove_worktree(int ac, const char **av, const char *prefix)
{ … }
static void report_repair(int iserr, const char *path, const char *msg, void *cb_data)
{ … }
static int repair(int ac, const char **av, const char *prefix)
{ … }
int cmd_worktree(int ac,
const char **av,
const char *prefix,
struct repository *repo UNUSED)
{ … }