{"thread":{"id":"50920","subject":"fatal: unable to read after commit","startedAt":"2019-04-11T17:20:42Z","lastAt":"2019-04-22T16:21:30Z","messageCount":7,"participants":["Klaus Ethgen","Christian Couder","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"373669","messageId":"20190411164440.GC12669@ikki.ethgen.ch","threadId":"50920","inReplyTo":null,"subject":"fatal: unable to read after commit","fromName":"Klaus Ethgen","fromEmail":"klaus@ethgen.ch","sentAt":"2019-04-11T16:44:40Z","receivedAt":"2019-04-11T17:20:42Z","isPatch":false,"sender":{"key":"klaus@ethgen.ch","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA512\n\nHi folks,\n\nI am a heavy user of git now at version 2.20.1 on debian.\n\nSince some weeks I have the problem that I get often \"fatal: unable to\nread ...\" and a unclear repository after a git commit. The commit itself\nis correct and so a git reset --hard helps to fix the issue.\n\nAny Idea what could be the reason for that problem. I encounter it on\ndifferent repositories so not limited to one.\n\nAny hint how to find out the reason?\n\nRegards\n   Klaus\n\nPs. I am not subscribet to the list, so please keep me in the response.\n- -- \nKlaus Ethgen                                       http://www.ethgen.ch/\npub  4096R/4E20AF1C 2011-05-16            Klaus Ethgen <Klaus@Ethgen.ch>\nFingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C\n-----BEGIN PGP SIGNATURE-----\nComment: Charset: ISO-8859-1\n\niQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlyvbvEACgkQpnwKsYAZ\n9qyeggwAjLjfP8M2+Bybc6WFCnPjT2tAoU2Rpt1w7lPfycbqOykwa8YHML9Hy4OW\nG+ODpR3SXnRgKDzQ8xpz7i5/6pNC3ZlAYrvnOQFPHpL6zlOWr9aeDo8wai8FzVKk\n4ei32u3Gw/bu0tH6D/SKxCVjC8sZzHWx+NjUDJh8ld3ln5RmF5XpK5+UvVak/nal\nrj+MxUyB1Aklho5cnwlFbdW0aUOM6Iom4G5uZz3dfh3p2VuPNzbbU/RKYXHGrJIB\n01/Wh67r9XsML8z2kwYrpmT6Hcpuz/uuuIw81fHp55419YcbtS9bCJsYwYy0BGo0\nLWJX5PzyMbWbbJE6oS1YDZOfnY/W/iIdq9JysMsyt1+nURcWNkHdOQ4+vY5DeBDa\n/kEDH9BLyzGddLAShYvspMpZg2J5c0v1FtX9N7q4A/vUyemevpQKJq+qJPV1WelI\n7Hs45gvWj7oTOxVE4yJtMYkdO1jZLznVSLG36XT06+ciXiBl2FmVkTZ9yQaRse9L\nbIWDVDXp\n=4x1q\n-----END PGP SIGNATURE-----\n"},{"id":"373713","messageId":"CAP8UFD0bBBtOOz9ew_2URCp3nY1v0_OHMby1-N+T0nCDW82DRg@mail.gmail.com","threadId":"50920","inReplyTo":"20190411164440.GC12669@ikki.ethgen.ch","subject":"Re: fatal: unable to read after commit","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2019-04-12T08:39:02Z","receivedAt":"2019-04-12T08:39:16Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi,\n\nOn Thu, Apr 11, 2019 at 7:24 PM Klaus Ethgen <Klaus@ethgen.ch> wrote:\n\n> I am a heavy user of git now at version 2.20.1 on debian.\n>\n> Since some weeks I have the problem that I get often \"fatal: unable to\n> read ...\" and a unclear repository after a git commit. The commit itself\n> is correct and so a git reset --hard helps to fix the issue.\n\nCould you tell us at least which Debian version and file system you use?\n\nWould you be ok to bisect it or at least tell us if it happens with\n2.19.2, 2.20.0 and 2.21.0?\n\n> Any Idea what could be the reason for that problem. I encounter it on\n> different repositories so not limited to one.\n\nIs it easy to reproduce even on very small test repos? Could you send\nus a small script that reproduces it?\n\nCould you also run the Git test suite on your machine?\n\nThanks,\nChristian.\n"},{"id":"373719","messageId":"20190412091420.GF12669@ikki.ethgen.ch","threadId":"50920","inReplyTo":"CAP8UFD0bBBtOOz9ew_2URCp3nY1v0_OHMby1-N+T0nCDW82DRg@mail.gmail.com","subject":"Re: fatal: unable to read after commit","fromName":"Klaus Ethgen","fromEmail":"klaus@ethgen.ch","sentAt":"2019-04-12T09:14:21Z","receivedAt":"2019-04-12T09:14:25Z","isPatch":false,"sender":{"key":"klaus@ethgen.ch","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA512\n\nHi Christian,\n\nAm Fr den 12. Apr 2019 um  9:39 schrieb Christian Couder:\n> On Thu, Apr 11, 2019 at 7:24 PM Klaus Ethgen <Klaus@ethgen.ch> wrote:\n> \n> > I am a heavy user of git now at version 2.20.1 on debian.\n> >\n> > Since some weeks I have the problem that I get often \"fatal: unable to\n> > read ...\" and a unclear repository after a git commit. The commit itself\n> > is correct and so a git reset --hard helps to fix the issue.\n> \n> Could you tell us at least which Debian version and file system you use?\n\nSorry, it is debian unstable and the filesystem is a brfs.\n\n> Would you be ok to bisect it or at least tell us if it happens with\n> 2.19.2, 2.20.0 and 2.21.0?\n\nI could try, but from the fact, that it happens not all the time, I am\nnot sure if it helps.\n\nHowever, I might have found one repo where it allways happens. In fact,\nI am able to reproduce it also in my local geeqie checkout.\n\n> > Any Idea what could be the reason for that problem. I encounter it on\n> > different repositories so not limited to one.\n> \n> Is it easy to reproduce even on very small test repos? Could you send\n> us a small script that reproduces it?\n\nIn any case it happens if I modify a file and add+commit or commit -a\nit. What happens is that the index seems to be corrupted. The HEAD gets\nthe correct commit and the checked out version of the file is also\ncorrect. Only the index seems to be corrupt (Until I do git reset).\n\nWhen I do a git status, I get the following output:\n   Auf Branch master\n   Ihr Branch ist 1 Commit vor 'origin/master'.\n     (benutzen Sie \"git push\", um lokale Commits zu publizieren)\n\n   Zum Commit vorgemerkte Änderungen:\n     (benutzen Sie \"git reset HEAD <Datei>...\" zum Entfernen aus der Staging-Area)\n\n\t   neue Datei:     pending.data\n\n   Änderungen, die nicht zum Commit vorgemerkt sind:\n     (benutzen Sie \"git add/rm <Datei>...\", um die Änderungen zum Commit vorzumerken)\n     (benutzen Sie \"git checkout -- <Datei>...\", um die Änderungen im Arbeitsverzeichnis zu verwerfen)\n\n\t   gelöscht:       pending.data\n\nAnd it seems, that the brocken object is always the same:\n   > git diff\n   fatal: unable to read 544f4ec5fe7c7b04c73b2c2fe9e3e7779e929819\n\nindependent from the repository.\n\nI do not have a pending.data and did not touch this one.\n\n> Could you also run the Git test suite on your machine?\n\nSure.\n\nBut at the moment, I have some more findings that points to another\ncomponent in the queue. When I do a \"commit -a -m test\", the error does\nnot happens. When I do a \"commit -a\" and use the editor (vim) to write\nthe commit message, it happens.\n\nAs I use fugitive, I cannot rule out, that the problem is in that vim\naddon.\n\nRegards\n   Klaus\n- -- \nKlaus Ethgen                                       http://www.ethgen.ch/\npub  4096R/4E20AF1C 2011-05-16            Klaus Ethgen <Klaus@Ethgen.ch>\nFingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C\n-----BEGIN PGP SIGNATURE-----\nComment: Charset: ISO-8859-1\n\niQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlywVuYACgkQpnwKsYAZ\n9qybEQv/bn3Bs+e/xgPfWK9yDbBlcmVywAiBty5RgYl5FQNHPb/6rRbZMk9wT6MJ\nNkLGTj5sgrtRik+TU8C0j982XBJW6EY8jEIzOisBtm5aQ63KdymSI+q6MQd1C3/R\n1dd4IMfM2GylQohhsptUdRwErvjoOKHpqAvJnKMnzUC5YxYZ4QL64LLnjoCAz3mK\n1W4VceZVHluD/2nv9HP5aOgqihWJNYhIGP9308X4JXw6qn5wGWGljDsyk4NE+NWr\n3O0QBYGJO7AYA1WH6eCrPx7DSrPpArdLIwhQCntIKJIrsf3mn4VBUAVB+uhTLeIa\noFyx9vSX/9KlruL/ni287RCRJBYh4DVDsXligFeUTRe0SOuVPgjku9R2oYKpoeKB\n7AhI+rKY6vg3At/6iIcaeSw7+ln8ilSqLmbTAz0ygc16T7+CNK5En+nAM2otiNmU\nFs5upQsVGb6pCFTp6aC8P6v+eTqlvH+l6jMsR/7Lx95U9+yOSdSO5x9sbCasCs/g\nZ/XxPGkv\n=P22A\n-----END PGP SIGNATURE-----\n"},{"id":"373722","messageId":"20190412092825.GG12669@ikki.ethgen.ch","threadId":"50920","inReplyTo":"CAP8UFD0bBBtOOz9ew_2URCp3nY1v0_OHMby1-N+T0nCDW82DRg@mail.gmail.com","subject":"Re: fatal: unable to read after commit","fromName":"Klaus Ethgen","fromEmail":"klaus@ethgen.ch","sentAt":"2019-04-12T09:28:26Z","receivedAt":"2019-04-12T09:28:29Z","isPatch":false,"sender":{"key":"klaus@ethgen.ch","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA512\n\nI seems to have found the bug.\n\nMy last debugging gave the hint. pending.data is a concept of\ntaskwarrior and have the .task directory on git control. And I also use\na vim addon for it[0].\n\nIt seems that it introduces that troubles. As the last commit is from\n2016, it is very strange. Especially as I had that troubles not before.\n\nRegards\n   Klaus\n- -- \nKlaus Ethgen                                       http://www.ethgen.ch/\npub  4096R/4E20AF1C 2011-05-16            Klaus Ethgen <Klaus@Ethgen.ch>\nFingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C\n-----BEGIN PGP SIGNATURE-----\nComment: Charset: ISO-8859-1\n\niQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlywWjkACgkQpnwKsYAZ\n9qwZDgv+Pcg834UWtW5VJ9gwEz7Won8Vdt9/yPUEKb8h8hoD0goI/5J4LlTNVyn0\nmKcfvPr1QCZTy08fltrSJPtJwyhvkcJpzxZ8+1XtQsRea6V3IXEN6D8HTpzfPSfm\nwAIyTqX31F66Almk2sxxit9aRqCbio+KhyN50twDAOq60SwVtw/1Yex/VqP1WxHb\n8245u9bg88hgdpJROZsiPA320XOBrQqykDTwvWyKsLewAhhx5qmxsm3SXcmzp7NC\nkjIsqtiFNB68uzcAdwq2RLe7OEexoNHNHpktzWhL25CdPIIeQJIYHKiLXgj/dl3J\nG4RrbXHAw6GAoB3ce5IboDpU2jm2JpgXtKIhbJItV4Tt/ju2pmP3caTc/JMZF4Vz\njLfcg8KyD+pe/mI9h0Tj71lz6Q3FvVY9HNW6t38v/5KM2n8gjYqfwkuXIT5xy/Dk\n42D1WDoN+9qo8reLlrA4yK37DG2ze2q/+kf8mf2Vp2gJZB0/wfcFsr8xYiVHr14O\nzH+WboKx\n=y0cC\n-----END PGP SIGNATURE-----\n"},{"id":"373723","messageId":"20190412093045.GH12669@ikki.ethgen.ch","threadId":"50920","inReplyTo":"CAP8UFD0bBBtOOz9ew_2URCp3nY1v0_OHMby1-N+T0nCDW82DRg@mail.gmail.com","subject":"Re: fatal: unable to read after commit","fromName":"Klaus Ethgen","fromEmail":"klaus@ethgen.ch","sentAt":"2019-04-12T09:30:46Z","receivedAt":"2019-04-12T09:30:49Z","isPatch":false,"sender":{"key":"klaus@ethgen.ch","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA512\n\nForgot the link:\n[0] https://github.com/farseer90718/vim-taskwarrior\nRegards\n   Klaus\n- -- \nKlaus Ethgen                                       http://www.ethgen.ch/\npub  4096R/4E20AF1C 2011-05-16            Klaus Ethgen <Klaus@Ethgen.ch>\nFingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C\n-----BEGIN PGP SIGNATURE-----\nComment: Charset: ISO-8859-1\n\niQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlywWsUACgkQpnwKsYAZ\n9qwJNAv8D+9xnl9/E18OBG0I2lY70Fgm+NqdPrF+4RZVJ86UBJHT+R+K3hzxfbX6\ngZb3qytdyIDms58KG6iB80Hk9d6BBJK8JLHdRV4cVwL6cpwT+EXPKzJUPgpU1rbs\nBJbISWSP97+8O+5blPpddxaFGlsV77kdTDQYEabxIZ2WhmsgWDjD5uN7l5XSmhvC\n9qRiI0+eQFQRDWDZHBeMunES18ntIVZRhidvzAQo+uMW5YZXd+hyrZBTJznBbbs7\nu+GOIqS3a4ShxrxIjlQZQfE8RXlgoj10rqtRgJ4TvuftQsFjJP/cXTy+NXxxghuR\n2/Fk9fTxgwIF+tPqZwQHLfHoQGlu0vNZ0zEGK674fdJ4AQ4NGrxgn50MYAYv8Npo\nzHW/jCh61slON2XbNASQpx9PV/WsuUFQNQEAtJ477NVthT2omfRNoyPxYNZW/+aL\nXJMCYSPbe9iQ5oN/3hicP4/V7vHNlzA0197/DGCwsJMieEyfBj6MWIHZuT/Z9bos\nHBLkJuIE\n=QrfL\n-----END PGP SIGNATURE-----\n"},{"id":"373790","messageId":"20190413092136.GK12669@ikki.ethgen.ch","threadId":"50920","inReplyTo":"CAP8UFD0bBBtOOz9ew_2URCp3nY1v0_OHMby1-N+T0nCDW82DRg@mail.gmail.com","subject":"Re: fatal: unable to read after commit - deeper analysis","fromName":"Klaus Ethgen","fromEmail":"klaus@ethgen.ch","sentAt":"2019-04-13T09:21:36Z","receivedAt":"2019-04-13T09:21:40Z","isPatch":false,"sender":{"key":"klaus@ethgen.ch","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA512\n\nHi,\n\nI did a deep analysis of the problem and found that the trouble finally\nwas caused of some change in git (I did not search, when this changed.\nBut maybe you can tell me.)\n\nFinally, the error was a combination of 4 tools, git, vim, the mentioned\nvim-addon and task with a task-hook for committing pending.data.\n\nWhen I do a git commit which invokes vim, then the following variables\nare set:\n- - GIT_INDEX_FILE\n- - GIT_AUTHOR_DATE\n- - GIT_PREFIX\n- - GIT_EXEC_PATH\n\nAnd $GIT_INDEX_FILE is the source of trouble here. The task-hook clears\nrespective sets the variables GIT_DIR and GIT_WORK_TREE. However, the\nGIT_INDEX_FILE environment is set (in some cases) to an absolute path\npointing to .git/index.lock or .git/index (I have no idea when it is\ntaking the .lock variant).\n\nNow we have a mismatch of GIT_DIR and GIT_WORK_TREE on one hand and the\nabsolute path of GIT_INDEX_FILE on the other. So the trouble is set. The\nfollowing \"git add pending.data\" did break all. It does something to an\nindex that does not belong to the git repo.\n\nMystery is when and why this changed in git. It was definitively changed\nin some recent version.\n\nRegards\n   Klaus\n- -- \nKlaus Ethgen                                       http://www.ethgen.ch/\npub  4096R/4E20AF1C 2011-05-16            Klaus Ethgen <Klaus@Ethgen.ch>\nFingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C\n-----BEGIN PGP SIGNATURE-----\nComment: Charset: ISO-8859-1\n\niQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlyxqh8ACgkQpnwKsYAZ\n9qxXWAv/QI6XeQ4H+Y39K3nLi68JLZo2/VzcI1CfVw42PeckxzxZHg1YUTXrr5Qk\n+bQ5drXcfzNMxWkCe1fh9CoHiyJyiAIPNfMjqiUaCB8881Ttr4SYd/lalvYVXPgt\nm0g7XO51Kh5LqPP6h7KcjBM0c6OSyQznE8Q6L0FSnDP4gCkBTW75AmxBytUk+sDq\nuOajtyOiOr1Fz1krn89VBaLJJPMVo+OInbNwetQUgOGIN7BsHsG68Ilwoimdlt+H\n7sd5HJwVrQ/w9VdXzniLPznzkG4l/3YlU8IQWKR13dRFf68LrT1ZR+F4TJpjlm/Y\nl/KKF0EcVKbhuJ47gLIUDf3faeLFxdF1iOviKkJ0A0cfg5Z8M4ds8hBoiqhMSr+X\n5fgINyhQfMurSTAuspZLJ0xjLu+Wv+h9Xt1jQZpW3YlPgi3O6Dn2K1V9ACaozP8G\n0EIIMOvTNvqVw9iLe4a6cBm1M+gXfWRRf7H6wqvDhDuuSVF2h1sGwMMQHiumlqm3\nau+0hEGQ\n=6ikc\n-----END PGP SIGNATURE-----\n"},{"id":"374253","messageId":"20190422162127.GC9680@sigill.intra.peff.net","threadId":"50920","inReplyTo":"20190413092136.GK12669@ikki.ethgen.ch","subject":"Re: fatal: unable to read after commit - deeper analysis","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-04-22T16:21:27Z","receivedAt":"2019-04-22T16:21:30Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Apr 13, 2019 at 10:21:36AM +0100, Klaus Ethgen wrote:\n\n> Finally, the error was a combination of 4 tools, git, vim, the mentioned\n> vim-addon and task with a task-hook for committing pending.data.\n> \n> When I do a git commit which invokes vim, then the following variables\n> are set:\n> - GIT_INDEX_FILE\n> - GIT_AUTHOR_DATE\n> - GIT_PREFIX\n> - GIT_EXEC_PATH\n> \n> And $GIT_INDEX_FILE is the source of trouble here. The task-hook clears\n> respective sets the variables GIT_DIR and GIT_WORK_TREE. However, the\n> GIT_INDEX_FILE environment is set (in some cases) to an absolute path\n> pointing to .git/index.lock or .git/index (I have no idea when it is\n> taking the .lock variant).\n> \n> Now we have a mismatch of GIT_DIR and GIT_WORK_TREE on one hand and the\n> absolute path of GIT_INDEX_FILE on the other. So the trouble is set. The\n> following \"git add pending.data\" did break all. It does something to an\n> index that does not belong to the git repo.\n> \n> Mystery is when and why this changed in git. It was definitively changed\n> in some recent version.\n\nIt was always the case that GIT_INDEX_FILE would sometimes be set. For a\npartial commit like:\n\n  echo changes >>one\n  echo changes >>two\n  git add .\n  git commit two\n\nwe have to create a temporary index (so as not to commit the staged\nchanges from \"one\").\n\nI was curious if we started setting it for the more vanilla case of\njust \"git commit\" more recently. But trying to bisect on:\n\n  GIT_EDITOR=set | grep ^GIT_INDEX; :' git commit\n\nI couldn't find any version where we _didn't_ set $GIT_INDEX_FILE, going\nback to v1.6.0. So I don't know of any recent changes in this area.\n\nPresumably you've fixed it by unsetting $GIT_INDEX_FILE in your vim\ntask-hook when it switches to another repo. However, you may want to\nswitch to asking Git about the full list of repo-related variables you\nshould clear. In the shell that looks like:\n\n  unset $(git rev-parse --local-env-vars)\n\nThat should be more thorough, and will future-proof you against new\nvariables being added.\n\n-Peff\n"}]}