{"thread":{"id":"45867","subject":"not uptodate. Cannot merge","startedAt":"2017-05-04T21:40:20Z","lastAt":"2017-05-05T15:25:32Z","messageCount":3,"participants":["G. Sylvie Davies","Johannes Schindelin","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"318801","messageId":"CAAj3zPzHiwgS=2CSKP1y8zGUxHUWiq9TSeMhixeL+9ZfffY-pw@mail.gmail.com","threadId":"45867","inReplyTo":null,"subject":"not uptodate. Cannot merge","fromName":"G. Sylvie Davies","fromEmail":"sylvie@bit-booster.com","sentAt":"2017-05-04T21:40:12Z","receivedAt":"2017-05-04T21:40:20Z","isPatch":false,"sender":{"key":"sylvie@bit-booster.com","avatar":"https://gravatar.com/avatar/eb5bda7d3fb1e3361252bbf100d1f355ffe9ff8d8b559a08e4c7bc17d6f949d5?d=mp&s=160"},"body":"Hi,\n\nMy little bitbucket \"cherry-pick\" button is failing on Windows from a\n\"git reset --hard\" blowing up.\n\nMy situation:  Git-2.10.2.windows.1 / Bitbucket-4.14.3 / Windows\n10-10.0-amd64.   But I suspect even more recent Git will have the same\nproblem.\n\nNow, I'm pretty far from Kansas here as you'll see from my \"git clone\"\ninvocation:\n\ngit.exe clone -c core.checkStat=minimal -c core.fileMode=false -c\ncore.ignoreStat=true -c core.trustctime=false -c\ncore.logAllRefUpdates=false --shared\nC:\\Users\\gsylvie\\dev\\bb\\target\\bitbucket\\home\\shared\\data\\repositories\\1\nC:\\Users\\gsylvie\\dev\\bb\\target\\bitbucket\\home\\caches\\bbClones\\1\n\n\nRight after cloning I create a \".git/info/attributes\" file containing\njust this one line:\n\n* -text\n\n\nAfter the clone, here's the sequence of commands leading up to the bad\n\"git reset --hard\".  These are all fine (well, the \"--aborts\" whine a\nlittle, but that's expected):\n\ngit.exe branch --unset-upstream\ngit.exe update-index --refresh\ngit.exe rebase --abort\ngit.exe cherry-pick --abort\n\n\nAnd here's the \"git reset --hard\" that fails:\n\ngit.exe reset --hard --quiet d6edcbf924697ab811a867421dab60d954ccad99 --\n\n---\nExit=128\nerror: Entry 'basic_branching/file.txt' not uptodate. Cannot merge.\nfatal: Could not reset index file to revision\n'd6edcbf924697ab811a867421dab60d954ccad99'.\n---\n\nFor now I've come up with an astonishing workaround:   I just run \"git\nstatus\" afterwards, and then everything is fine!\n\nI'm going to limp along with this remedy, but I thought I'd share it\nhere in case anyone has any ideas, or in case it really is a bug.\n\n\n- Sylvie\n\n\np.s.  Thanks for mentioning \"git-reverse.sh\" in git rev news!\n"},{"id":"318844","messageId":"alpine.DEB.2.21.1.1705051708311.146734@virtualbox","threadId":"45867","inReplyTo":"CAAj3zPzHiwgS=2CSKP1y8zGUxHUWiq9TSeMhixeL+9ZfffY-pw@mail.gmail.com","subject":"Re: not uptodate. Cannot merge","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-05-05T15:12:39Z","receivedAt":"2017-05-05T15:12:50Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Sylvie,\n\nOn Thu, 4 May 2017, G. Sylvie Davies wrote:\n\n> My situation:  Git-2.10.2.windows.1 / Bitbucket-4.14.3 / Windows\n> 10-10.0-amd64.   But I suspect even more recent Git will have the same\n> problem.\n\nIn contrast, I suspect that recent Git for Windows versions have tons of\nCR/LF-related fixes... ;-)\n\n> Right after cloning I create a \".git/info/attributes\" file containing\n> just this one line:\n> \n> * -text\n> \n> \n> After the clone, here's the sequence of commands leading up to the bad\n> \"git reset --hard\".  These are all fine (well, the \"--aborts\" whine a\n> little, but that's expected):\n> \n> git.exe branch --unset-upstream\n> git.exe update-index --refresh\n> git.exe rebase --abort\n> git.exe cherry-pick --abort\n> \n> \n> And here's the \"git reset --hard\" that fails:\n> \n> git.exe reset --hard --quiet d6edcbf924697ab811a867421dab60d954ccad99 --\n> \n> ---\n> Exit=128\n> error: Entry 'basic_branching/file.txt' not uptodate. Cannot merge.\n> fatal: Could not reset index file to revision\n> 'd6edcbf924697ab811a867421dab60d954ccad99'.\n> ---\n\nThis smells very much like a problem I vaguely remember has been addressed\nrecently: Torsten Bögershausen was working on issues where files checked\nout with one line ending, and then \"retroactively\" become dirty by\nchanging the line ending convention (which your -text seems to do) and Git\nnot really noticing this until the `reset --hard` call that simply cannot\ncope with \"this kind of dirty\".\n\nIn essence, I am fairly certain that v2.12.2(2) should *not* display this\nbehavior.\n\nIf my hunch is wrong, please do fill out a full bug report at\nhttps://github.com/git-for-windows/git/issues/new, preferably with a short\nand sweet script to reproduce the problem elsewhere.\n\nThanks,\nJohannes"},{"id":"318845","messageId":"8b15577d-f997-79b5-5a77-2a8c01e20cf7@web.de","threadId":"45867","inReplyTo":"CAAj3zPzHiwgS=2CSKP1y8zGUxHUWiq9TSeMhixeL+9ZfffY-pw@mail.gmail.com","subject":"Re: not uptodate. Cannot merge","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2017-05-05T15:25:16Z","receivedAt":"2017-05-05T15:25:32Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 2017-05-04 23:40, G. Sylvie Davies wrote:\n> Hi,\n> \n> My little bitbucket \"cherry-pick\" button is failing on Windows from a\n> \"git reset --hard\" blowing up.\n> \n> My situation:  Git-2.10.2.windows.1 / Bitbucket-4.14.3 / Windows\n> 10-10.0-amd64.   But I suspect even more recent Git will have the same\n> problem.\n> \n> Now, I'm pretty far from Kansas here as you'll see from my \"git clone\"\n> invocation:\n> \n> git.exe clone -c core.checkStat=minimal -c core.fileMode=false -c\n> core.ignoreStat=true -c core.trustctime=false -c\n> core.logAllRefUpdates=false --shared\n> C:\\Users\\gsylvie\\dev\\bb\\target\\bitbucket\\home\\shared\\data\\repositories\\1\n> C:\\Users\\gsylvie\\dev\\bb\\target\\bitbucket\\home\\caches\\bbClones\\1\n> \n> \n> Right after cloning I create a \".git/info/attributes\" file containing\n> just this one line:\n> \n> * -text\nThis -may- be part of the problem.\nIn general, it is possible to add attributes on your local copy like\nthis, but it is not recommendet, at least not from me.\nIn general, the project should have a .gitattributes file, which\nbelongs to the project and which travels together with push and pull.\nAnd of course, files should have been \"normalized\" and have LF in the repo.\n\nIn your case:\nWhat does\ngit config core.autocrlf\nsay?\n\n[]\n\n"}]}