Skip to content

Commit d281bad

Browse files
committed
Merge branch 'pb/guide-docs' into jch
Update "git help guides" documentation organization. * pb/guide-docs: git.txt: add list of guides Documentation: don't hardcode command categories twice help: drop usage of 'common' and 'useful' for guides command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
2 parents f16958b + f442f28 commit d281bad

File tree

9 files changed

+34
-22
lines changed

9 files changed

+34
-22
lines changed

Documentation/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ MAN1_TXT += git.txt
1717
MAN1_TXT += gitk.txt
1818
MAN1_TXT += gitweb.txt
1919

20+
# man5 / man7 guides (note: new guides should also be added to command-list.txt)
2021
MAN5_TXT += gitattributes.txt
2122
MAN5_TXT += githooks.txt
2223
MAN5_TXT += gitignore.txt
@@ -294,14 +295,15 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
294295
cmds-plumbingmanipulators.txt \
295296
cmds-synchingrepositories.txt \
296297
cmds-synchelpers.txt \
298+
cmds-guide.txt \
297299
cmds-purehelpers.txt \
298300
cmds-foreignscminterface.txt
299301

300302
$(cmds_txt): cmd-list.made
301303

302304
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
303305
$(QUIET_GEN)$(RM) $@ && \
304-
$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
306+
$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
305307
date >$@
306308

307309
mergetools_txt = mergetools-diff.txt mergetools-merge.txt

Documentation/cmd-list.perl

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ sub format_one {
66
my ($out, $nameattr) = @_;
77
my ($name, $attr) = @$nameattr;
88
my ($state, $description);
9+
my $mansection;
910
$state = 0;
1011
open I, '<', "$name.txt" or die "No such file $name.txt";
1112
while (<I>) {
13+
if (/^git[a-z0-9-]*\(([0-9])\)$/) {
14+
$mansection = $1;
15+
next;
16+
}
1217
if (/^NAME$/) {
1318
$state = 1;
1419
next;
@@ -27,7 +32,7 @@ sub format_one {
2732
die "No description found in $name.txt";
2833
}
2934
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
30-
print $out "linkgit:$name\[1\]::\n\t";
35+
print $out "linkgit:$name\[$mansection\]::\n\t";
3136
if ($attr =~ / deprecated /) {
3237
print $out "(deprecated) ";
3338
}
@@ -38,30 +43,26 @@ sub format_one {
3843
}
3944
}
4045

41-
while (<>) {
46+
my ($input, @categories) = @ARGV;
47+
48+
open IN, "<$input";
49+
while (<IN>) {
4250
last if /^### command list/;
4351
}
4452

4553
my %cmds = ();
46-
for (sort <>) {
54+
for (sort <IN>) {
4755
next if /^#/;
4856

4957
chomp;
5058
my ($name, $cat, $attr) = /^(\S+)\s+(.*?)(?:\s+(.*))?$/;
5159
$attr = '' unless defined $attr;
5260
push @{$cmds{$cat}}, [$name, " $attr "];
5361
}
62+
close IN;
5463

55-
for my $cat (qw(ancillaryinterrogators
56-
ancillarymanipulators
57-
mainporcelain
58-
plumbinginterrogators
59-
plumbingmanipulators
60-
synchingrepositories
61-
foreignscminterface
62-
purehelpers
63-
synchelpers)) {
64-
my $out = "cmds-$cat.txt";
64+
for my $out (@categories) {
65+
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
6566
open O, '>', "$out+" or die "Cannot open output file $out+";
6667
for (@{$cmds{$cat}}) {
6768
format_one(\*O, $_);

Documentation/git-help.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ on the standard output.
2121
If the option `--all` or `-a` is given, all available commands are
2222
printed on the standard output.
2323

24-
If the option `--guides` or `-g` is given, a list of the useful
25-
Git guides is also printed on the standard output.
24+
If the option `--guides` or `-g` is given, a list of the
25+
Git concept guides is also printed on the standard output.
2626

2727
If a command, or a guide, is given, a manual page for that command or
2828
guide is brought up. The 'man' program is used by default for this
@@ -58,7 +58,7 @@ OPTIONS
5858

5959
-g::
6060
--guides::
61-
Prints a list of useful guides on the standard output. This
61+
Prints a list of the Git concept guides on the standard output. This
6262
option overrides any given command or guide name.
6363

6464
-i::

Documentation/git.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ users typically do not use them directly.
304304

305305
include::cmds-purehelpers.txt[]
306306

307+
Guides
308+
------
309+
310+
The following documentation pages are guides about Git concepts.
311+
312+
include::cmds-guide.txt[]
313+
307314

308315
Configuration Mechanism
309316
-----------------------

Documentation/gitcredentials.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ gitcredentials(7)
33

44
NAME
55
----
6-
gitcredentials - providing usernames and passwords to Git
6+
gitcredentials - Providing usernames and passwords to Git
77

88
SYNOPSIS
99
--------

builtin/help.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
579579
}
580580

581581
if (show_guides)
582-
list_common_guides_help();
582+
list_guides_help();
583583

584584
if (show_all || show_guides) {
585585
printf("%s\n", _(git_more_info_string));

command-list.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ git-write-tree plumbingmanipulators
195195
gitattributes guide
196196
gitcli guide
197197
gitcore-tutorial guide
198+
gitcredentials guide
198199
gitcvs-migration guide
199200
gitdiffcore guide
200201
giteveryday guide
@@ -204,6 +205,7 @@ githooks guide
204205
gitignore guide
205206
gitmodules guide
206207
gitnamespaces guide
208+
gitremote-helpers guide
207209
gitrepository-layout guide
208210
gitrevisions guide
209211
gitsubmodules guide

help.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,10 @@ void list_cmds_by_config(struct string_list *list)
397397
}
398398
}
399399

400-
void list_common_guides_help(void)
400+
void list_guides_help(void)
401401
{
402402
struct category_description catdesc[] = {
403-
{ CAT_guide, N_("The common Git guides are:") },
403+
{ CAT_guide, N_("The Git concept guides are:") },
404404
{ 0, NULL }
405405
};
406406
print_cmd_by_category(catdesc, NULL);

help.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static inline void mput_char(char c, unsigned int num)
2121

2222
void list_common_cmds_help(void);
2323
void list_all_cmds_help(void);
24-
void list_common_guides_help(void);
24+
void list_guides_help(void);
2525

2626
void list_all_main_cmds(struct string_list *list);
2727
void list_all_other_cmds(struct string_list *list);

0 commit comments

Comments
 (0)