git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX
@ 2017-04-29 10:47 Robert Eisele
  2017-04-29 15:17 ` Torsten Bögershausen
  2017-04-29 20:18 ` Kevin Daudt
  0 siblings, 2 replies; 5+ messages in thread
From: Robert Eisele @ 2017-04-29 10:47 UTC (permalink / raw)
  To: git

Hi,

after having committed folders with lower case naming, I decided to 
rename them to upper-case names. Expecting git to detect them as 
renamings, it started a new parallel hierarchy with new files, which I 
had to add/commit.

It was a kinda strange behavior, which I fixed by rename the folder to 
something completely different, commit and rename the folder again to 
the desired value.

Is this an actual desired behavior or is it a bug?

Robert


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

* Re: Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX
  2017-04-29 10:47 Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX Robert Eisele
@ 2017-04-29 15:17 ` Torsten Bögershausen
  2017-04-29 20:18 ` Kevin Daudt
  1 sibling, 0 replies; 5+ messages in thread
From: Torsten Bögershausen @ 2017-04-29 15:17 UTC (permalink / raw)
  To: Robert Eisele, git


>
> after having committed folders with lower case naming, I decided to rename them
> to upper-case names. Expecting git to detect them as renamings, it started a
> new parallel hierarchy with new files, which I had to add/commit.
>
> It was a kinda strange behavior, which I fixed by rename the folder to
> something completely different, commit and rename the folder again to the
> desired value.
>
> Is this an actual desired behavior or is it a bug?

It is expected (but may be unexpected), I hope these hints are not too harsh:
You can blame the vendor of the OS,
who decided to design a file system which ignores the case of files.
(Or yourself, because you use it)
(Or yourself, because you can install a HFS+ partition under OSX which
is NOT case insensitive, but few people seem to know about this or use it)
(harsh mode off)

The correct way to rename a file under Git is to use Git:

git init
Initialized empty Git repository in /private/tmp/ttt/.git/
user@Mac:/tmp/ttt>mkdir dir1
user@Mac:/tmp/ttt>echo File >dir1/file
user@Mac:/tmp/ttt>git add dir1/file
user@Mac:/tmp/ttt>git commit -m "add dir1/file"
[master (root-commit) 14d3862] add dir1/file
  1 file changed, 1 insertion(+)
  create mode 100644 dir1/file
user@Mac:/tmp/ttt>git mv dir1/file DIR1/FILE
user@Mac:/tmp/ttt>git commit  "mv dir1/file DIR1/FILE"
user@Mac:/tmp/ttt>git ls-files
DIR1/FILE


>
> Robert
>

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

* Re: Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX
  2017-04-29 10:47 Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX Robert Eisele
  2017-04-29 15:17 ` Torsten Bögershausen
@ 2017-04-29 20:18 ` Kevin Daudt
  2017-05-01  1:47   ` Junio C Hamano
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Daudt @ 2017-04-29 20:18 UTC (permalink / raw)
  To: Robert Eisele; +Cc: git

On Sat, Apr 29, 2017 at 12:47:13PM +0200, Robert Eisele wrote:
> Hi,
> 
> after having committed folders with lower case naming, I decided to rename
> them to upper-case names. Expecting git to detect them as renamings, it
> started a new parallel hierarchy with new files, which I had to add/commit.
> 
> It was a kinda strange behavior, which I fixed by rename the folder to
> something completely different, commit and rename the folder again to the
> desired value.
> 
> Is this an actual desired behavior or is it a bug?
> 
> Robert
> 

Note that git does not store that files are renamed. So a remove + add
is the same as a rename in git. Only git status shows it when you for
example use git mv directly, but this information is lost on commit.
Instead of storing it get relies on detecting what (parts of ) files got
renamed, copied etc.

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

* Re: Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX
  2017-04-29 20:18 ` Kevin Daudt
@ 2017-05-01  1:47   ` Junio C Hamano
  2017-05-01 17:07     ` Kevin Daudt
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2017-05-01  1:47 UTC (permalink / raw)
  To: Kevin Daudt; +Cc: Robert Eisele, git

Kevin Daudt <me@ikke.info> writes:

> Note that git does not store that files are renamed. So a remove + add
> is the same as a rename in git. Only git status shows it when you for
> example use git mv directly, but this information is lost on commit.

Are you sure about the last sentence?  I do not recall teaching
anything special to "git status".  If "git status" says A was
created by renaming B, and if you committed that state was-is, "git
show" on the result commit _should_ say the same thing, I would
think.

> Instead of storing it get relies on detecting what (parts of ) files got
> renamed, copied etc.

That statement I belieave is true.

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

* Re: Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX
  2017-05-01  1:47   ` Junio C Hamano
@ 2017-05-01 17:07     ` Kevin Daudt
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Daudt @ 2017-05-01 17:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Robert Eisele, git

On Sun, Apr 30, 2017 at 06:47:29PM -0700, Junio C Hamano wrote:
> Kevin Daudt <me@ikke.info> writes:
> 
> > Note that git does not store that files are renamed. So a remove + add
> > is the same as a rename in git. Only git status shows it when you for
> > example use git mv directly, but this information is lost on commit.
> 
> Are you sure about the last sentence?  I do not recall teaching
> anything special to "git status".  If "git status" says A was
> created by renaming B, and if you committed that state was-is, "git
> show" on the result commit _should_ say the same thing, I would
> think.

Yes, of course, you are right. Git status also detects a file being
renamed instead of relying on it being recorded.
> 
> > Instead of storing it get relies on detecting what (parts of ) files got
> > renamed, copied etc.
> 
> That statement I belieave is true.

Why are you reserved here?

Kevin.

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

end of thread, other threads:[~2017-05-01 17:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-29 10:47 Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX Robert Eisele
2017-04-29 15:17 ` Torsten Bögershausen
2017-04-29 20:18 ` Kevin Daudt
2017-05-01  1:47   ` Junio C Hamano
2017-05-01 17:07     ` Kevin Daudt

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).