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

Function trace_encoding

convert.c:321–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321static void trace_encoding(const char *context, const char *path,
322 const char *encoding, const char *buf, size_t len)
323{
324 static struct trace_key coe = TRACE_KEY_INIT(WORKING_TREE_ENCODING);
325 struct strbuf trace = STRBUF_INIT;
326 int i;
327
328 if (!trace_want(&coe))
329 return;
330
331 strbuf_addf(&trace, "%s (%s, considered %s):\n", context, path, encoding);
332 for (i = 0; i < len && buf; ++i) {
333 strbuf_addf(
334 &trace, "| \033[2m%2i:\033[0m %2x \033[2m%c\033[0m%c",
335 i,
336 (unsigned char) buf[i],
337 (buf[i] > 32 && buf[i] < 127 ? buf[i] : ' '),
338 ((i+1) % 8 && (i+1) < len ? ' ' : '\n')
339 );
340 }
341 strbuf_addchars(&trace, '\n', 1);
342
343 trace_strbuf(&coe, &trace);
344 strbuf_release(&trace);
345}
346
347static int check_roundtrip(const char *enc_name)
348{

Callers 1

encode_to_gitFunction · 0.85

Calls 4

trace_wantFunction · 0.85
strbuf_addfFunction · 0.85
strbuf_addcharsFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected