Re: git: cannot rename foo to Foo on a case-insensitive filesystem (e.g. on Windows)

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

 



Petr Baudis wrote:
On Tue, Aug 28, 2007 at 12:43:36PM CEST, Johannes Schindelin wrote:
The problem is _really_ the filesystem, as you experienced. You just cannot do an "mv foo Foo". You cannot. And that is _exactly_ the problem you experience with git, since at some point, git tries exactly that: "mv foo Foo".

So it really, really, really is not a git problem. Just as I told you in my other reply.

Well, naively speaking (I have no idea how case _in_sensitivity is
actually implemented in Git, and I don't even have any sane way how to
test it :), what would happen if you just rename 'foo' to 'Foo' _only_
in the index? I think that's preciselly what the OP wants and shouldn't
erally break anything and should also be pretty simple to implement (the
question is if documentation, cluttery and bitrot costs of this change
would pay off for the feature).


If you rename 'foo' to 'Foo' in the index, the filesystem will still
say it has 'foo' in the working directory.

You could ofcourse rename it in the index, delete it from the working
directory and then check it out from the index under the new name, but
that means there'll be a short time during which the file is deleted.
That doesn't feel entirely safe to me. Better then to do something like


git_rename("foo", "Foo");
if (src_and_dst_are_same) {
	git_rename ("foo", "foo1");
	git_rename ("foo1", "Foo");
}

Throw in a loop to make sure we find a unique name and that should be
sorted.

--
Andreas Ericsson                   andreas.ericsson@xxxxxx
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
-
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