X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-cvsimport.perl;h=1a1ba7b1a6f779773702ae3c1efb56425c31beb4;hb=d58c6184e345b9c8c8bfe8cc3eb1bbfe2f5ee4f9;hp=35ef0c0ee54a8f284c1afd7754f2e69e03d925c1;hpb=38ebbacd93eb547b3608b64a2efc60fd79e1ea85;p=git.git diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 35ef0c0ee..1a1ba7b1a 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -85,7 +85,35 @@ sub write_author_info($) { close ($f); } -getopts("hivmkuo:d:p:C:z:s:M:P:A:S:L:") or usage(); +# convert getopts specs for use by git-repo-config +sub read_repo_config { + # Split the string between characters, unless there is a ':' + # So "abc:de" becomes ["a", "b", "c:", "d", "e"] + my @opts = split(/ *(?!:)/, shift); + foreach my $o (@opts) { + my $key = $o; + $key =~ s/://g; + my $arg = 'git-repo-config'; + $arg .= ' --bool' if ($o !~ /:$/); + + chomp(my $tmp = `$arg --get cvsimport.$key`); + if ($tmp && !($arg =~ /--bool/ && $tmp eq 'false')) { + no strict 'refs'; + my $opt_name = "opt_" . $key; + if (!$$opt_name) { + $$opt_name = $tmp; + } + } + } + if (@ARGV == 0) { + chomp(my $module = `git-repo-config --get cvsimport.module`); + push(@ARGV, $module); + } +} + +my $opts = "haivmkuo:d:p:C:z:s:M:P:A:S:L:"; +read_repo_config($opts); +getopts($opts) or usage(); usage if $opt_h; @ARGV <= 1 or usage();