Skip to content

Commit d976c51

Browse files
avargitster
authored andcommitted
git docs: add a category for user-facing file, repo and command UX
Create a new "Repository, command and file interfaces" section in the main "git help git" manual page. Move things that belong under this new criteria from the generic "Guides" section. The "Guides" section was added in f442f28 (git.txt: add list of guides, 2020-08-05). It makes sense to have e.g. "giteveryday(7)" and "gitfaq(7)" listed under "Guides". But placing e.g. "gitignore(5)" in it is stretching the meaning of what a "guide" is, ideally that section should list things similar to "giteveryday(7)" and "gitcore-tutorial(7)". An alternate name that was considered for this new section was "User formats", for consistency with the nomenclature used for man section 5 in general. My man(1) lists it as "File formats and conventions, e.g. /etc/passwd". So calling this "git help --formats" or "git help --user-formats" would make sense for e.g. gitignore(5), but would be stretching it somewhat for githooks(5), and would seem really suspect for the likes of gitcli(7). Let's instead pick a name that's closer to the generic term "User interface", which is really what this documentation discusses: General user-interface documentation that doesn't obviously belong elsewhere. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dba1e53 commit d976c51

File tree

9 files changed

+70
-9
lines changed

9 files changed

+70
-9
lines changed

Documentation/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
290290
cmds-synchingrepositories.txt \
291291
cmds-synchelpers.txt \
292292
cmds-guide.txt \
293+
cmds-userinterfaces.txt \
293294
cmds-purehelpers.txt \
294295
cmds-foreignscminterface.txt
295296

Documentation/git-help.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ SYNOPSIS
1212
'git help' [[-i|--info] [-m|--man] [-w|--web]] [<command>|<doc>]
1313
'git help' [-g|--guides]
1414
'git help' [-c|--config]
15+
'git help' [--user-interfaces]
1516

1617
DESCRIPTION
1718
-----------
@@ -69,6 +70,19 @@ OPTIONS
6970
--guides::
7071
Prints a list of the Git concept guides on the standard output.
7172

73+
--user-interfaces::
74+
Prints a list of the repository, command and file interfaces
75+
documentation on the standard output.
76+
+
77+
In-repository file interfaces such as `.git/info/exclude` are
78+
documented here (see linkgit:gitrepository-layout[5]), as well as
79+
in-tree configuration such as `.mailmap` (see linkgit:gitmailmap[5]).
80+
+
81+
This section of the documentation also covers general or widespread
82+
user-interface conventions (e.g. linkgit:gitcli[7]), and
83+
pseudo-configuration such as the file-based `.git/hooks/*` interface
84+
described in linkgit:githooks[5].
85+
7286
-i::
7387
--info::
7488
Display manual page for the command in the 'info' format. The

Documentation/git.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,14 @@ The following documentation pages are guides about Git concepts.
339339

340340
include::cmds-guide.txt[]
341341

342+
Repository, command and file interfaces
343+
---------------------------------------
344+
345+
This documentation discusses repository and command interfaces which
346+
users are expected to interact with directly. See `--user-formats` in
347+
linkgit:git-help[1] for more details on the critera.
348+
349+
include::cmds-userinterfaces.txt[]
342350

343351
Configuration Mechanism
344352
-----------------------

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3532,6 +3532,7 @@ check-docs::
35323532
sed -e '1,/^### command list/d' \
35333533
-e '/^#/d' \
35343534
-e '/guide$$/d' \
3535+
-e '/interfaces$$/d' \
35353536
-e 's/[ ].*//' \
35363537
-e 's/^/listed /' command-list.txt; \
35373538
$(MAKE) -C Documentation print-man1 | \

