48
static const char *auml_nfc = "\xc3\xa4";
49
static const char *auml_nfd = "\x61\xcc\x88";
50
int output_fd;
51
- if (precomposed_unicode != -1)
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);
58
- precomposed_unicode = access(path.buf, R_OK) ? 0 : 1;
60
+ cfg->precomposed_unicode = access(path.buf, R_OK) ? 0 : 1;
61
repo_config_set(the_repository, "core.precomposeunicode",
60
- precomposed_unicode ? "true" : "false");
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);
71
{
72
size_t inlen;
73
size_t outlen;
74
+ struct repo_config_values *cfg = repo_config_values(the_repository);
75
+
76
if (!in)
77
return NULL;
78
if (has_non_ascii(in, (size_t)-1, &inlen)) {
79
iconv_t ic_prec;
80
char *out;
77
- if (precomposed_unicode < 0)
78
- repo_config_get_bool(the_repository, "core.precomposeunicode", &precomposed_unicode);
79
- if (precomposed_unicode != 1)
81
+ if (cfg->precomposed_unicode < 0)
82
+ repo_config_get_bool(the_repository, "core.precomposeunicode", &cfg->precomposed_unicode);
83
+ if (cfg->precomposed_unicode != 1)
84
return in;
85
ic_prec = iconv_open(repo_encoding, path_encoding);
86
if (ic_prec == (iconv_t) -1)
134
135
struct dirent_prec_psx *precompose_utf8_readdir(PREC_DIR *prec_dir)
136
{
137
+ struct repo_config_values *cfg = repo_config_values(the_repository);
138
struct dirent *res;
139
+
140
res = readdir(prec_dir->dirp);
141
if (res) {
142
size_t namelenz = strlen(res->d_name) + 1; /* \0 */
155
prec_dir->dirent_nfc->d_ino = res->d_ino;
156
prec_dir->dirent_nfc->d_type = res->d_type;
157
152
- if ((precomposed_unicode == 1) && has_non_ascii(res->d_name, (size_t)-1, NULL)) {
158
+ if ((cfg->precomposed_unicode == 1) && has_non_ascii(res->d_name, (size_t)-1, NULL)) {
159
if (prec_dir->ic_precompose == (iconv_t)-1) {
160
die("iconv_open(%s,%s) failed, but needed:\n"
161
" precomposed unicode is not supported.\n"