chiark / gitweb /
commitid: in Small with commitid, show start rather than end of commitid
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 10 Feb 2016 01:50:12 +0000 (01:50 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 10 Feb 2016 01:50:12 +0000 (01:50 +0000)
commitid.scad.pl

index 983a4ab..35bc341 100755 (executable)
@@ -538,11 +538,11 @@ sub do_git () {
 
        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);
+           my $forgitobj = $sz - length($git_count) - 1;
+           if (defined($git_object) && $forgitobj >= 2) {
+               $smallstr = rjustt($forgitobj, $git_object).
+                   ($git_dirty || ' ').
+                   $git_count;
            }
            genform_plusq("Small$sz", $smallstr);
        }