merge(3p/git): Merge git subtree at v2.29.2
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because there is some breakage in the git build related to the netrc credentials helper which someone has taken care of in nixpkgs. The stable channel is not used for anything other than git, so this should be fine. Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
This commit is contained in:
parent
082c006c04
commit
f4609b896f
1485 changed files with 241535 additions and 109418 deletions
90
third_party/git/builtin/help.c
vendored
90
third_party/git/builtin/help.c
vendored
|
|
@ -8,6 +8,7 @@
|
|||
#include "parse-options.h"
|
||||
#include "run-command.h"
|
||||
#include "column.h"
|
||||
#include "config-list.h"
|
||||
#include "help.h"
|
||||
#include "alias.h"
|
||||
|
||||
|
|
@ -62,6 +63,91 @@ static const char * const builtin_help_usage[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
struct slot_expansion {
|
||||
const char *prefix;
|
||||
const char *placeholder;
|
||||
void (*fn)(struct string_list *list, const char *prefix);
|
||||
int found;
|
||||
};
|
||||
|
||||
static void list_config_help(int for_human)
|
||||
{
|
||||
struct slot_expansion slot_expansions[] = {
|
||||
{ "advice", "*", list_config_advices },
|
||||
{ "color.branch", "<slot>", list_config_color_branch_slots },
|
||||
{ "color.decorate", "<slot>", list_config_color_decorate_slots },
|
||||
{ "color.diff", "<slot>", list_config_color_diff_slots },
|
||||
{ "color.grep", "<slot>", list_config_color_grep_slots },
|
||||
{ "color.interactive", "<slot>", list_config_color_interactive_slots },
|
||||
{ "color.remote", "<slot>", list_config_color_sideband_slots },
|
||||
{ "color.status", "<slot>", list_config_color_status_slots },
|
||||
{ "fsck", "<msg-id>", list_config_fsck_msg_ids },
|
||||
{ "receive.fsck", "<msg-id>", list_config_fsck_msg_ids },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
const char **p;
|
||||
struct slot_expansion *e;
|
||||
struct string_list keys = STRING_LIST_INIT_DUP;
|
||||
int i;
|
||||
|
||||
for (p = config_name_list; *p; p++) {
|
||||
const char *var = *p;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
for (e = slot_expansions; e->prefix; e++) {
|
||||
|
||||
strbuf_reset(&sb);
|
||||
strbuf_addf(&sb, "%s.%s", e->prefix, e->placeholder);
|
||||
if (!strcasecmp(var, sb.buf)) {
|
||||
e->fn(&keys, e->prefix);
|
||||
e->found++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
strbuf_release(&sb);
|
||||
if (!e->prefix)
|
||||
string_list_append(&keys, var);
|
||||
}
|
||||
|
||||
for (e = slot_expansions; e->prefix; e++)
|
||||
if (!e->found)
|
||||
BUG("slot_expansion %s.%s is not used",
|
||||
e->prefix, e->placeholder);
|
||||
|
||||
string_list_sort(&keys);
|
||||
for (i = 0; i < keys.nr; i++) {
|
||||
const char *var = keys.items[i].string;
|
||||
const char *wildcard, *tag, *cut;
|
||||
|
||||
if (for_human) {
|
||||
puts(var);
|
||||
continue;
|
||||
}
|
||||
|
||||
wildcard = strchr(var, '*');
|
||||
tag = strchr(var, '<');
|
||||
|
||||
if (!wildcard && !tag) {
|
||||
puts(var);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wildcard && !tag)
|
||||
cut = wildcard;
|
||||
else if (!wildcard && tag)
|
||||
cut = tag;
|
||||
else
|
||||
cut = wildcard < tag ? wildcard : tag;
|
||||
|
||||
/*
|
||||
* We may produce duplicates, but that's up to
|
||||
* git-completion.bash to handle
|
||||
*/
|
||||
printf("%.*s\n", (int)(cut - var), var);
|
||||
}
|
||||
string_list_clear(&keys, 0);
|
||||
}
|
||||
|
||||
static enum help_format parse_help_format(const char *format)
|
||||
{
|
||||
if (!strcmp(format, "man"))
|
||||
|
|
@ -242,7 +328,7 @@ static int add_man_viewer_cmd(const char *name,
|
|||
static int add_man_viewer_info(const char *var, const char *value)
|
||||
{
|
||||
const char *name, *subkey;
|
||||
int namelen;
|
||||
size_t namelen;
|
||||
|
||||
if (parse_config_key(var, "man", &name, &namelen, &subkey) < 0 || !name)
|
||||
return 0;
|
||||
|
|
@ -493,7 +579,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
|
|||
}
|
||||
|
||||
if (show_guides)
|
||||
list_common_guides_help();
|
||||
list_guides_help();
|
||||
|
||||
if (show_all || show_guides) {
|
||||
printf("%s\n", _(git_more_info_string));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue