Skip to content

Instantly share code, notes, and snippets.

@colomon
Created January 17, 2017 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colomon/d79c62638f3a07baa36fe0ebe484b1b3 to your computer and use it in GitHub Desktop.
Save colomon/d79c62638f3a07baa36fe0ebe484b1b3 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 qqx/git branch --list $search-string/.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