All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] git-init: autodetect core.ignorecase
@ 2008-05-11 16:16 Steffen Prohaska
  2008-05-11 16:16 ` [PATCH 2/4] t0050: Test " Steffen Prohaska
  2008-05-11 16:21 ` [PATCH 0/4] core.ignorecase Steffen Prohaska
  0 siblings, 2 replies; 6+ messages in thread
From: Steffen Prohaska @ 2008-05-11 16:16 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git, Linus Torvalds, Dmitry Potapov, Steffen Prohaska

From: Dmitry Potapov <dpotapov@gmail.com>

We already detect if symbolic links are supported by the filesystem.
This patch adds autodetect for case-insensitive filesystems, such
as VFAT and others.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 builtin-init-db.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/builtin-init-db.c b/builtin-init-db.c
index 2854868..3721bd2 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -255,8 +255,8 @@ static int create_default_files(const char *git_dir, const char *template_path)
 			git_config_set("core.worktree", work_tree);
 	}
 
-	/* Check if symlink is supported in the work tree */
 	if (!reinit) {
+		/* Check if symlink is supported in the work tree */
 		path[len] = 0;
 		strcpy(path + len, "tXXXXXX");
 		if (!close(xmkstemp(path)) &&
@@ -267,6 +267,12 @@ static int create_default_files(const char *git_dir, const char *template_path)
 			unlink(path); /* good */
 		else
 			git_config_set("core.symlinks", "false");
+
+		/* Check if the filesystem is case-insensitive */
+		path[len] = 0;
+		strcpy(path + len, "CoNfIg");
+		if (!access(path, F_OK))
+			git_config_set("core.ignorecase", "true");
 	}
 
 	return reinit;
-- 
1.5.5.1.313.g9decb

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] t0050: Test autodetect core.ignorecase
  2008-05-11 16:16 [PATCH 1/4] git-init: autodetect core.ignorecase Steffen Prohaska