builtin/help.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static enum help_action {
4343
HELP_ACTION_ALL = 1,
4444
HELP_ACTION_GUIDES,
4545
HELP_ACTION_CONFIG,
46+
HELP_ACTION_USER_INTERFACES,
4647
HELP_ACTION_CONFIG_FOR_COMPLETION,
4748
HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION,
4849
} cmd_mode;
@@ -69,6 +70,9 @@ static struct option builtin_help_options[] = {
6970

7071
OPT_CMDMODE('g', "guides", &cmd_mode, N_("print list of useful guides"),
7172
HELP_ACTION_GUIDES),
73+
OPT_CMDMODE(0, "user-interfaces", &cmd_mode,
74+
N_("print list of user-facing repository, command and file interfaces"),
75+
HELP_ACTION_USER_INTERFACES),
7276
OPT_CMDMODE('c', "config", &cmd_mode, N_("print all configuration variable names"),
7377
HELP_ACTION_CONFIG),
7478
OPT_CMDMODE_F(0, "config-for-completion", &cmd_mode, "",
@@ -84,6 +88,7 @@ static const char * const builtin_help_usage[] = {
8488
N_("git help [[-i|--info] [-m|--man] [-w|--web]] [<command>|<doc>]"),
8589
"git help [-g|--guides]",
8690
"git help [-c|--config]",
91+
"git help [--user-interfaces]",
8792
NULL
8893
};
8994

@@ -654,6 +659,10 @@ int cmd_help(int argc, const char **argv, const char *prefix)
654659
opt_mode_usage(argc, "--config-for-completion", help_format);
655660
list_config_help(SHOW_CONFIG_VARS);
656661
return 0;
662+
case HELP_ACTION_USER_INTERFACES:
663+
opt_mode_usage(argc, "--user-interfaces", help_format);
664+
list_user_interfaces_help();
665+
return 0;
657666
case HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION:
658667
opt_mode_usage(argc, "--config-sections-for-completion",
659668
help_format);

command-list.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
# specified here, which can only have "guide" attribute and nothing
4444
# else.
4545
#
46+
# User-facing repository, command and file interfaces such as
47+
# documentation for the .gitmodules, .mailmap etc. files lives in man
48+
# sections 5 and 7. These entries can only have the "userinterfaces"
49+
# attribute and nothing else.
50+
#
4651
### command list (do not change this line)
4752
# command name category [category] [category]
4853
git-add mainporcelain worktree
@@ -192,24 +197,24 @@ git-verify-tag ancillaryinterrogators
192197
git-whatchanged ancillaryinterrogators complete
193198
git-worktree mainporcelain
194199
git-write-tree plumbingmanipulators
195-
gitattributes guide
196-
gitcli guide
200+
gitattributes userinterfaces
201+
gitcli userinterfaces
197202
gitcore-tutorial guide
198203
gitcredentials guide
199204
gitcvs-migration guide
200205
gitdiffcore guide
201206
giteveryday guide
202207
gitfaq guide
203208
gitglossary guide
204-
githooks guide
205-
gitignore guide
209+
githooks userinterfaces
210+
gitignore userinterfaces
206211
gitk mainporcelain
207-
gitmailmap guide
208-
gitmodules guide
212+
gitmailmap userinterfaces
213+
gitmodules userinterfaces
209214
gitnamespaces guide
210215
gitremote-helpers guide
211-
gitrepository-layout guide
212-
gitrevisions guide
216+
gitrepository-layout userinterfaces
217+
gitrevisions userinterfaces
213218
gitsubmodules guide
214219
gittutorial guide
215220
gittutorial-2 guide

help.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static struct category_description main_categories[] = {
3838
{ CAT_plumbinginterrogators, N_("Low-level Commands / Interrogators") },
3939
{ CAT_synchingrepositories, N_("Low-level Commands / Syncing Repositories") },
4040
{ CAT_purehelpers, N_("Low-level Commands / Internal Helpers") },
41+
{ CAT_userinterfaces, N_("User-facing repository, command and file interfaces") },
4142
{ 0, NULL }
4243
};
4344

@@ -48,6 +49,7 @@ static const char *drop_prefix(const char *name, uint32_t category)
4849

4950
switch (category) {
5051
case CAT_guide:
52+
case CAT_userinterfaces:
5153
prefix = "git";
5254
break;
5355
default:
@@ -433,6 +435,16 @@ void list_guides_help(void)
433435
putchar('\n');
434436
}
435437

438+
void list_user_interfaces_help(void)
439+
{
440+
struct category_description catdesc[] = {
441+
{ CAT_userinterfaces, N_("User-facing repository, command and file interfaces:") },
442+
{ 0, NULL }
443+
};
444+
print_cmd_by_category(catdesc, NULL);
445+
putchar('\n');
446+
}
447+
436448
static int get_alias(const char *var, const char *value, void *data)
437449
{
438450
struct string_list *list = data;

help.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static inline void mput_char(char c, unsigned int num)
2222
void list_common_cmds_help(void);
2323
void list_all_cmds_help(int show_external_commands, int show_aliases);
2424
void list_guides_help(void);
25+
void list_user_interfaces_help(void);
2526

2627
void list_all_main_cmds(struct string_list *list);
2728
void list_all_other_cmds(struct string_list *list);

t/t0012-help.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ test_expect_success 'invalid usage' '
4444
test_expect_code 129 git help -g add &&
4545
test_expect_code 129 git help -a -g &&
4646
47+
test_expect_code 129 git help --user-interfaces add &&
48+
4749
test_expect_code 129 git help -g -c &&
4850
test_expect_code 129 git help --config-for-completion add &&
4951
test_expect_code 129 git help --config-sections-for-completion add
@@ -104,9 +106,9 @@ test_expect_success 'git help' '
104106
test_i18ngrep "^ commit " help.output &&
105107
test_i18ngrep "^ fetch " help.output
106108
'
109+
107110
test_expect_success 'git help -g' '
108111
git help -g >help.output &&
109-
test_i18ngrep "^ attributes " help.output &&
110112
test_i18ngrep "^ everyday " help.output &&
111113
test_i18ngrep "^ tutorial " help.output
112114
'
@@ -127,6 +129,12 @@ test_expect_success 'git help succeeds without git.html' '
127129
test_cmp expect test-browser.log
128130
'
129131

132+
test_expect_success 'git help --user-interfaces' '
133+
git help --user-interfaces >help.output &&
134+
grep "^ attributes " help.output &&
135+
grep "^ mailmap " help.output
136+
'
137+
130138
test_expect_success 'git help -c' '
131139
git help -c >help.output &&
132140
cat >expect <<-\EOF &&
@@ -220,6 +228,8 @@ test_expect_success "'git help -a' section spacing" '
220228
Low-level Commands / Syncing Repositories
221229
222230
Low-level Commands / Internal Helpers
231+
232+
User-facing repository, command and file interfaces
223233
EOF
224234
test_cmp expect actual
225235
'

0 commit comments

Comments
 (0)