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

Function encode_to_worktree

convert.c:478–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478static int encode_to_worktree(const char *path, const char *src, size_t src_len,
479 struct strbuf *buf, const char *enc)
480{
481 char *dst;
482 size_t dst_len;
483
484 /*
485 * No encoding is specified or there is nothing to encode.
486 * Tell the caller that the content was not modified.
487 */
488 if (!enc || (src && !src_len))
489 return 0;
490
491 dst = reencode_string_len(src, src_len, enc, default_encoding,
492 &dst_len);
493 if (!dst) {
494 error(_("failed to encode '%s' from %s to %s"),
495 path, default_encoding, enc);
496 return 0;
497 }
498
499 strbuf_attach(buf, dst, dst_len, dst_len + 1);
500 return 1;
501}
502
503static int crlf_to_git(struct index_state *istate,
504 const char *path, const char *src, size_t len,

Callers 1

Calls 3

errorFunction · 0.85
strbuf_attachFunction · 0.85
reencode_string_lenFunction · 0.70

Tested by

no test coverage detected