* [PATCH 0/1] Make abspath() aware of case-insensitive filesystems @ 2018-12-21 11:32 Johannes Schindelin via GitGitGadget 2018-12-21 11:32 ` [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget 2018-12-24 22:34 ` [PATCH v2 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 0 siblings, 2 replies; 15+ messages in thread From: Johannes Schindelin via GitGitGadget @ 2018-12-21 11:32 UTC (permalink / raw) To: git; +Cc: Junio C Hamano It is completely legitimate these days to call git add with absolute paths. Of course, on a case-insensitive file system, users rightfully expect the argument to be handled case-insensitively, too. This patch makes it so. Git for Windows carried this patch for over one and a half years already, I think it is time to get it into git.git. Johannes Schindelin (1): abspath_part_inside_repo: respect core.fileMode setup.c | 6 +++--- t/t3700-add.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) base-commit: b21ebb671bb7dea8d342225f0d66c41f4e54d5ca Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-104%2Fdscho%2Fcase-insensitive-abspath-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-104/dscho/case-insensitive-abspath-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/104 -- gitgitgadget ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-21 11:32 [PATCH 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget @ 2018-12-21 11:32 ` Johannes Schindelin via GitGitGadget 2018-12-22 18:11 ` Carlo Arenas 2018-12-24 22:34 ` [PATCH v2 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 1 sibling, 1 reply; 15+ messages in thread From: Johannes Schindelin via GitGitGadget @ 2018-12-21 11:32 UTC (permalink / raw) To: git; +Cc: Junio C Hamano, Johannes Schindelin From: Johannes Schindelin <johannes.schindelin@gmx.de> If the file system is case-insensitive, we really must be careful to ignore differences in case only. This fixes https://github.com/git-for-windows/git/issues/735 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- setup.c | 6 +++--- t/t3700-add.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.c b/setup.c index 1be5037f12..291bfb2128 100644 --- a/setup.c +++ b/setup.c @@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path) off = offset_1st_component(path); /* check if work tree is already the prefix */ - if (wtlen <= len && !strncmp(path, work_tree, wtlen)) { + if (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) { if (path[wtlen] == '/') { memmove(path, path + wtlen + 1, len - wtlen); return 0; @@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path) path++; if (*path == '/') { *path = '\0'; - if (strcmp(real_path(path0), work_tree) == 0) { + if (fspathcmp(real_path(path0), work_tree) == 0) { memmove(path0, path + 1, len - (path - path0)); return 0; } @@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path) } /* check whole path */ - if (strcmp(real_path(path0), work_tree) == 0) { + if (fspathcmp(real_path(path0), work_tree) == 0) { *path0 = '\0'; return 0; } diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 37729ba258..8ee4fc70ad 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' ' test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0 ' +test_expect_success MINGW 'path is case-insensitive' ' + path="$(pwd)/BLUB" && + touch "$path" && + downcased="$(echo "$path" | tr A-Z a-z)" && + git add "$downcased" +' + test_done -- gitgitgadget ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-21 11:32 ` [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget @ 2018-12-22 18:11 ` Carlo Arenas 2018-12-24 18:54 ` Johannes Schindelin 0 siblings, 1 reply; 15+ messages in thread From: Carlo Arenas @ 2018-12-22 18:11 UTC (permalink / raw) To: Johannes Schindelin via GitGitGadget Cc: git, Junio C Hamano, Johannes Schindelin On Fri, Dec 21, 2018 at 8:34 AM Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com> wrote: > +test_expect_success MINGW 'path is case-insensitive' ' CASE_INSENSITIVE_FS might be a better prereq Carlo ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-22 18:11 ` Carlo Arenas @ 2018-12-24 18:54 ` Johannes Schindelin 0 siblings, 0 replies; 15+ messages in thread From: Johannes Schindelin @ 2018-12-24 18:54 UTC (permalink / raw) To: Carlo Arenas; +Cc: Johannes Schindelin via GitGitGadget, git, Junio C Hamano Hi Carlo, On Sat, 22 Dec 2018, Carlo Arenas wrote: > On Fri, Dec 21, 2018 at 8:34 AM Johannes Schindelin via GitGitGadget > <gitgitgadget@gmail.com> wrote: > > +test_expect_success MINGW 'path is case-insensitive' ' > > CASE_INSENSITIVE_FS might be a better prereq You're right, the path that I downcase in the test contains an upper case "BLUB" component. Will fix, Johannes ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 0/1] Make abspath() aware of case-insensitive filesystems 2018-12-21 11:32 [PATCH 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 2018-12-21 11:32 ` [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget @ 2018-12-24 22:34 ` Johannes Schindelin via GitGitGadget 2018-12-24 22:34 ` [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget 2018-12-24 22:56 ` [PATCH v3 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 1 sibling, 2 replies; 15+ messages in thread From: Johannes Schindelin via GitGitGadget @ 2018-12-24 22:34 UTC (permalink / raw) To: git; +Cc: Junio C Hamano It is completely legitimate these days to call git add with absolute paths. Of course, on a case-insensitive file system, users rightfully expect the argument to be handled case-insensitively, too. This patch makes it so. Git for Windows carried this patch for over one and a half years already, I think it is time to get it into git.git. Change since v1: * Replaced MINGW prerequisite in the test by CASE_INSENSITIVE_FS. Johannes Schindelin (1): abspath_part_inside_repo: respect core.fileMode setup.c | 6 +++--- t/t3700-add.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) base-commit: b21ebb671bb7dea8d342225f0d66c41f4e54d5ca Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-104%2Fdscho%2Fcase-insensitive-abspath-v2 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-104/dscho/case-insensitive-abspath-v2 Pull-Request: https://github.com/gitgitgadget/git/pull/104 Range-diff vs v1: 1: 4fb5de504e = 1: 3eaec10c46 abspath_part_inside_repo: respect core.fileMode -- gitgitgadget ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-24 22:34 ` [PATCH v2 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget @ 2018-12-24 22:34 ` Johannes Schindelin via GitGitGadget 2018-12-25 10:42 ` Torsten Bögershausen 2018-12-24 22:56 ` [PATCH v3 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 1 sibling, 1 reply; 15+ messages in thread From: Johannes Schindelin via GitGitGadget @ 2018-12-24 22:34 UTC (permalink / raw) To: git; +Cc: Junio C Hamano, Johannes Schindelin From: Johannes Schindelin <johannes.schindelin@gmx.de> If the file system is case-insensitive, we really must be careful to ignore differences in case only. This fixes https://github.com/git-for-windows/git/issues/735 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- setup.c | 6 +++--- t/t3700-add.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.c b/setup.c index 1be5037f12..291bfb2128 100644 --- a/setup.c +++ b/setup.c @@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path) off = offset_1st_component(path); /* check if work tree is already the prefix */ - if (wtlen <= len && !strncmp(path, work_tree, wtlen)) { + if (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) { if (path[wtlen] == '/') { memmove(path, path + wtlen + 1, len - wtlen); return 0; @@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path) path++; if (*path == '/') { *path = '\0'; - if (strcmp(real_path(path0), work_tree) == 0) { + if (fspathcmp(real_path(path0), work_tree) == 0) { memmove(path0, path + 1, len - (path - path0)); return 0; } @@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path) } /* check whole path */ - if (strcmp(real_path(path0), work_tree) == 0) { + if (fspathcmp(real_path(path0), work_tree) == 0) { *path0 = '\0'; return 0; } diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 37729ba258..8ee4fc70ad 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' ' test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0 ' +test_expect_success MINGW 'path is case-insensitive' ' + path="$(pwd)/BLUB" && + touch "$path" && + downcased="$(echo "$path" | tr A-Z a-z)" && + git add "$downcased" +' + test_done -- gitgitgadget ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-24 22:34 ` [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget @ 2018-12-25 10:42 ` Torsten Bögershausen 2019-01-18 12:58 ` Johannes Schindelin 0 siblings, 1 reply; 15+ messages in thread From: Torsten Bögershausen @ 2018-12-25 10:42 UTC (permalink / raw) To: Johannes Schindelin via GitGitGadget Cc: git, Junio C Hamano, Johannes Schindelin Should it be s/respect core.fileMode/respect core.ignoreCase/ in the header line ? ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-25 10:42 ` Torsten Bögershausen @ 2019-01-18 12:58 ` Johannes Schindelin 0 siblings, 0 replies; 15+ messages in thread From: Johannes Schindelin @ 2019-01-18 12:58 UTC (permalink / raw) To: Torsten Bögershausen Cc: Johannes Schindelin via GitGitGadget, git, Junio C Hamano [-- Attachment #1: Type: text/plain, Size: 177 bytes --] Hi Torsten, On Tue, 25 Dec 2018, Torsten Bögershausen wrote: > > Should it be > s/respect core.fileMode/respect core.ignoreCase/ > > in the header line ? Yep. Fixed. Dscho ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 0/1] Make abspath() aware of case-insensitive filesystems 2018-12-24 22:34 ` [PATCH v2 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 2018-12-24 22:34 ` [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget @ 2018-12-24 22:56 ` Johannes Schindelin via GitGitGadget 2018-12-24 22:56 ` [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget 2019-01-18 13:24 ` [PATCH v4 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 1 sibling, 2 replies; 15+ messages in thread From: Johannes Schindelin via GitGitGadget @ 2018-12-24 22:56 UTC (permalink / raw) To: git; +Cc: Junio C Hamano It is completely legitimate these days to call git add with absolute paths. Of course, on a case-insensitive file system, users rightfully expect the argument to be handled case-insensitively, too. This patch makes it so. Git for Windows carried this patch for over one and a half years already, I think it is time to get it into git.git. Change since v2: * Replaced MINGW prerequisite in the test by CASE_INSENSITIVE_FS. v1 was sent out without a change by mistake. Sorry. Johannes Schindelin (1): abspath_part_inside_repo: respect core.fileMode setup.c | 6 +++--- t/t3700-add.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) base-commit: b21ebb671bb7dea8d342225f0d66c41f4e54d5ca Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-104%2Fdscho%2Fcase-insensitive-abspath-v3 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-104/dscho/case-insensitive-abspath-v3 Pull-Request: https://github.com/gitgitgadget/git/pull/104 Range-diff vs v2: 1: 3eaec10c46 ! 1: b935e11d21 abspath_part_inside_repo: respect core.fileMode @@ -47,7 +47,7 @@ test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0 ' -+test_expect_success MINGW 'path is case-insensitive' ' ++test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' ' + path="$(pwd)/BLUB" && + touch "$path" && + downcased="$(echo "$path" | tr A-Z a-z)" && -- gitgitgadget ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-24 22:56 ` [PATCH v3 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget @ 2018-12-24 22:56 ` Johannes Schindelin via GitGitGadget 2018-12-25 3:06 ` Junio C Hamano 2019-01-18 13:24 ` [PATCH v4 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 1 sibling, 1 reply; 15+ messages in thread From: Johannes Schindelin via GitGitGadget @ 2018-12-24 22:56 UTC (permalink / raw) To: git; +Cc: Junio C Hamano, Johannes Schindelin From: Johannes Schindelin <johannes.schindelin@gmx.de> If the file system is case-insensitive, we really must be careful to ignore differences in case only. This fixes https://github.com/git-for-windows/git/issues/735 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- setup.c | 6 +++--- t/t3700-add.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.c b/setup.c index 1be5037f12..291bfb2128 100644 --- a/setup.c +++ b/setup.c @@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path) off = offset_1st_component(path); /* check if work tree is already the prefix */ - if (wtlen <= len && !strncmp(path, work_tree, wtlen)) { + if (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) { if (path[wtlen] == '/') { memmove(path, path + wtlen + 1, len - wtlen); return 0; @@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path) path++; if (*path == '/') { *path = '\0'; - if (strcmp(real_path(path0), work_tree) == 0) { + if (fspathcmp(real_path(path0), work_tree) == 0) { memmove(path0, path + 1, len - (path - path0)); return 0; } @@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path) } /* check whole path */ - if (strcmp(real_path(path0), work_tree) == 0) { + if (fspathcmp(real_path(path0), work_tree) == 0) { *path0 = '\0'; return 0; } diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 37729ba258..be582a513b 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' ' test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0 ' +test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' ' + path="$(pwd)/BLUB" && + touch "$path" && + downcased="$(echo "$path" | tr A-Z a-z)" && + git add "$downcased" +' + test_done -- gitgitgadget ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-24 22:56 ` [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget @ 2018-12-25 3:06 ` Junio C Hamano 2018-12-25 8:46 ` Junio C Hamano 0 siblings, 1 reply; 15+ messages in thread From: Junio C Hamano @ 2018-12-25 3:06 UTC (permalink / raw) To: Johannes Schindelin via GitGitGadget; +Cc: git, Johannes Schindelin "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes: > diff --git a/setup.c b/setup.c > index 1be5037f12..291bfb2128 100644 > --- a/setup.c > +++ b/setup.c > @@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path) > off = offset_1st_component(path); > > /* check if work tree is already the prefix */ > - if (wtlen <= len && !strncmp(path, work_tree, wtlen)) { > + if (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) { > if (path[wtlen] == '/') { > memmove(path, path + wtlen + 1, len - wtlen); > return 0; > @@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path) > path++; > if (*path == '/') { > *path = '\0'; > - if (strcmp(real_path(path0), work_tree) == 0) { > + if (fspathcmp(real_path(path0), work_tree) == 0) { > memmove(path0, path + 1, len - (path - path0)); > return 0; > } > @@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path) > } > > /* check whole path */ > - if (strcmp(real_path(path0), work_tree) == 0) { > + if (fspathcmp(real_path(path0), work_tree) == 0) { > *path0 = '\0'; > return 0; > } So the idea is that the path to the top level of the working tree must be compared with fspath[n]cmp() to what was given. After stripping that prefix, the caller uses the result just like it uses a non-absolute path, which is why the necessary changes are isolated to this function. Makes sense. > diff --git a/t/t3700-add.sh b/t/t3700-add.sh > index 37729ba258..be582a513b 100755 > --- a/t/t3700-add.sh > +++ b/t/t3700-add.sh > @@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' ' > test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0 > ' > > +test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' ' > + path="$(pwd)/BLUB" && > + touch "$path" && > + downcased="$(echo "$path" | tr A-Z a-z)" && > + git add "$downcased" > +' One problem with the above test is that it leaves it unspecified if the resulting index entry is "blub" or "BLUB". Shouldn't we verify that "git add" adds an expected path to the index, instead of blindly trusting that it says "Yeah, I did as I was told" with its exit status? Would we be adding 'blub' as that is what we told 'git' to add, or would it be 'BLUB' as that is what exists on the filesystem that is case insensitive but case preserving? On a project whose participants all are on case insensitive filesystems, the above does not matter by definition, but once a project wants to work with their case sensitive friends, it starts to matter. Other than that, looks good to me. Thanks. > + > test_done ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-25 3:06 ` Junio C Hamano @ 2018-12-25 8:46 ` Junio C Hamano 2019-01-18 12:55 ` Johannes Schindelin 0 siblings, 1 reply; 15+ messages in thread From: Junio C Hamano @ 2018-12-25 8:46 UTC (permalink / raw) To: Johannes Schindelin via GitGitGadget; +Cc: git, Johannes Schindelin Junio C Hamano <gitster@pobox.com> writes: > the resulting index entry is "blub" or "BLUB". Shouldn't we verify > that "git add" adds an expected path to the index, instead of > blindly trusting that it says "Yeah, I did as I was told" with its > exit status? Would we be adding 'blub' as that is what we told > 'git' to add, or would it be 'BLUB' as that is what exists on the > filesystem that is case insensitive but case preserving? Needless to say, the last part of the above is a mere thetorical question, and I am not questioning the established behaviour or suggesting to "improve" it. On a case insensitive filesystem, we trust what readdir() gave us (but match them with pathspec case insensitively) for a new path that is not in the index. When we update the contents of a path that is already in the index, we preserve the case in the index, even when readdir() reports the same path in different case (iow, we trust the case in the index more than what readdir() gives us).. What I am wondering in the above is if we should document that in the test, perhaps with a simple git ls-files blub >actual && echo BLUB >expect && test_cmp expect actual or something like that. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode 2018-12-25 8:46 ` Junio C Hamano @ 2019-01-18 12:55 ` Johannes Schindelin 0 siblings, 0 replies; 15+ messages in thread From: Johannes Schindelin @ 2019-01-18 12:55 UTC (permalink / raw) To: Junio C Hamano; +Cc: Johannes Schindelin via GitGitGadget, git Hi Junio, first of all, my apologies for the incorrect commit message (you missed it, too, though): it is not about respecting core.fileMode, but about core.ignoreCase. On Tue, 25 Dec 2018, Junio C Hamano wrote: > Junio C Hamano <gitster@pobox.com> writes: > > > the resulting index entry is "blub" or "BLUB". Shouldn't we verify > > that "git add" adds an expected path to the index, instead of > > blindly trusting that it says "Yeah, I did as I was told" with its > > exit status? Would we be adding 'blub' as that is what we told > > 'git' to add, or would it be 'BLUB' as that is what exists on the > > filesystem that is case insensitive but case preserving? > > Needless to say, the last part of the above is a mere thetorical > question, and I am not questioning the established behaviour or > suggesting to "improve" it. On a case insensitive filesystem, we > trust what readdir() gave us (but match them with pathspec case > insensitively) for a new path that is not in the index. When we > update the contents of a path that is already in the index, we > preserve the case in the index, even when readdir() reports the same > path in different case (iow, we trust the case in the index more > than what readdir() gives us).. > > What I am wondering in the above is if we should document that in > the test, perhaps with a simple > > git ls-files blub >actual && > echo BLUB >expect && > test_cmp expect actual > > or something like that. Actually, I would interpret the description in our documentation to mean that Git does not want to trust what readdir() gave us but heed what the user said, i.e. when `BLUB` is added as `git add blub`, Git really should think that it is `blub`, not `BLUB` (i.e. the exact opposite of what you suggest). From Documentation/config/core.txt's section about `core.ignoreCase`: For example, if a directory listing finds "makefile" when Git expects "Makefile", Git will assume it is really the same file, and continue to remember it as "Makefile". Ciao, Dscho ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 0/1] Make abspath() aware of case-insensitive filesystems 2018-12-24 22:56 ` [PATCH v3 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 2018-12-24 22:56 ` [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget @ 2019-01-18 13:24 ` Johannes Schindelin via GitGitGadget 2019-01-18 13:24 ` [PATCH v4 1/1] abspath_part_inside_repo: respect core.ignoreCase Johannes Schindelin via GitGitGadget 1 sibling, 1 reply; 15+ messages in thread From: Johannes Schindelin via GitGitGadget @ 2019-01-18 13:24 UTC (permalink / raw) To: git; +Cc: Junio C Hamano It is completely legitimate these days to call git add with absolute paths. Of course, on a case-insensitive file system, users rightfully expect the argument to be handled case-insensitively, too. This patch makes it so. Git for Windows carried this patch for over one and a half years already, I think it is time to get it into git.git. Changes since v3: * Fixed the oneline (it talked about core.fileMode when it really wanted to talk about core.ignoreCase!). Change since v2: * Replaced MINGW prerequisite in the test by CASE_INSENSITIVE_FS. v1 was sent out without a change by mistake. Sorry. Johannes Schindelin (1): abspath_part_inside_repo: respect core.ignoreCase setup.c | 6 +++--- t/t3700-add.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) base-commit: 77556354bb7ac50450e3b28999e3576969869068 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-104%2Fdscho%2Fcase-insensitive-abspath-v4 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-104/dscho/case-insensitive-abspath-v4 Pull-Request: https://github.com/gitgitgadget/git/pull/104 Range-diff vs v3: 1: b935e11d21 ! 1: 3fb927fc77 abspath_part_inside_repo: respect core.fileMode @@ -1,6 +1,6 @@ Author: Johannes Schindelin <johannes.schindelin@gmx.de> - abspath_part_inside_repo: respect core.fileMode + abspath_part_inside_repo: respect core.ignoreCase If the file system is case-insensitive, we really must be careful to ignore differences in case only. -- gitgitgadget ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 1/1] abspath_part_inside_repo: respect core.ignoreCase 2019-01-18 13:24 ` [PATCH v4 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget @ 2019-01-18 13:24 ` Johannes Schindelin via GitGitGadget 0 siblings, 0 replies; 15+ messages in thread From: Johannes Schindelin via GitGitGadget @ 2019-01-18 13:24 UTC (permalink / raw) To: git; +Cc: Junio C Hamano, Johannes Schindelin From: Johannes Schindelin <johannes.schindelin@gmx.de> If the file system is case-insensitive, we really must be careful to ignore differences in case only. This fixes https://github.com/git-for-windows/git/issues/735 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- setup.c | 6 +++--- t/t3700-add.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.c b/setup.c index 1be5037f12..291bfb2128 100644 --- a/setup.c +++ b/setup.c @@ -39,7 +39,7 @@ static int abspath_part_inside_repo(char *path) off = offset_1st_component(path); /* check if work tree is already the prefix */ - if (wtlen <= len && !strncmp(path, work_tree, wtlen)) { + if (wtlen <= len && !fspathncmp(path, work_tree, wtlen)) { if (path[wtlen] == '/') { memmove(path, path + wtlen + 1, len - wtlen); return 0; @@ -59,7 +59,7 @@ static int abspath_part_inside_repo(char *path) path++; if (*path == '/') { *path = '\0'; - if (strcmp(real_path(path0), work_tree) == 0) { + if (fspathcmp(real_path(path0), work_tree) == 0) { memmove(path0, path + 1, len - (path - path0)); return 0; } @@ -68,7 +68,7 @@ static int abspath_part_inside_repo(char *path) } /* check whole path */ - if (strcmp(real_path(path0), work_tree) == 0) { + if (fspathcmp(real_path(path0), work_tree) == 0) { *path0 = '\0'; return 0; } diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 37729ba258..be582a513b 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -402,4 +402,11 @@ test_expect_success 'all statuses changed in folder if . is given' ' test $(git ls-files --stage | grep ^100755 | wc -l) -eq 0 ' +test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' ' + path="$(pwd)/BLUB" && + touch "$path" && + downcased="$(echo "$path" | tr A-Z a-z)" && + git add "$downcased" +' + test_done -- gitgitgadget ^ permalink raw reply related [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-01-18 13:24 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-12-21 11:32 [PATCH 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 2018-12-21 11:32 ` [PATCH 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget 2018-12-22 18:11 ` Carlo Arenas 2018-12-24 18:54 ` Johannes Schindelin 2018-12-24 22:34 ` [PATCH v2 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 2018-12-24 22:34 ` [PATCH v2 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget 2018-12-25 10:42 ` Torsten Bögershausen 2019-01-18 12:58 ` Johannes Schindelin 2018-12-24 22:56 ` [PATCH v3 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 2018-12-24 22:56 ` [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode Johannes Schindelin via GitGitGadget 2018-12-25 3:06 ` Junio C Hamano 2018-12-25 8:46 ` Junio C Hamano 2019-01-18 12:55 ` Johannes Schindelin 2019-01-18 13:24 ` [PATCH v4 0/1] Make abspath() aware of case-insensitive filesystems Johannes Schindelin via GitGitGadget 2019-01-18 13:24 ` [PATCH v4 1/1] abspath_part_inside_repo: respect core.ignoreCase Johannes Schindelin via GitGitGadget
Code repositories for project(s) associated with this public inbox https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).