Merge branch 'tb/precompose-getcwd' into maint-2.45
We forgot to normalize the result of getcwd() to NFC on macOS where all other paths are normalized, which has been corrected. This still does not address the case where core.precomposeUnicode configuration is not defined globally. * tb/precompose-getcwd: macOS: ls-files path fails if path of workdir is NFD
This commit is contained in:
2
setup.c
2
setup.c
@ -48,7 +48,7 @@ static int abspath_part_inside_repo(char *path)
|
|||||||
size_t wtlen;
|
size_t wtlen;
|
||||||
char *path0;
|
char *path0;
|
||||||
int off;
|
int off;
|
||||||
const char *work_tree = get_git_work_tree();
|
const char *work_tree = precompose_string_if_needed(get_git_work_tree());
|
||||||
struct strbuf realpath = STRBUF_INIT;
|
struct strbuf realpath = STRBUF_INIT;
|
||||||
|
|
||||||
if (!work_tree)
|
if (!work_tree)
|
||||||
|
@ -37,6 +37,27 @@ Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc #50 Byte
|
|||||||
Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc #250 Byte
|
Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc #250 Byte
|
||||||
Alongc=$Alongc$AEligatu$AEligatu #254 Byte
|
Alongc=$Alongc$AEligatu$AEligatu #254 Byte
|
||||||
|
|
||||||
|
|
||||||
|
ls_files_nfc_nfd () {
|
||||||
|
test_when_finished "git config --global --unset core.precomposeunicode" &&
|
||||||
|
prglbl=$1
|
||||||
|
prlocl=$2
|
||||||
|
aumlcreat=$3
|
||||||
|
aumllist=$4
|
||||||
|
git config --global core.precomposeunicode $prglbl &&
|
||||||
|
(
|
||||||
|
rm -rf .git &&
|
||||||
|
mkdir -p "somewhere/$prglbl/$prlocl/$aumlcreat" &&
|
||||||
|
mypwd=$PWD &&
|
||||||
|
cd "somewhere/$prglbl/$prlocl/$aumlcreat" &&
|
||||||
|
git init &&
|
||||||
|
git config core.precomposeunicode $prlocl &&
|
||||||
|
git --literal-pathspecs ls-files "$mypwd/somewhere/$prglbl/$prlocl/$aumllist" 2>err &&
|
||||||
|
>expected &&
|
||||||
|
test_cmp expected err
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
test_expect_success "detect if nfd needed" '
|
test_expect_success "detect if nfd needed" '
|
||||||
precomposeunicode=$(git config core.precomposeunicode) &&
|
precomposeunicode=$(git config core.precomposeunicode) &&
|
||||||
test "$precomposeunicode" = true &&
|
test "$precomposeunicode" = true &&
|
||||||
@ -211,8 +232,8 @@ test_expect_success "unicode decomposed: git restore -p . " '
|
|||||||
'
|
'
|
||||||
|
|
||||||
# Test if the global core.precomposeunicode stops autosensing
|
# Test if the global core.precomposeunicode stops autosensing
|
||||||
# Must be the last test case
|
|
||||||
test_expect_success "respect git config --global core.precomposeunicode" '
|
test_expect_success "respect git config --global core.precomposeunicode" '
|
||||||
|
test_when_finished "git config --global --unset core.precomposeunicode" &&
|
||||||
git config --global core.precomposeunicode true &&
|
git config --global core.precomposeunicode true &&
|
||||||
rm -rf .git &&
|
rm -rf .git &&
|
||||||
git init &&
|
git init &&
|
||||||
@ -220,4 +241,20 @@ test_expect_success "respect git config --global core.precomposeunicode" '
|
|||||||
test "$precomposeunicode" = "true"
|
test "$precomposeunicode" = "true"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success "ls-files false false nfd nfd" '
|
||||||
|
ls_files_nfc_nfd false false $Adiarnfd $Adiarnfd
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success "ls-files false true nfd nfd" '
|
||||||
|
ls_files_nfc_nfd false true $Adiarnfd $Adiarnfd
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success "ls-files true false nfd nfd" '
|
||||||
|
ls_files_nfc_nfd true false $Adiarnfd $Adiarnfd
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success "ls-files true true nfd nfd" '
|
||||||
|
ls_files_nfc_nfd true true $Adiarnfd $Adiarnfd
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user