Merge branch 'cw/strbuf-cleanup'

Move functions that are not about pure string manipulation out of
strbuf.[ch]

* cw/strbuf-cleanup:
  strbuf: remove global variable
  path: move related function to path
  object-name: move related functions to object-name
  credential-store: move related functions to credential-store file
  abspath: move related functions to abspath
  strbuf: clarify dependency
  strbuf: clarify API boundary
This commit is contained in:
Junio C Hamano
2023-07-06 11:54:46 -07:00
27 changed files with 231 additions and 194 deletions

View File

@ -309,9 +309,11 @@ static void create_tag(const struct object_id *object, const char *object_ref,
struct strbuf buf = STRBUF_INIT;
strbuf_addch(&buf, '\n');
if (opt->cleanup_mode == CLEANUP_ALL)
strbuf_commented_addf(&buf, _(tag_template), tag, comment_line_char);
strbuf_commented_addf(&buf, comment_line_char,
_(tag_template), tag, comment_line_char);
else
strbuf_commented_addf(&buf, _(tag_template_nocleanup), tag, comment_line_char);
strbuf_commented_addf(&buf, comment_line_char,
_(tag_template_nocleanup), tag, comment_line_char);
write_or_die(fd, buf.buf, buf.len);
strbuf_release(&buf);
}
@ -325,7 +327,8 @@ static void create_tag(const struct object_id *object, const char *object_ref,
}
if (opt->cleanup_mode != CLEANUP_NONE)
strbuf_stripspace(buf, opt->cleanup_mode == CLEANUP_ALL);
strbuf_stripspace(buf,
opt->cleanup_mode == CLEANUP_ALL ? comment_line_char : '\0');
if (!opt->message_given && !buf->len)
die(_("no tag message?"));