From 3513f4a153a2ec9c5216ef11c84668107c4e409e Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Wed, 19 Dec 2012 06:09:03 +0530 Subject: [PATCH] fix bug in list-dangling-repos Still, I would advise caution if you use this as a basis for deleting repos from the file system. A bug in this program could cause you to lose important data! --- src/commands/list-dangling-repos | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/commands/list-dangling-repos b/src/commands/list-dangling-repos index 6889ed9..ea36bab 100755 --- a/src/commands/list-dangling-repos +++ b/src/commands/list-dangling-repos @@ -12,6 +12,9 @@ List all existing repos that no one can access remotely any more. They could be normal repos that were taken out of "repo" statements in the conf file, or wildcard repos whose matching "wild" pattern was taken out or changed so it no longer matches. + +I would advise caution if you use this as a basis for deleting repos from the +file system. A bug in this program could cause you to lose important data! =cut usage() if @ARGV and $ARGV[0] eq '-h'; @@ -21,6 +24,9 @@ usage() if @ARGV and $ARGV[0] eq '-h'; # is to cull %phy_repos of all keys that have a matching key in %repos, where # "matching" means "string equal" or "regex match". my %repos = map { chomp; $_ => 1 } `gitolite list-repos`; +for my $r ( grep /^@/, keys %repos ) { + map { chomp; $repos{$_} = 1; } `gitolite list-members $r`; +} my %phy_repos = map { chomp; $_ => 1 } `gitolite list-phy-repos`; # Remove exact matches. But for repo names like "gtk+", you could have