MCPcopy Index your code
hub / github.com/git/git / store_create_section

Function store_create_section

config.c:2711–2734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2709}
2710
2711static struct strbuf store_create_section(const char *key,
2712 const struct config_store_data *store)
2713{
2714 const char *dot;
2715 size_t i;
2716 struct strbuf sb = STRBUF_INIT;
2717
2718 dot = memchr(key, '.', store->baselen);
2719 if (dot) {
2720 strbuf_addf(&sb, "[%.*s \"", (int)(dot - key), key);
2721 for (i = dot - key + 1; i < store->baselen; i++) {
2722 if (key[i] == '"' || key[i] == '\\')
2723 strbuf_addch(&sb, '\\');
2724 strbuf_addch(&sb, key[i]);
2725 }
2726 strbuf_addstr(&sb, "\"]\n");
2727 } else {
2728 strbuf_addch(&sb, '[');
2729 strbuf_add(&sb, key, store->baselen);
2730 strbuf_addstr(&sb, "]\n");
2731 }
2732
2733 return sb;
2734}
2735
2736static ssize_t write_section(int fd, const char *key,
2737 const struct config_store_data *store)

Callers 2

write_sectionFunction · 0.85

Calls 4

strbuf_addfFunction · 0.85
strbuf_addchFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_addFunction · 0.85

Tested by

no test coverage detected