Merge branch 'ar/diff-args-osx-precompose'

Many commands normalize command line arguments from NFD to NFC
variant of UTF-8 on OSX, but commands in the "diff" family did
not, causing "git diff $path" to complain that no such path is
known to Git.  They have been taught to do the normalization.

* ar/diff-args-osx-precompose:
  diff: run arguments through precompose_argv
This commit is contained in:
Junio C Hamano 2016-05-23 14:54:35 -07:00
Родитель fa4f29b8a8 90a78b83e0
Коммит 53c4b3ed0e
5 изменённых файлов: 47 добавлений и 0 удалений

Просмотреть файл

@ -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] == '-') {

Просмотреть файл

@ -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++) {

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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);

Просмотреть файл

@ -49,12 +49,54 @@ test_expect_success "setup" '
test_expect_success "setup case mac" '
git checkout -b mac_os
'
# This will test nfd2nfc in git diff
test_expect_success "git diff f.Adiar" '
touch f.$Adiarnfc &&
git add f.$Adiarnfc &&
echo f.Adiarnfc >f.$Adiarnfc &&
git diff f.$Adiarnfd >expect &&
git diff f.$Adiarnfc >actual &&
test_cmp expect actual &&
git reset HEAD f.Adiarnfc &&
rm f.$Adiarnfc expect actual
'
# This will test nfd2nfc in git diff-files
test_expect_success "git diff-files f.Adiar" '
touch f.$Adiarnfc &&
git add f.$Adiarnfc &&
echo f.Adiarnfc >f.$Adiarnfc &&
git diff-files f.$Adiarnfd >expect &&
git diff-files f.$Adiarnfc >actual &&
test_cmp expect actual &&
git reset HEAD f.Adiarnfc &&
rm f.$Adiarnfc expect actual
'
# This will test nfd2nfc in git diff-index
test_expect_success "git diff-index f.Adiar" '
touch f.$Adiarnfc &&
git add f.$Adiarnfc &&
echo f.Adiarnfc >f.$Adiarnfc &&
git diff-index HEAD f.$Adiarnfd >expect &&
git diff-index HEAD f.$Adiarnfc >actual &&
test_cmp expect actual &&
git reset HEAD f.Adiarnfc &&
rm f.$Adiarnfc expect actual
'
# This will test nfd2nfc in readdir()
test_expect_success "add file Adiarnfc" '
echo f.Adiarnfc >f.$Adiarnfc &&
git add f.$Adiarnfc &&
git commit -m "add f.$Adiarnfc"
'
# This will test nfd2nfc in git diff-tree
test_expect_success "git diff-tree f.Adiar" '
echo f.Adiarnfc >>f.$Adiarnfc &&
git diff-tree HEAD f.$Adiarnfd >expect &&
git diff-tree HEAD f.$Adiarnfc >actual &&
test_cmp expect actual &&
git checkout f.$Adiarnfc &&
rm expect actual
'
# This will test nfd2nfc in git stage()
test_expect_success "stage file d.Adiarnfd/f.Adiarnfd" '
mkdir d.$Adiarnfd &&