summaryrefslogtreecommitdiff
path: root/Documentation/cmd-list.perl
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-05 22:17:20 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-06 21:29:16 -0700
commitd79073922fcb8c8a0bd57112817a2154f1ed05c1 (patch)
tree0f9efd55ac6f893f8801a9b8321b20fd21b24923 /Documentation/cmd-list.perl
parent63b4b7a7ed657f406eb274f88a7e2c61fd6fe958 (diff)
downloadgit-d79073922fcb8c8a0bd57112817a2154f1ed05c1.tar.gz
Documentation: tighten dependency for git.{html,txt}
Every time _any_ documentation page changed, cmds-*.txt files were regenerated, which caused git.{html,txt} to be remade. Try not to update cmds-*.txt files if their new contents match the old ones. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'Documentation/cmd-list.perl')
-rwxr-xr-xDocumentation/cmd-list.perl14
1 files changed, 12 insertions, 2 deletions
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index b54382b2bf..0381590d38 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -1,8 +1,11 @@
-#
+#!/usr/bin/perl -w
+
+use File::Compare qw(compare);
sub format_one {
my ($out, $name) = @_;
my ($state, $description);
+ $state = 0;
open I, '<', "$name.txt" or die "No such file $name.txt";
while (<I>) {
if (/^NAME$/) {
@@ -55,7 +58,14 @@ for my $cat (qw(ancillaryinterrogators
format_one(\*O, $_);
}
close O;
- rename "$out+", "$out";
+
+ if (-f "$out" && compare("$out", "$out+") == 0) {
+ unlink "$out+";
+ }
+ else {
+ print STDERR "$out\n";
+ rename "$out+", "$out";
+ }
}
__DATA__