{"thread":{"id":"7277","subject":"Directory in one branch, file in another = can't switch branches","startedAt":"2007-03-16T22:17:06Z","lastAt":"2007-03-16T22:59:01Z","messageCount":2,"participants":["Steven Grimm"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"37279","messageId":"45FB1762.7040505@midwinter.com","threadId":"7277","inReplyTo":null,"subject":"Directory in one branch, file in another = can't switch branches","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-03-16T22:17:06Z","receivedAt":"2007-03-16T22:17:06Z","isPatch":false,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"We've hit this problem with a git-svn-based repository where some stuff \ngot reorganized, but it happens in plain git too; if you have a branch \nwith a file called, say, \"foo\" and another branch with a file called \n\"foo/bar\", you can't switch between branches even if there are no \nuncommitted edits in either branch.\n\nTo reproduce (I'm using version 1.5.0.1.74.g2470):\n\n% git init-db\nInitialized empty Git repository in .git/\n% echo \"this is a test file\" > testing\n% git add testing\n% git commit -a -m \"initial commit on master\"\nCreated initial commit 1a9cb1bf3a5475f0bb05d1e7c59839ba0a388be7\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 testing\n% git checkout -b with-dir\nSwitched to a new branch \"with-dir\"\n% mv testing testing-\n% mkdir testing\n% mv testing- testing/datafile\n% git add testing/datafile\n% git commit -a -m \"commit with subdir\"      \nCreated commit cdcb2af2a8dae8a2c5c3c143cb00b4863291cc17\n 2 files changed, 1 insertions(+), 1 deletions(-)\n delete mode 100644 testing\n create mode 100644 testing/datafile\n% git checkout master\nfatal: Untracked working tree file 'testing' would be overwritten by merge.\n\nYou can work around it by renaming the directory, but git should really \nblow away the directory if it doesn't contain any untracked / modified \nfiles.\n\n-Steve\n"},{"id":"37283","messageId":"45FB2135.10106@midwinter.com","threadId":"7277","inReplyTo":"45FB1762.7040505@midwinter.com","subject":"Re: Directory in one branch, file in another = can't switch branches","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-03-16T22:59:01Z","receivedAt":"2007-03-16T22:59:01Z","isPatch":false,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"Ah, I see someone else picked up on this from IRC already (\"bug in \nread-tree -m on A -> A/A\"). Sorry for the noise; please ignore this thread.\n\n-Steve\n\n\nSteven Grimm wrote:\n> We've hit this problem with a git-svn-based repository where some \n> stuff got reorganized, but it happens in plain git too; if you have a \n> branch with a file called, say, \"foo\" and another branch with a file \n> called \"foo/bar\", you can't switch between branches even if there are \n> no uncommitted edits in either branch.\n>\n> To reproduce (I'm using version 1.5.0.1.74.g2470):\n>\n> % git init-db\n> Initialized empty Git repository in .git/\n> % echo \"this is a test file\" > testing\n> % git add testing\n> % git commit -a -m \"initial commit on master\"\n> Created initial commit 1a9cb1bf3a5475f0bb05d1e7c59839ba0a388be7\n> 1 files changed, 1 insertions(+), 0 deletions(-)\n> create mode 100644 testing\n> % git checkout -b with-dir\n> Switched to a new branch \"with-dir\"\n> % mv testing testing-\n> % mkdir testing\n> % mv testing- testing/datafile\n> % git add testing/datafile\n> % git commit -a -m \"commit with subdir\"      Created commit \n> cdcb2af2a8dae8a2c5c3c143cb00b4863291cc17\n> 2 files changed, 1 insertions(+), 1 deletions(-)\n> delete mode 100644 testing\n> create mode 100644 testing/datafile\n> % git checkout master\n> fatal: Untracked working tree file 'testing' would be overwritten by \n> merge.\n>\n> You can work around it by renaming the directory, but git should \n> really blow away the directory if it doesn't contain any untracked / \n> modified files.\n>\n> -Steve\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"}]}