diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-07-20 12:49:43 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-07-20 12:49:43 -0700 |
commit | 083aaf9512d47487d6266e1d184041c09aaaee3e (patch) | |
tree | dbb601afc2d5ab2c3407a8dd17a74d0ae4512ff5 /bin/src-unregister | |
parent | 1bb41989a1cb36ade0c1af1fc612810ec8b73362 (diff) | |
download | dotfiles-083aaf9512d47487d6266e1d184041c09aaaee3e.tar.gz |
src-unregister checks for unpushed tags
Diffstat (limited to 'bin/src-unregister')
-rwxr-xr-x | bin/src-unregister | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bin/src-unregister b/bin/src-unregister index 98413114..40abce0d 100755 --- a/bin/src-unregister +++ b/bin/src-unregister @@ -10,10 +10,12 @@ use strict; use warnings; +use lib "$ENV{HOME}/src/dotfiles/perl5"; use Cwd; use File::Basename; use File::Spec::Functions; +use Local::Util::Git qw(unpushed_tags); die "need at least one argument" if ( @ARGV < 1 ); my $force = 0; @@ -43,11 +45,22 @@ while (<$fh>) { foreach my $repo (@to_remove) { my $block = File::Spec->rel2abs($repo); die "$repo is not known to mr" unless grep /\A$block\z/, @known_repos; + my $output = `mr -m -d $repo status 2>&1`; - if (!$force && length $output > 0) { - print STDERR "$output"; - die "repo $repo might contain work; pass -f to delete anyway\n"; + print STDERR "$output" if length $output > 0; + + my $pwd = getcwd; + chdir $repo; + my @unpushed_tags; + if (@unpushed_tags = unpushed_tags) { + print "E: the following tags have not been pushed to any remote:\n"; + print join ", ", @unpushed_tags; + print "\n"; } + chdir $pwd; + + die "repo $repo might contain work; pass -f to delete anyway\n" + if !$force && (length $output > 0 || @unpushed_tags); $block =~ s/^$ENV{HOME}\///; remove_block_from_ini(catfile($ENV{HOME}, ".mrconfig"), $block); system "rm -rf $repo/../".basename($repo)."_*.orig.tar.* $repo"; |