Don't use "<unknown>" for placeholders and suppress printing of empty user formats.
[gitweb.git] / interpolate.c
index 00826778fc3d760a9b001423cd9c26e7972c126f..2f727cd05b0d071d9aa750b90fe3c16c12ccbe5e 100644 (file)
@@ -76,8 +76,12 @@ unsigned long interpolate(char *result, unsigned long reslen,
                        /* Check for valid interpolation. */
                        if (i < ninterps) {
                                value = interps[i].value;
-                               valuelen = strlen(value);
+                               if (!value) {
+                                       src += namelen;
+                                       continue;
+                               }
 
+                               valuelen = strlen(value);
                                if (newlen + valuelen + 1 < reslen) {
                                        /* Substitute. */
                                        strncpy(dest, value, valuelen);