git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH v4 1/1] abspath_part_inside_repo: respect core.ignoreCase
Date: Fri, 18 Jan 2019 05:24:54 -0800 (PST)	[thread overview]
Message-ID: <3fb927fc77232279c1c85db003a5f55de4eabd29.1547817893.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.104.v4.git.gitgitgadget@gmail.com>

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

      reply	other threads:[~2019-01-18 13:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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       ` Johannes Schindelin via GitGitGadget [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3fb927fc77232279c1c85db003a5f55de4eabd29.1547817893.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).