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

Function fill_textconv

diff.c:7793–7840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7791}
7792
7793size_t fill_textconv(struct repository *r,
7794 struct userdiff_driver *driver,
7795 struct diff_filespec *df,
7796 char **outbuf)
7797{
7798 size_t size;
7799
7800 if (!driver) {
7801 if (!DIFF_FILE_VALID(df)) {
7802 *outbuf = (char *) "";
7803 return 0;
7804 }
7805 if (diff_populate_filespec(r, df, NULL))
7806 die("unable to read files to diff");
7807 *outbuf = df->data;
7808 return df->size;
7809 }
7810
7811 if (!driver->textconv)
7812 BUG("fill_textconv called with non-textconv driver");
7813
7814 if (driver->textconv_cache && df->oid_valid) {
7815 *outbuf = notes_cache_get(driver->textconv_cache,
7816 &df->oid,
7817 &size);
7818 if (*outbuf)
7819 return size;
7820 }
7821
7822 *outbuf = run_textconv(r, driver->textconv, df, &size);
7823 if (!*outbuf)
7824 die("unable to read files to diff");
7825
7826 if (driver->textconv_cache && df->oid_valid) {
7827 /* ignore errors, as we might be in a readonly repository */
7828 notes_cache_put(driver->textconv_cache, &df->oid, *outbuf,
7829 size);
7830 /*
7831 * we could save up changes and flush them all at the end,
7832 * but we would need an extra call after all diffing is done.
7833 * Since generating a cache entry is the slow path anyway,
7834 * this extra overhead probably isn't a big deal.
7835 */
7836 notes_cache_write(driver->textconv_cache);
7837 }
7838
7839 return size;
7840}
7841
7842int textconv_object(struct repository *r,
7843 const char *path,

Callers 7

fill_textconv_grepFunction · 0.85
grab_blobFunction · 0.85
show_patch_diffFunction · 0.85
pickaxe_matchFunction · 0.85
emit_rewrite_diffFunction · 0.85
builtin_diffFunction · 0.85
textconv_objectFunction · 0.85

Calls 6

diff_populate_filespecFunction · 0.85
notes_cache_getFunction · 0.85
run_textconvFunction · 0.85
notes_cache_putFunction · 0.85
notes_cache_writeFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected