Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created January 17, 2017 16:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save zoffixznet/b78b48d079565f8f4caa06a77558aa1d to your computer and use it in GitHub Desktop.
use v6;
use File::Find;
sub is-git-top($dir) {
# shell('git rev-parse --is-inside-work-tree >&/dev/null').exitcode == 0;
# && shell('git rev-parse --is-inside-git-dir >&/dev/null').exitcode != 0;
$dir.child(".git").d;
}
sub MAIN($search-string) {
for find(dir => '.', type => 'dir').grep({ is-git-top($_) }) -> $dir {
my $cwd = $*CWD;
chdir $dir;
for run(:out, <git branch --list>, $search-string).out.lines -> $branch {
say "$dir $branch";
}
chdir $cwd;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment