Revision 346b54dbc92bb3c928d326da9d8addf5eb50acce authored by Elia Pinto on 16 April 2014, 17:29:49 UTC, committed by Junio C Hamano on 17 April 2014, 18:14:59 UTC
The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent add77e8
Raw File
build-docdep.perl
#!/usr/bin/perl

my %include = ();
my %included = ();

for my $text (<*.txt>) {
    open I, '<', $text || die "cannot read: $text";
    while (<I>) {
	if (/^include::/) {
	    chomp;
	    s/^include::\s*//;
	    s/\[\]//;
	    $include{$text}{$_} = 1;
	    $included{$_} = 1;
	}
    }
    close I;
}

# Do we care about chained includes???
my $changed = 1;
while ($changed) {
    $changed = 0;
    while (my ($text, $included) = each %include) {
	for my $i (keys %$included) {
	    # $text has include::$i; if $i includes $j
	    # $text indirectly includes $j.
	    if (exists $include{$i}) {
		for my $j (keys %{$include{$i}}) {
		    if (!exists $include{$text}{$j}) {
			$include{$text}{$j} = 1;
			$included{$j} = 1;
			$changed = 1;
		    }
		}
	    }
	}
    }
}

while (my ($text, $included) = each %include) {
    if (! exists $included{$text} &&
	(my $base = $text) =~ s/\.txt$//) {
	print "$base.html $base.xml : ", join(" ", keys %$included), "\n";
    }
}
back to top