diff options
author | Michal Vitecek <fuf@mageo.cz> | 2007-09-25 14:38:46 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-26 07:40:47 (GMT) |
commit | 55246aac6717e86c14f31391ac903ed810d1a9a0 (patch) | |
tree | d2526538770e575669d0d0ac648f45328e0e42de /interpolate.c | |
parent | 5166810b1e16b22e342f2181a3535e70c6e7a119 (diff) | |
download | git-55246aac6717e86c14f31391ac903ed810d1a9a0.zip git-55246aac6717e86c14f31391ac903ed810d1a9a0.tar.gz git-55246aac6717e86c14f31391ac903ed810d1a9a0.tar.bz2 |
Don't use "<unknown>" for placeholders and suppress printing of empty user formats.
This changes the interporate() to replace entries with NULL values
by the empty string, and uses it to interpolate missing fields in
custom format output used in git-log and friends. It is most useful
to avoid <unknown> output from %b format for a commit log message
that lack any body text.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'interpolate.c')
-rw-r--r-- | interpolate.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/interpolate.c b/interpolate.c index 0082677..2f727cd 100644 --- a/interpolate.c +++ b/interpolate.c @@ -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); |