@ 2008-05-11 16:16 ` Steffen Prohaska
  2008-05-11 16:16   ` [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity Steffen Prohaska
  2008-05-11 16:21 ` [PATCH 0/4] core.ignorecase Steffen Prohaska
  1 sibling, 1 reply; 6+ messages in thread
From: Steffen Prohaska @ 2008-05-11 16:16 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git, Linus Torvalds, Steffen Prohaska

Verify if core.ignorecase is automatically set to 'true' during
repository initialization if the file system is case insensitive,
and unset or 'false' otherwise.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 t/t0050-filesystem.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index 3fbad77..66d3647 100755
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
@@ -7,6 +7,7 @@ test_description='Various filesystem issues'
 auml=`printf '\xc3\xa4'`
 aumlcdiar=`printf '\x61\xcc\x88'`
 
+case_insensitive=
 test_expect_success 'see if we expect ' '
 
 	test_case=test_expect_success
@@ -17,6 +18,7 @@ test_expect_success 'see if we expect ' '
 	if test "$(cat junk/CamelCase)" != good
 	then
 		test_case=test_expect_failure
+		case_insensitive=t
 		say "will test on a case insensitive filesystem"
 	fi &&
 	rm -fr junk &&
@@ -32,6 +34,20 @@ test_expect_success 'see if we expect ' '
 	rm -fr junk
 '
 
+if test "$case_insensitive"
+then
+test_expect_success "detection of case insensitive filesystem during repo init" '
+
+	test $(git config --bool core.ignorecase) = true
+'
+else
+test_expect_success "detection of case insensitive filesystem during repo init" '
+
+	! git config --bool core.ignorecase >/dev/null ||
+	test $(git config --bool core.ignorecase) = false
+'
+fi
+
 test_expect_success "setup case tests" '
 
 	touch camelcase &&
-- 
1.5.5.1.313.g9decb

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity
  2008-05-11 16:16 ` [PATCH 2/4] t0050: Test " Steffen Prohaska
@ 2008-05-11 16:16   ` Steffen Prohaska
  2008-05-11 16:16     ` [PATCH 4/4] t0050: Add test for case insensitive add Steffen Prohaska
  2008-05-11 17:10     ` [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity Linus Torvalds
  0 siblings, 2 replies; 6+ messages in thread
From: Steffen Prohaska @ 2008-05-11 16:16 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git, Linus Torvalds, Steffen Prohaska

Case insensitive file handling is only active when
core.ignorecase = true.  Hence, we need to set it to give the tests
in t0050 a chance to succeed.  Setting core.ignorecase explicitly
allows to test some aspects of case handling even on case sensitive file
systems.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 t/t0050-filesystem.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index 66d3647..399b45d 100755
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
@@ -50,6 +50,7 @@ fi
 
 test_expect_success "setup case tests" '
 
+	git config core.ignorecase true &&
 	touch camelcase &&
 	git add camelcase &&
 	git commit -m "initial" &&
-- 
1.5.5.1.313.g9decb

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] t0050: Add test for case insensitive add
  2008-05-11 16:16   ` [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity Steffen Prohaska
@ 2008-05-11 16:16     ` Steffen Prohaska
  2008-05-11 17:10     ` [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity Linus Torvalds
  1 sibling, 0 replies; 6+ messages in thread
From: Steffen Prohaska @ 2008-05-11 16:16 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git, Linus Torvalds, Steffen Prohaska

Add should recognize if a file is added with a different case and add
the file using its original name.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 t/t0050-filesystem.sh |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index 399b45d..0e33c4b 100755
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
@@ -77,6 +77,16 @@ $test_case 'merge (case change)' '
 
 '
 
+$test_case 'add (with different case)' '
+
+	git reset --hard initial &&
+	rm camelcase &&
+	echo 1 >CamelCase &&
+	git add CamelCase &&
+	test $(git-ls-files | grep -i camelcase | wc -l) = 1
+
+'
+
 test_expect_success "setup unicode normalization tests" '
 
   test_create_repo unicode &&
-- 
1.5.5.1.313.g9decb

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 0/4] core.ignorecase
  2008-05-11 16:16 [PATCH 1/4] git-init: autodetect core.ignorecase Steffen Prohaska
  2008-05-11 16:16 ` [PATCH 2/4] t0050: Test " Steffen Prohaska
@ 2008-05-11 16:21 ` Steffen Prohaska
  1 sibling, 0 replies; 6+ messages in thread
From: Steffen Prohaska @ 2008-05-11 16:21 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git, Linus Torvalds, Dmitry Potapov

[ I forgot the "--compose" switch to "\x05git send-email", so the intro
   follows as a reply to PATCH 1/4. ]


This patch series improves initialization of a repository and adds  
some tests
for core.ignorecase.  It should be applied on top of lt/case- 
insensitive.

  [PATCH 1/4] git-init: autodetect core.ignorecase

     1/4 was proposed some time ago as
     http://mid.gmane.org/<20080325104931.GJ25381@dpotapov.dyndns.org>
     but did not make it into Junio's next.

  [PATCH 2/4] t0050: Test autodetect core.ignorecase
  [PATCH 3/4] t0050: Set core.ignorecase case to activate case  
insensitivity
  [PATCH 4/4] t0050: Add test for case insensitive add

     2-4/4 add some tests.

         Steffen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity
  2008-05-11 16:16   ` [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity Steffen Prohaska
  2008-05-11 16:16     ` [PATCH 4/4] t0050: Add test for case insensitive add Steffen Prohaska
@ 2008-05-11 17:10     ` Linus Torvalds
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2008-05-11 17:10 UTC (permalink / raw
  To: Steffen Prohaska; +Cc: Junio C Hamano, git



On Sun, 11 May 2008, Steffen Prohaska wrote:
>
> Case insensitive file handling is only active when
> core.ignorecase = true.  Hence, we need to set it to give the tests
> in t0050 a chance to succeed.  Setting core.ignorecase explicitly
> allows to test some aspects of case handling even on case sensitive file
> systems.

The patch series looks fine to me, but I just wanted to underline the use 
of that "*some*aspects*" part.

On a filesystem that is case sensitive, doing "core.ignorecase = true" 
doesn't magically make git act as if the filesystem was insensitive to 
case. In particular, since the filesystem very much can contain two 
different versions of a filename in different case, git will actually 
notice that, and notice that "CamelCase" and "camelcase" are not 
necessarily the same file.

To emulate case insensitivity on filesyststems that are actually 
sensitive, we could do some tests that do things like

	echo Hello > CamelCase
	ln CamelCase camelcase

and now git will see something that is *closer* to a real case-insensitive 
filesystem: two names that resolve to the same stat information.

It's still obviously not identical (because "readdir()" will get two 
entries), and as such a test that succeeds in a true case-insensitive 
environment will not necessarily work in the above fake kind of situation, 
but at least you can test some cases.

Renaming the same file to a case that is different is also a worthwhile 
thing to try to "emulate" case insensitivity.

			Linus

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-11 17:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-11 16:16 [PATCH 1/4] git-init: autodetect core.ignorecase Steffen Prohaska
2008-05-11 16:16 ` [PATCH 2/4] t0050: Test " Steffen Prohaska
2008-05-11 16:16   ` [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity Steffen Prohaska
2008-05-11 16:16     ` [PATCH 4/4] t0050: Add test for case insensitive add Steffen Prohaska
2008-05-11 17:10     ` [PATCH 3/4] t0050: Set core.ignorecase case to activate case insensitivity Linus Torvalds
2008-05-11 16:21 ` [PATCH 0/4] core.ignorecase Steffen Prohaska

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.