Merge branch 'jk/warn-author-committer-after-commit'
* jk/warn-author-committer-after-commit: user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere commit.c::print_summary: do not release the format string too early commit: allow suppression of implicit identity advice commit: show interesting ident information in summary strbuf: add strbuf_addbuf_percentquote strbuf_expand: convert "%%" to "%" Conflicts: builtin-commit.c ident.c
This commit is contained in:
17
strbuf.c
17
strbuf.c
@ -220,6 +220,12 @@ void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn,
|
||||
break;
|
||||
format = percent + 1;
|
||||
|
||||
if (*format == '%') {
|
||||
strbuf_addch(sb, '%');
|
||||
format++;
|
||||
continue;
|
||||
}
|
||||
|
||||
consumed = fn(sb, format, context);
|
||||
if (consumed)
|
||||
format += consumed;
|
||||
@ -244,6 +250,17 @@ size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void strbuf_addbuf_percentquote(struct strbuf *dst, const struct strbuf *src)
|
||||
{
|
||||
int i, len = src->len;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (src->buf[i] == '%')
|
||||
strbuf_addch(dst, '%');
|
||||
strbuf_addch(dst, src->buf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
|
||||
{
|
||||
size_t res;
|
||||
|
||||
Reference in New Issue
Block a user