Merge branch 'fc/contrib-bzr-hg-fixes'
[gitweb.git] / compat / precompose_utf8.c
index 030174db515e764aa883b21afe9be8fb3ae41f2e..95fe849e42d3b9e1f7bc9590fcfac93016f38146 100644 (file)
@@ -48,11 +48,8 @@ void probe_utf8_pathname_composition(char *path, int len)
        if (output_fd >= 0) {
                close(output_fd);
                strcpy(path + len, auml_nfd);
-               /* Indicate to the user, that we can configure it to true */
-               if (!access(path, R_OK))
-                       git_config_set("core.precomposeunicode", "false");
-               /* To be backward compatible, set precomposed_unicode to 0 */
-               precomposed_unicode = 0;
+               precomposed_unicode = access(path, R_OK) ? 0 : 1;
+               git_config_set("core.precomposeunicode", precomposed_unicode ? "true" : "false");
                strcpy(path + len, auml_nfc);
                if (unlink(path))
                        die_errno(_("failed to unlink '%s'"), path);
@@ -78,7 +75,7 @@ void precompose_argv(int argc, const char **argv)
                size_t namelen;
                oldarg = argv[i];
                if (has_non_ascii(oldarg, (size_t)-1, &namelen)) {
-                       newarg = reencode_string_iconv(oldarg, namelen, ic_precompose);
+                       newarg = reencode_string_iconv(oldarg, namelen, ic_precompose, NULL);
                        if (newarg)
                                argv[i] = newarg;
                }