From 40c98ff5ceb966b62b7bdb42c3ddbb48ddb61bf3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 21 Jan 2012 18:06:32 +0000 Subject: [PATCH] wip; tidy; check no unwanted metadata --- Topbloke.pm | 16 ++++++++++++++-- tb-create.pl | 4 +++- topbloke-gitattributes | 3 --- 3 files changed, 17 insertions(+), 6 deletions(-) delete mode 100644 topbloke-gitattributes diff --git a/Topbloke.pm b/Topbloke.pm index 79c47b8..2c9abe4 100644 --- a/Topbloke.pm +++ b/Topbloke.pm @@ -15,7 +15,7 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(parse_branch_spec current_tb_branch run_git_1line - setup_config); + setup_config check_no_unwanted_metadata); %EXPORT_TAGS = ( ); @EXPORT_OK = qw(); } @@ -188,7 +188,6 @@ sub setup_config () { die $! if OA->error; die $! unless close OA; } - } print $newattrs "$path\tmerge=$want\n" or die $!; } @@ -198,4 +197,17 @@ sub setup_config () { } } +sub check_no_unwanted_metadata ($) { + my ($gitbranch) = @_; + open GIT, "-|", 'git', qw(ls-tree --name-status), + "$gitbranch:", qw(.topbloke/included .topbloke/flags) + or die $!; + while () { + chomp or die; + die "foreign unexpectedly contains $_\n"; + } + GIT->error and die $!; + close GIT or die $!; +} + 1; diff --git a/tb-create.pl b/tb-create.pl index 15b2208..79d4274 100755 --- a/tb-create.pl +++ b/tb-create.pl @@ -41,7 +41,8 @@ if (!defined $spec->{Date}) { length($spec->{Date})==18 or die "partial date specified, not supported\n"; -fixme check foreign base branch for unwanted topbloke files +check_no_unwanted_metadata('HEAD') + if $current->{Kind} ne 'tip'; my $newbranch = "$spec->{Email}\@$spec->{Domain}/$spec->{Date}/$spec->{Nick}"; @@ -50,3 +51,4 @@ $newbranch = run_git_1line(qw(check-ref-format --print), $newbranch); printf "creating %s\n", $newbranch; setup_config(); + diff --git a/topbloke-gitattributes b/topbloke-gitattributes deleted file mode 100644 index 65ec3a8..0000000 --- a/topbloke-gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# v1 -msg merge=topbloke-msg -deps merge=topbloke-deps -- 2.30.2