git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX

From
Torsten Bögershausen <tboegi@web.de>
Date
Apr 29, 2017, 15:17 UTC
Message-ID
<0f4f39c3-5c8f-8b3b-999b-57b9e3f27ac6@web.de>
In-Reply-To
<10d4f73b-b4bd-4cf8-5727-cdaf10ab713a@xarg.org>
Show 10 quoted lines
>
> 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
>
Previous: Robert EiseleNext: Kevin Daudt
Message 2 of 5 in “Bug: Git rename does not work if folder naming was changed from lower to upper case on OSX”
  1. Robert EiseleApr 29, 2017
  2. Torsten BögershausenApr 29, 2017
  3. Kevin DaudtApr 29, 2017
  4. Junio C HamanoMay 1, 2017
  5. Kevin DaudtMay 1, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.