Reputation: 77201
We work in a mixed case sensitive/insensitive environment (cywgin/linux), and today someone created a small havoc in our workflow by renaming a file, changing an S to an s. This caused all sorts of interesting merge issues across branches, and to be quite honest no-one's entirely sure of what happened.
What is the most appropriate way to change casing of a file under git for cygwin? I must stress that we are case sensitive and normally do this right - if it wasn't for that S.
Upvotes: 4
Views: 1328
Reputation: 470
Does your cygwin correctly recognize user's group name? I can be not recognized group issue. You may want to check this chmod cannot change group permission on cygwin
Upvotes: 0
Reputation: 765
I just had a problem similar to this where I just wanted to rename a directory, 'Scripts', to 'scripts'. I am currently working in Cygwin so it wasn't quite so easy. If I attempt to do it as I would in GNU/Linux, I get an error.
$ git mv foo Foo
fatal: renaming foo failed: Invalid argument
However, I realized I could bypass what I assume are Windows' shortcomings by moving twice, first to a name that doesn't collide, and then to the actually desired name.
$ git mv foo Foo2 && git mv Foo2 Foo
I had stashed my working tree away for this change though so I could commit it separately and evidently didn't think things through because now the files beneath the directory that I moved fail to merge from the stash to my tree. :-/ In my case, it's a minor problem though (and to be safe, I tarballed the tree before attempting this, I so I can always just do it the forceful unversioned way... :P).
Upvotes: 4
Reputation: 323892
I'd like to point that as a fallback you can manipulate entries in index (the staging area), from where you would be able to commit with "git commit" (not "git commit -a") with git update-index plumbing (low level) command.
Upvotes: 1
Reputation: 497462
Having thought about it a couple minutes, it seems very likely git-mv
would do what you need to. I'm fairly sure that it will attempt the rename (which might be a no-op on a a case-insensitive OS) then add the rename to the index. This should be based on the arguments, not on the actual file - I see rename_cache_entry_at(pos, dst);
in builtin-mv.c.
I'm not sure if this is part of what you're asking or not, but with respect to your branch chaos, here's the general approach you probably want to take:
Upvotes: 2