MCPcopy Create free account
hub / github.com/git/git / probe_utf8_pathname_composition

Function probe_utf8_pathname_composition

compat/precompose_utf8.c:45–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44
45void probe_utf8_pathname_composition(void)
46{
47 struct strbuf path = STRBUF_INIT;
48 static const char *auml_nfc = "\xc3\xa4";
49 static const char *auml_nfd = "\x61\xcc\x88";
50 int output_fd;
51 struct repo_config_values *cfg = repo_config_values(the_repository);
52
53 if (cfg->precomposed_unicode != -1)
54 return; /* We found it defined in the global config, respect it */
55 repo_git_path_replace(the_repository, &path, "%s", auml_nfc);
56 output_fd = open(path.buf, O_CREAT|O_EXCL|O_RDWR, 0600);
57 if (output_fd >= 0) {
58 close(output_fd);
59 repo_git_path_replace(the_repository, &path, "%s", auml_nfd);
60 cfg->precomposed_unicode = access(path.buf, R_OK) ? 0 : 1;
61 repo_config_set(the_repository, "core.precomposeunicode",
62 cfg->precomposed_unicode ? "true" : "false");
63 repo_git_path_replace(the_repository, &path, "%s", auml_nfc);
64 if (unlink(path.buf))
65 die_errno(_("failed to unlink '%s'"), path.buf);
66 }
67 strbuf_release(&path);
68}
69
70const char *precompose_string_if_needed(const char *in)
71{

Callers 1

create_default_filesFunction · 0.85

Calls 5

repo_git_path_replaceFunction · 0.85
repo_config_setFunction · 0.85
die_errnoFunction · 0.85
strbuf_releaseFunction · 0.85
repo_config_valuesClass · 0.70

Tested by

no test coverage detected