#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "config.h"
#include "builtin.h"
#include "exec-cmd.h"
#include "run-command.h"
#include "levenshtein.h"
#include "gettext.h"
#include "help.h"
#include "command-list.h"
#include "string-list.h"
#include "column.h"
#include "version.h"
#include "refs.h"
#include "parse-options.h"
#include "prompt.h"
#include "fsmonitor-ipc.h"
#include "repository.h"
#ifndef NO_CURL
#include "git-curl-compat.h"
#endif
struct category_description { … };
static uint32_t common_mask =
CAT_init | CAT_worktree | CAT_info |
CAT_history | CAT_remote;
static struct category_description common_categories[] = {
{ CAT_init, N_(…) },
{ CAT_worktree, N_(…) },
{ CAT_info, N_(…) },
{ CAT_history, N_(…) },
{ CAT_remote, N_(…) },
{ 0, NULL }
};
static struct category_description main_categories[] = {
{ CAT_mainporcelain, N_(…) },
{ CAT_ancillarymanipulators, N_(…) },
{ CAT_ancillaryinterrogators, N_(…) },
{ CAT_foreignscminterface, N_(…) },
{ CAT_plumbingmanipulators, N_(…) },
{ CAT_plumbinginterrogators, N_(…) },
{ CAT_synchingrepositories, N_(…) },
{ CAT_purehelpers, N_(…) },
{ CAT_userinterfaces, N_(…) },
{ CAT_developerinterfaces, N_(…) },
{ 0, NULL }
};
static const char *drop_prefix(const char *name, uint32_t category)
{ … }
static void extract_cmds(struct cmdname_help **p_cmds, uint32_t mask)
{ … }
static void print_command_list(const struct cmdname_help *cmds,
uint32_t mask, int longest)
{ … }
static int cmd_name_cmp(const void *elem1, const void *elem2)
{ … }
static void print_cmd_by_category(const struct category_description *catdesc,
int *longest_p)
{ … }
void add_cmdname(struct cmdnames *cmds, const char *name, int len)
{ … }
void cmdnames_release(struct cmdnames *cmds)
{ … }
static int cmdname_compare(const void *a_, const void *b_)
{ … }
static void uniq(struct cmdnames *cmds)
{ … }
void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
{ … }
static void pretty_print_cmdnames(struct cmdnames *cmds, unsigned int colopts)
{ … }
static void list_commands_in_dir(struct cmdnames *cmds,
const char *path,
const char *prefix)
{ … }
void load_command_list(const char *prefix,
struct cmdnames *main_cmds,
struct cmdnames *other_cmds)
{ … }
static int get_colopts(const char *var, const char *value,
const struct config_context *ctx UNUSED, void *data)
{ … }
void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
{ … }
void list_common_cmds_help(void)
{ … }
void list_all_main_cmds(struct string_list *list)
{ … }
void list_all_other_cmds(struct string_list *list)
{ … }
void list_cmds_by_category(struct string_list *list,
const char *cat)
{ … }
void list_cmds_by_config(struct string_list *list)
{ … }
void list_guides_help(void)
{ … }
void list_user_interfaces_help(void)
{ … }
void list_developer_interfaces_help(void)
{ … }
static int get_alias(const char *var, const char *value,
const struct config_context *ctx UNUSED, void *data)
{ … }
static void list_all_cmds_help_external_commands(void)
{ … }
static void list_all_cmds_help_aliases(int longest)
{ … }
void list_all_cmds_help(int show_external_commands, int show_aliases)
{ … }
int is_in_cmdlist(struct cmdnames *c, const char *s)
{ … }
static int autocorrect;
static struct cmdnames aliases;
#define AUTOCORRECT_PROMPT …
#define AUTOCORRECT_NEVER …
#define AUTOCORRECT_IMMEDIATELY …
static int git_unknown_cmd_config(const char *var, const char *value,
const struct config_context *ctx,
void *cb UNUSED)
{ … }
static int levenshtein_compare(const void *p1, const void *p2)
{ … }
static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)
{ … }
#define SIMILARITY_FLOOR …
#define SIMILAR_ENOUGH(x) …
static const char bad_interpreter_advice[] = …);
const char *help_unknown_cmd(const char *cmd)
{ … }
void get_version_info(struct strbuf *buf, int show_build_options)
{ … }
int cmd_version(int argc, const char **argv, const char *prefix, struct repository *repository UNUSED)
{ … }
struct similar_ref_cb { … };
static int append_similar_ref(const char *refname, const char *referent UNUSED,
const struct object_id *oid UNUSED,
int flags UNUSED, void *cb_data)
{ … }
static struct string_list guess_refs(const char *ref)
{ … }
NORETURN void help_unknown_ref(const char *ref, const char *cmd,
const char *error)
{ … }