git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git diff does not precompose unicode file paths (OS X)

From
Alexander Rinass <alex@fournova.com>
Date
Mar 7, 2016, 07:47 UTC
Message-ID
<8C785DB2-CEDB-435B-945B-00E4D98DBF99@fournova.com>
In-Reply-To
<56D9D8C6.2060104@ramsayjones.plus.com>
Show 36 quoted lines
> On 04 Mar 2016, at 19:49, Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:
> 
> 
> 
> On 04/03/16 14:37, Alexander Rinass wrote:
>> 
>>> On 04 Mar 2016, at 13:16, Torsten Bögershausen <tboegi@web.de> wrote:
>>> 
>>> On 03/04/2016 10:07 AM, Alexander Rinass wrote:
> [snip]
> 
>> 
>> Sticking a precompose_argv(argc, argv) into diff.c’s cmd_diff function fixes the issue.
>> 
>> But I had to disable the check (precomposed_unicode != 1) in precompose_argv to make it work. That’s probably because precompose_argv is usually called from parse_options and is missing some other call before it?
>> 
> 
> Yes, you need to place it after the configuration is read, but before
> calls to diff_no_index() or setup_revisions(). Directly after the call
> to git_config() should be fine. [But this begs the question about other
> commands, including plumbing, which don't call parse_options().]
> 
> Maybe this will work for you (I can't test it, since I don't have any
> access to a Mac):
> 
> diff --git a/builtin/diff.c b/builtin/diff.c
> index 343c6b8..b7a9405 100644
> --- a/builtin/diff.c
> +++ b/builtin/diff.c
> @@ -320,6 +320,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
> 		gitmodules_config();
> 	init_diff_ui_defaults();
> 	git_config(git_diff_ui_config, NULL);
> +	precompose_argv(argc, argv);
> 
> 	init_revisions(&rev, prefix);
Your patch fixes it for the diff command without further modifications.
I have also modified diff-tree, diff-index and diff-files by adding the precompose_argv call and successfully verified it.
I have attached the full patch. If there is anything else I can test, let me know.
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index 8ed2eb8..15c61fd 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -24,6 +24,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
 	gitmodules_config();
 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
 	rev.abbrev = 0;
+	precompose_argv(argc, argv);
 
 	argc = setup_revisions(argc, argv, &rev, NULL);
 	while (1 < argc && argv[1][0] == '-') {
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index d979824..1af373d 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -21,6 +21,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
 	gitmodules_config();
 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
 	rev.abbrev = 0;
+	precompose_argv(argc, argv);
 
 	argc = setup_revisions(argc, argv, &rev, NULL);
 	for (i = 1; i < argc; i++) {
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 2a12b81..806dd7a 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -114,6 +114,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
 	opt->disable_stdin = 1;
 	memset(&s_r_opt, 0, sizeof(s_r_opt));
 	s_r_opt.tweak = diff_tree_tweak_rev;
+
+	precompose_argv(argc, argv);
 	argc = setup_revisions(argc, argv, opt, &s_r_opt);
 
 	while (--argc > 0) {
diff --git a/builtin/diff.c b/builtin/diff.c
index 52c98a9..d6b8f98 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -319,6 +319,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 	if (!no_index)
 		gitmodules_config();
 	git_config(git_diff_ui_config, NULL);
+	precompose_argv(argc, argv);
 
 	init_revisions(&rev, prefix);
 
Previous: Ramsay JonesNext: Torsten Bögershausen
Message 6 of 11 in “git diff does not precompose unicode file paths (OS X)”
  1. Alexander RinassMar 4, 2016
  2. Torsten BögershausenMar 4, 2016
  3. Alexander RinassMar 4, 2016
  4. Junio C HamanoMar 4, 2016
  5. Ramsay JonesMar 4, 2016
  6. Alexander RinassMar 7, 2016
  7. Torsten BögershausenMar 7, 2016
  8. Torsten BögershausenMar 8, 2016
  9. Alexander RinassMar 14, 2016
  10. Torsten BögershausenMar 15, 2016
  11. Alexander RinassApr 4, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.