[PATCH 0/7] Final words

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




So the whole patch series looks like this:

	 Makefile            |    1 +
	 builtin-read-tree.c |    2 +-
	 cache.h             |   36 +++++++++-------
	 config.c            |    5 ++
	 dir.c               |    2 +-
	 environment.c       |    1 +
	 name-hash.c         |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++
	 read-cache.c        |   65 +--------------------------
	 unpack-trees.c      |   43 ++++++++++++++++---
	 unpack-trees.h      |   22 +++++-----
	 10 files changed, 199 insertions(+), 97 deletions(-)
	 create mode 100644 name-hash.c

and clearly does add more lines than it deletes, but it all really is 
pretty simple, and none of this is rocket science or even very intrusive. 
What took me longest to do was not the actual code itself, but to get 
_just_ the right approach so that the end result would be as simple and 
nonintrusive as possible. That core patch 6/7 was redone at least ten 
times before I was happy with it.

Anyway, perhaps exactly because I tried very hard to make it all make 
sense, I'm actually very very happy with the patch. I suspect it's too 
late for v1.5.5 even if I think all the patches are really simple, but I'm 
hoping it can go into at least "pu" and have people actually *test* it.

Talking about testing, the kind of safety I wanted to get with this patch 
is perhaps best described by the tests I did not on case-insensitive 
filesystems, but on regular *good* filesystems together with setting the 
"core.ignorecase" config variable.

Here's an example of how that patch 6/7 works and tries to be really 
careful even on a case-sensitive filesystem:

	mkdir test-case
	cd test-case
	git init
	git config core.ignorecase true

	echo "File" > File
	git add File
	git commit -m "Create 'File'"

	git checkout -b other
	git rm File
	echo "file" > file
	git add file
	git commit -m "Create 'file'"

	echo "File" > File
	git checkout master

and now it complains about

	error: Untracked working tree file 'File' would be overwritten by merge.

which is correct, because while it is doing its case-insensitivity checks, 
it also noticed that "File" did *not* match the stat information for 
'file', so it really _is_ an untracked working tree file.

So it's actually trying to be a lot more careful than just saying "ok, we 
already know about 'File'". See what happens next:

	rm File
	ln file File
	git checkout master

and now it very happily did the switch to master, even though 'File' got 
overwritten, because now it again found that untracked file 'File', but 
now it could match it up *exactly* against the case-insensitive file 
'file', so git was happy that it wasn't actually throwing away any info, 
and the fact that it overwrite 'File' was ok, because it considered it the 
same file as 'file'.

So the whole thing is not only able to handle these name aliases, it 
actually handles them by checking that it's safe.

Final note: I also did notice that I didn't fix the 'git add" case like I 
thought I did, it currently only fixes "git status". So I still want to 
fix "git add" and "git mv" to do the right thing when there are case- 
insensitive aliases, but that's a separate issue from this particular 
series..

		Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux