{"thread":{"id":"28307","subject":"\"Your local changes ... would be overwritten\" bug","startedAt":"2011-09-05T16:25:53Z","lastAt":"2011-09-06T09:46:01Z","messageCount":6,"participants":["Hannu Koivisto","Matthieu Moy","Vijay Lakshminarayanan","Andrew Ardill","Clemens Buchacher"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"174874","messageId":"8362l73qi6.fsf@kalahari.s2.org","threadId":"28307","inReplyTo":null,"subject":"\"Your local changes ... would be overwritten\" bug","fromName":"Hannu Koivisto","fromEmail":"azure@iki.fi","sentAt":"2011-09-05T16:25:53Z","receivedAt":"2011-09-05T16:25:53Z","isPatch":false,"sender":{"key":"azure@iki.fi","avatar":null},"body":"Greetings,\n\nI have a problem where \"git checkout origin/another-branch\" in master\nshould remove a set of files but instead I get:\n\nerror: Your local changes to the following files would be overwritten by checkout:\n        file1\n        file2\n        ...\nPlease, commit your changes or stash them before you can switch branches.\nAborting\n\n(where the files listed are those that should be removed)\n\nThe problem occurs only if the checkout is not run in the top level\ndirectory of the repository and the files in question have execute\nbit set.  Before checkout, git status says\n\n# On branch master\nnothing to commit (working directory clean)\n\nThe following script can be used to reproduce the problem:\n\n-------------------------------------------\nmkdir temp\ncd temp\ngit init\necho foo > testfile\ngit add testfile\ngit commit -m \"test1\"\necho foo > testfile2\nchmod +x testfile2\ngit add testfile2\ngit commit -m \"test2\"\nmkdir foo\ncd foo\ngit co master~1\n--------------------------------------------\n\nThe problem disappears if one removes either the \"chmod +x\ntestfile2\" line or the \"cd foo\" line.\n\nI'm running Cygwin git 1.7.5.1 in Windows XP.\n\n-- \nHannu\n"},{"id":"174876","messageId":"vpqty8rx774.fsf@bauges.imag.fr","threadId":"28307","inReplyTo":"8362l73qi6.fsf@kalahari.s2.org","subject":"Re: \"Your local changes ... would be overwritten\" bug","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-09-05T16:52:31Z","receivedAt":"2011-09-05T16:52:31Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Hannu Koivisto <azure@iki.fi> writes:\n\n> The following script can be used to reproduce the problem:\n\n[...]\n\nI cannot reproduce on Linux.\n\n> I'm running Cygwin git 1.7.5.1 in Windows XP.\n\nProbably a dumb question (from a non-windows-user), but why not use the\nnative Git for windows?\n\nWhat happens if you run \"git status\" before running the problematic \"git\ncheckout\"? (I'm asking because \"git status\" refreshes the stat-cache, so\nit may change the result)\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"174880","messageId":"87wrdmrgbs.fsf@gmail.com","threadId":"28307","inReplyTo":"vpqty8rx774.fsf@bauges.imag.fr","subject":"Re: \"Your local changes ... would be overwritten\" bug","fromName":"Vijay Lakshminarayanan","fromEmail":"laksvij@gmail.com","sentAt":"2011-09-05T18:31:51Z","receivedAt":"2011-09-05T18:31:51Z","isPatch":false,"sender":{"key":"laksvij@gmail.com","avatar":null},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Hannu Koivisto <azure@iki.fi> writes:\n>\n>> The following script can be used to reproduce the problem:\n>\n> [...]\n>\n> I cannot reproduce on Linux.\n\nI can't either.\n\n>> I'm running Cygwin git 1.7.5.1 in Windows XP.\n\nI'm running cygwin git 1.7.5.1 in Windows Vista.\n\n$ mkdir temp\nd temp\ngit init\necho foo > testfile\ngit add testfile\ngit commit -m \"test1\"\necho foo > testfile2\nchmod +x testfile2\ngit add testfile2\ngit commit -m \"test2\"\nmkdir foo\ncd foo\ngit co master~1\n\nvijay@balrog ~/foo\n$ cd temp\n\nvijay@balrog ~/foo/temp\n$ git init\nInitialized empty Git repository in /home/vijay/foo/temp/.git/\n\nvijay@balrog ~/foo/temp\n$ echo foo > testfile\n\nvijay@balrog ~/foo/temp\n$ git add testfile\n\nvijay@balrog ~/foo/temp\n$ git commit -m \"test1\"\n[master (root-commit) 7564449] test1\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 testfile\n\nvijay@balrog ~/foo/temp\n$ echo foo > testfile2\n\nvijay@balrog ~/foo/temp\n$ chmod +x testfile2\n\nvijay@balrog ~/foo/temp\n$ git add testfile2\n\nvijay@balrog ~/foo/temp\n$ git commit -m \"test2\"\n[master 9675b55] test2\n\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100755 testfile2\n\nvijay@balrog ~/foo/temp\n$ mkdir foo\n\nvijay@balrog ~/foo/temp\n$ cd foo\n\nvijay@balrog ~/foo/temp/foo\n$ git co master~1\ngit: 'co' is not a git command. See 'git --help'.\n\nDid you mean one of these?\n        commit\n        clone\n        log\n\nvijay@balrog ~/foo/temp/foo\n$ git checkout master~1\nNote: checking out 'master~1'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by performing another checkout.\n\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -b with the checkout command again. Example:\n\n  git checkout -b new_branch_name\n\nHEAD is now at 7564449... test1\n\n> Probably a dumb question (from a non-windows-user), but why not use the\n> native Git for windows?\n\nDo you mean msysgit?  As a GNU/Linux user, I probably don't need to\nexplain the luxuries a bash prompt gives you.  In this scenario, cygwin\nis the closest approximation on Windows system.\n\nmsysgit comes with its own bash shell etc (which is good) but rather\nthan go that integration route, it's much simpler to have git working\nwithin cygwin when you're already used to it.\n\nCheers\n~vijay\n"},{"id":"174893","messageId":"CAH5451kKVEjDjwJE8Htid8PQiuEv91r2VjXx-22o26Kx6xy11Q@mail.gmail.com","threadId":"28307","inReplyTo":"87wrdmrgbs.fsf@gmail.com","subject":"Re: \"Your local changes ... would be overwritten\" bug","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2011-09-05T23:37:17Z","receivedAt":"2011-09-05T23:37:17Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"I can not reproduce on msysgit version 1.7.6.msysgit.0, for what it is worth.\n\nRegards,\n\nAndrew Ardill\n\n\n\nOn 6 September 2011 04:31, Vijay Lakshminarayanan <laksvij@gmail.com> wrote:\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>\n>> Hannu Koivisto <azure@iki.fi> writes:\n>>\n>>> The following script can be used to reproduce the problem:\n>>\n>> [...]\n>>\n>> I cannot reproduce on Linux.\n>\n> I can't either.\n>\n>>> I'm running Cygwin git 1.7.5.1 in Windows XP.\n>\n> I'm running cygwin git 1.7.5.1 in Windows Vista.\n>\n> $ mkdir temp\n> d temp\n> git init\n> echo foo > testfile\n> git add testfile\n> git commit -m \"test1\"\n> echo foo > testfile2\n> chmod +x testfile2\n> git add testfile2\n> git commit -m \"test2\"\n> mkdir foo\n> cd foo\n> git co master~1\n>\n> vijay@balrog ~/foo\n> $ cd temp\n>\n> vijay@balrog ~/foo/temp\n> $ git init\n> Initialized empty Git repository in /home/vijay/foo/temp/.git/\n>\n> vijay@balrog ~/foo/temp\n> $ echo foo > testfile\n>\n> vijay@balrog ~/foo/temp\n> $ git add testfile\n>\n> vijay@balrog ~/foo/temp\n> $ git commit -m \"test1\"\n> [master (root-commit) 7564449] test1\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>  create mode 100644 testfile\n>\n> vijay@balrog ~/foo/temp\n> $ echo foo > testfile2\n>\n> vijay@balrog ~/foo/temp\n> $ chmod +x testfile2\n>\n> vijay@balrog ~/foo/temp\n> $ git add testfile2\n>\n> vijay@balrog ~/foo/temp\n> $ git commit -m \"test2\"\n> [master 9675b55] test2\n>\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>  create mode 100755 testfile2\n>\n> vijay@balrog ~/foo/temp\n> $ mkdir foo\n>\n> vijay@balrog ~/foo/temp\n> $ cd foo\n>\n> vijay@balrog ~/foo/temp/foo\n> $ git co master~1\n> git: 'co' is not a git command. See 'git --help'.\n>\n> Did you mean one of these?\n>        commit\n>        clone\n>        log\n>\n> vijay@balrog ~/foo/temp/foo\n> $ git checkout master~1\n> Note: checking out 'master~1'.\n>\n> You are in 'detached HEAD' state. You can look around, make experimental\n> changes and commit them, and you can discard any commits you make in this\n> state without impacting any branches by performing another checkout.\n>\n> If you want to create a new branch to retain commits you create, you may\n> do so (now or later) by using -b with the checkout command again. Example:\n>\n>  git checkout -b new_branch_name\n>\n> HEAD is now at 7564449... test1\n>\n>> Probably a dumb question (from a non-windows-user), but why not use the\n>> native Git for windows?\n>\n> Do you mean msysgit?  As a GNU/Linux user, I probably don't need to\n> explain the luxuries a bash prompt gives you.  In this scenario, cygwin\n> is the closest approximation on Windows system.\n>\n> msysgit comes with its own bash shell etc (which is good) but rather\n> than go that integration route, it's much simpler to have git working\n> within cygwin when you're already used to it.\n>\n> Cheers\n> ~vijay\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"},{"id":"174899","messageId":"20110906073436.GA28490@ecki","threadId":"28307","inReplyTo":"8362l73qi6.fsf@kalahari.s2.org","subject":"Re: \"Your local changes ... would be overwritten\" bug","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2011-09-06T07:34:36Z","receivedAt":"2011-09-06T07:34:36Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"Hi,\n\nOn Mon, Sep 05, 2011 at 07:25:53PM +0300, Hannu Koivisto wrote:\n> \n> I have a problem where \"git checkout origin/another-branch\" in master\n> should remove a set of files but instead I get:\n> \n> error: Your local changes to the following files would be overwritten by checkout:\n>         file1\n>         file2\n>         ...\n> Please, commit your changes or stash them before you can switch branches.\n> Aborting\n\nCould you set a breakpoint in add_rejected_path and send us the\nbacktrace? Like this:\n\n$ gdb --args git checkout origin/another-branch\n>> break add_rejected_path\n>> r\n... wait for break ...\n>> bt\n\nThanks,\nClemens\n"},{"id":"174907","messageId":"831uvu3sx2.fsf@kalahari.s2.org","threadId":"28307","inReplyTo":"20110906073436.GA28490@ecki","subject":"Re: \"Your local changes ... would be overwritten\" bug","fromName":"Hannu Koivisto","fromEmail":"azure@iki.fi","sentAt":"2011-09-06T09:46:01Z","receivedAt":"2011-09-06T09:46:01Z","isPatch":false,"sender":{"key":"azure@iki.fi","avatar":null},"body":"Clemens Buchacher <drizzd@aon.at> writes:\n\n> Could you set a breakpoint in add_rejected_path and send us the\n> backtrace? Like this:\n\nSince the binary from the package doesn't come with debug\ninformation, I built the latest git master (1.7.7.rc0.72.g4b5ea)\nand it turns out the problem cannot be reproduced with this version\nanymore.  I guess I should have tried that right away.  Sorry for\nthe noise.\n\n-- \nHannu\n"}]}