From 0d888a41733926d881c0668f1f5075b19c4e2844 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 5 Feb 2016 21:31:30 +0000 Subject: [PATCH] commitid: In Small, include commitid if it fits --- commitid.scad.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/commitid.scad.pl b/commitid.scad.pl index 7506c62..cfb31f8 100755 --- a/commitid.scad.pl +++ b/commitid.scad.pl @@ -66,6 +66,9 @@ $SIG{__WARN__} = sub { die @_; }; # eg if the count is 123456 # Small5 3456* # Small8 __123456 (where _ are spaces) +# the git objectid is included if it will fit +# unambiguously and usefully eg +# Small9 ab*123456 # # Small2S Small4S ... Small10S: # Small3T Small9T: @@ -356,8 +359,16 @@ sub do_git () { foreach my $sz (2..10) { gentextmodule_demo_start_batch(); - genform_plusq("Small$sz", rjustt($sz, $git_count, $git_dirty)) - if defined $git_count; + if (defined($git_count)) { + my $smallstr = rjustt($sz, $git_count, $git_dirty); + if (defined($git_object) && $sz >= length($git_count) + 3) { + $smallstr = $git_object; + $smallstr .= ($git_dirty || ' '); + $smallstr .= $git_count; + $smallstr = rjustt($sz, $smallstr); + } + genform_plusq("Small$sz", $smallstr); + } genform_plusq("Git$sz", ljustt($sz, $git_object, $git_dirty)) if defined $git_object; -- 2.30.2