findGitlab.pl 583 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. sub find_origin {
  5. my $path = shift;
  6. my $configFile = $path . "config";
  7. if ( -f $configFile ) {
  8. my $origin = `cat $configFile | grep url | awk {'print \$3}'`;
  9. chomp $origin;
  10. if ( $origin =~ m/@(.*)\:/ ) {
  11. if ( $1 ne "spwbk.site" ) {
  12. print "$path has origin: $origin that does not match spwbk.site\n";
  13. }
  14. }
  15. }
  16. }
  17. sub find_git {
  18. my $path = shift;
  19. my $gitDirPath = $path . ".git/";
  20. if ( -d $gitDirPath ) {
  21. find_origin($gitDirPath);
  22. }
  23. }
  24. foreach my $dir ( split("\n",`ls -d */`) ) {
  25. chomp $dir;
  26. find_git($dir);
  27. }