{"thread":{"id":"17461","subject":"diff-index --cached on bare repository","startedAt":"2009-01-30T16:13:53Z","lastAt":"2009-01-30T20:06:25Z","messageCount":2,"participants":["Johannes Gilger","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"102610","messageId":"glv901$c5v$1@ger.gmane.org","threadId":"17461","inReplyTo":null,"subject":"diff-index --cached on bare repository","fromName":"Johannes Gilger","fromEmail":"heipei@hackvalue.de","sentAt":"2009-01-30T16:13:53Z","receivedAt":"2009-01-30T16:13:53Z","isPatch":false,"sender":{"key":"heipei@hackvalue.de","avatar":"https://avatars.githubusercontent.com/u/6072?v=4"},"body":"Hi list,\n\ntoday I stumbled over the output of \"git diff-index --cached HEAD\" in a \nbare repository. While diff-index HEAD just reminds me that I got to \nhave a work-tree, --cached outputs all the files in HEAD as deleted. The \nquestion is if this is intended behaviour? Or is it irrelevant because \ndiff-index is only plumbing? I found a mail of the gitk-team working \naround this, which is funny because I discovered this while working on \nGitX.\n\nSo please, enlighten me ;)\n\nGreetings,\nJojo\n\n-- \nJohannes Gilger <heipei@hackvalue.de>\nhttp://hackvalue.de/heipei/\nGPG-Key: 0x42F6DE81\nGPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81\n"},{"id":"102641","messageId":"20090130200625.GB3054@coredump.intra.peff.net","threadId":"17461","inReplyTo":"glv901$c5v$1@ger.gmane.org","subject":"Re: diff-index --cached on bare repository","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-30T20:06:25Z","receivedAt":"2009-01-30T20:06:25Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 30, 2009 at 04:13:53PM +0000, Johannes Gilger wrote:\n\n> today I stumbled over the output of \"git diff-index --cached HEAD\" in a \n> bare repository. While diff-index HEAD just reminds me that I got to \n> have a work-tree, --cached outputs all the files in HEAD as deleted. The \n> question is if this is intended behaviour? Or is it irrelevant because \n> diff-index is only plumbing? I found a mail of the gitk-team working \n> around this, which is funny because I discovered this while working on \n> GitX.\n\nGenerally commands which don't make sense in a bare repository are\nforbidden. But diff-index _can_ work in a bare repository, since there\nis no reason you can't do index-only operations. However, a bare repo\nhas no index by default, in which case diff-index shows the results you\nsaw.\n\nSo no, it's not a bug, but it is potentially confusing. I think nobody\never worried about it because diff-index is plumbing, so users are\nunlikely to stumble into it.\n\n-Peff\n"}]}