logo

utils

Old programs, got split in utils-std and utils-extra git clone https://anongit.hacktivis.me/git/utils.git/
commit: 6418f803c09f86fa830642112d7ee2b38b6ad795
parent ddc366ebdee7d36d092e2346c58a04ffb59098ae
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 14 Oct 2025 18:47:50 +0200

post-update.reuse: print hash-key or array-value if alone

Diffstat:

Mgit-hooks/post-update.reuse15++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/git-hooks/post-update.reuse b/git-hooks/post-update.reuse @@ -30,10 +30,19 @@ if ($reuse_json->{"summary"}->{"compliant"} != JSON::true) { if ($ref_type eq 'ARRAY') { my $n = scalar @{$v}; - print "reuse: ", $key, ": @ " , $n, " items\n" if $n > 0; + if($n == 1) { + print "reuse: ", $key, ": [\"" , $v->[0], "\"]\n"; + } elsif ($n > 1) { + print "reuse: ", $key, ": @ " , $n, "\n"; + } } elsif ($ref_type eq 'HASH') { - my $n = scalar keys %{$v}; - print "reuse: ", $key, ": # " , $n, " items\n" if $n > 0; + my @k = keys %{$v}; + my $n = scalar @k; + if($n == 1) { + print "reuse: ", $key, ": {\"" , $k[0], "\": …}\n"; + } elsif ($n > 1) { + print "reuse: ", $key, ": % " , $n, "\n"; + } } else { print "reuse: ", $key, ": [", $ref_type ,"] " , $v, "\n"; }