git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 99f01a091039efb60483371fbb828e1f5c70de7c 1619 bytes (raw)
name: Documentation/cmd-list.perl 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 
#!/usr/bin/perl -w

use File::Compare qw(compare);

sub format_one {
	my ($out, $nameattr) = @_;
	my ($name, $attr) = @$nameattr;
	my ($state, $description);
	my $mansection;
	$state = 0;
	open I, '<', "$name.txt" or die "No such file $name.txt";
	while (<I>) {
		if (/^git[a-z0-9-]*\(([0-9])\)$/) {
			$mansection = $1;
			next;
		}
		if (/^NAME$/) {
			$state = 1;
			next;
		}
		if ($state == 1 && /^----$/) {
			$state = 2;
			next;
		}
		next if ($state != 2);
		chomp;
		$description = $_;
		last;
	}
	close I;
	if (!defined $description) {
		die "No description found in $name.txt";
	}
	if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
		print $out "linkgit:$name\[$mansection\]::\n\t";
		if ($attr =~ / deprecated /) {
			print $out "(deprecated) ";
		}
		print $out "$text.\n\n";
	}
	else {
		die "Description does not match $name: $description";
	}
}

while (<>) {
	last if /^### command list/;
}

my %cmds = ();
for (sort <>) {
	next if /^#/;

	chomp;
	my ($name, $cat, $attr) = /^(\S+)\s+(.*?)(?:\s+(.*))?$/;
	$attr = '' unless defined $attr;
	push @{$cmds{$cat}}, [$name, " $attr "];
}

for my $cat (qw(ancillaryinterrogators
		ancillarymanipulators
		mainporcelain
		plumbinginterrogators
		plumbingmanipulators
		synchingrepositories
		foreignscminterface
		purehelpers
		synchelpers
		guide)) {
	my $out = "cmds-$cat.txt";
	open O, '>', "$out+" or die "Cannot open output file $out+";
	for (@{$cmds{$cat}}) {
		format_one(\*O, $_);
	}
	close O;

	if (-f "$out" && compare("$out", "$out+") == 0) {
		unlink "$out+";
	}
	else {
		print STDERR "$out\n";
		rename "$out+", "$out";
	}
}

debug log:

solving 99f01a0910 ...
found 99f01a0910 in https://public-inbox.org/git/9374d80f0c37a6b6a7f5f76601ee757f89712d0c.1596381647.git.gitgitgadget@gmail.com/
found 5aa73cfe45 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 5aa73cfe458d9485510c6a9a67e38e522394b62a	Documentation/cmd-list.perl

applying [1/1] https://public-inbox.org/git/9374d80f0c37a6b6a7f5f76601ee757f89712d0c.1596381647.git.gitgitgadget@gmail.com/
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 5aa73cfe45..99f01a0910 100755

Checking patch Documentation/cmd-list.perl...
Applied patch Documentation/cmd-list.perl cleanly.

index at:
100755 99f01a091039efb60483371fbb828e1f5c70de7c	Documentation/cmd-list.perl

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).