chiark / gitweb /
commitid: In Small, include commitid if it fits
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 5 Feb 2016 21:31:30 +0000 (21:31 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 5 Feb 2016 21:31:30 +0000 (21:31 +0000)
commitid.scad.pl

index 7506c621ab74a8c8885fb57ae3479f352eb25271..cfb31f849f85c005f6214d8527a120b4b8a52da8 100755 (executable)
@@ -66,6 +66,9 @@ $SIG{__WARN__} = sub { die @_; };
 #       eg if the count is 123456
 #            Small5    3456*
 #            Small8    __123456    (where _ are spaces)
 #       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:
 #
 #   Small2S Small4S ... Small10S:
 #   Small3T Small9T:
@@ -356,8 +359,16 @@ sub do_git () {
     foreach my $sz (2..10) {
        gentextmodule_demo_start_batch();
 
     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;
 
        genform_plusq("Git$sz", ljustt($sz, $git_object, $git_dirty))
            if defined $git_object;